| author | |
| committer | |
| log | cdcfd15d3c7b573dcba21b64ffdf982e26524e50 |
| tree | 6367af08dfc16dd5ec496620f4eee11ade7a85f4 |
| parent | 928c4c9bd303804b598df33518156a88edbb1a3a |
musl uses "i386" for this while Zig has switched to "x86".4 files changed, 14 insertions(+), 5 deletions(-)
src/Compilation.zig+1-1| ... | ... | @@ -4918,7 +4918,7 @@ fn detectLibCFromBuilding( |
| 4918 | 4918 | const generic_name = target_util.libCGenericName(target); |
| 4919 | 4919 | // Some architectures are handled by the same set of headers. |
| 4920 | 4920 | const arch_name = if (target.abi.isMusl()) |
| 4921 | musl.archName(target.cpu.arch) | |
| 4921 | musl.archNameHeaders(target.cpu.arch) | |
| 4922 | 4922 | else if (target.cpu.arch.isThumb()) |
| 4923 | 4923 | // ARM headers are valid for Thumb too. |
| 4924 | 4924 | switch (target.cpu.arch) { |
src/musl.zig+11-2| ... | ... | @@ -258,7 +258,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 258 | 258 | } |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | pub fn archName(arch: std.Target.Cpu.Arch) [:0]const u8 { | |
| 261 | fn archName(arch: std.Target.Cpu.Arch) [:0]const u8 { | |
| 262 | 262 | switch (arch) { |
| 263 | 263 | .aarch64, .aarch64_be => return "aarch64", |
| 264 | 264 | .arm, .armeb, .thumb, .thumbeb => return "arm", |
| ... | ... | @@ -275,6 +275,13 @@ pub fn archName(arch: std.Target.Cpu.Arch) [:0]const u8 { |
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | pub fn archNameHeaders(arch: std.Target.Cpu.Arch) [:0]const u8 { | |
| 279 | return switch (arch) { | |
| 280 | .x86 => return "x86", | |
| 281 | else => archName(arch), | |
| 282 | }; | |
| 283 | } | |
| 284 | ||
| 278 | 285 | // Return true if musl has arch-specific crti/crtn sources. |
| 279 | 286 | // See lib/libc/musl/crt/ARCH/crt?.s . |
| 280 | 287 | pub fn needsCrtiCrtn(target: std.Target) bool { |
| ... | ... | @@ -361,7 +368,9 @@ fn addCcArgs( |
| 361 | 368 | const target = comp.getTarget(); |
| 362 | 369 | const arch_name = archName(target.cpu.arch); |
| 363 | 370 | const os_name = @tagName(target.os.tag); |
| 364 | const triple = try std.fmt.allocPrint(arena, "{s}-{s}-musl", .{ arch_name, os_name }); | |
| 371 | const triple = try std.fmt.allocPrint(arena, "{s}-{s}-musl", .{ | |
| 372 | archNameHeaders(target.cpu.arch), os_name, | |
| 373 | }); | |
| 365 | 374 | const o_arg = if (want_O3) "-O3" else "-Os"; |
| 366 | 375 | |
| 367 | 376 | try args.appendSlice(&[_][]const u8{ |
src/wasi_libc.zig+1-1| ... | ... | @@ -256,7 +256,7 @@ fn addCCArgs( |
| 256 | 256 | want_O3: bool, |
| 257 | 257 | ) error{OutOfMemory}!void { |
| 258 | 258 | const target = comp.getTarget(); |
| 259 | const arch_name = musl.archName(target.cpu.arch); | |
| 259 | const arch_name = musl.archNameHeaders(target.cpu.arch); | |
| 260 | 260 | const os_name = @tagName(target.os.tag); |
| 261 | 261 | const triple = try std.fmt.allocPrint(arena, "{s}-{s}-musl", .{ arch_name, os_name }); |
| 262 | 262 | const o_arg = if (want_O3) "-O3" else "-Os"; |
tools/process_headers.zig+1-1| ... | ... | @@ -208,7 +208,7 @@ const musl_targets = [_]LibCTarget{ |
| 208 | 208 | .abi = MultiAbi.musl, |
| 209 | 209 | }, |
| 210 | 210 | LibCTarget{ |
| 211 | .name = "x86", | |
| 211 | .name = "i386", | |
| 212 | 212 | .arch = MultiArch{ .specific = .x86 }, |
| 213 | 213 | .abi = MultiAbi.musl, |
| 214 | 214 | }, |