authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-23 13:32:52-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-23 13:32:52-07:00
logae01c65a58688f681acb062f5aa7e836dd6ddeb0
tree9ba0bce1ed75aa0e096580343163f9848cd1bb65
parent0f2612037784570930dea433afef559ff6161b21

stage2: fix reference to musl arch name

Also rename musl.archMuslName to musl.archName. Fixes a merge conflict from #8730 and #8837

3 files changed, 7 insertions(+), 6 deletions(-)

src/Compilation.zig+1-1
...@@ -3180,7 +3180,7 @@ fn detectLibCIncludeDirs(...@@ -3180,7 +3180,7 @@ fn detectLibCIncludeDirs(
3180 const generic_name = target_util.libCGenericName(target);3180 const generic_name = target_util.libCGenericName(target);
3181 // Some architectures are handled by the same set of headers.3181 // Some architectures are handled by the same set of headers.
3182 const arch_name = if (target.abi.isMusl())3182 const arch_name = if (target.abi.isMusl())
3183 musl.archMuslName(target.cpu.arch)3183 musl.archName(target.cpu.arch)
3184 else if (target.cpu.arch.isThumb())3184 else if (target.cpu.arch.isThumb())
3185 // ARM headers are valid for Thumb too.3185 // ARM headers are valid for Thumb too.
3186 switch (target.cpu.arch) {3186 switch (target.cpu.arch) {
src/musl.zig+4-4
...@@ -108,7 +108,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {...@@ -108,7 +108,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
108 // When there is a src/<arch>/foo.* then it should substitute for src/foo.*108 // When there is a src/<arch>/foo.* then it should substitute for src/foo.*
109 // Even a .s file can substitute for a .c file.109 // Even a .s file can substitute for a .c file.
110 const target = comp.getTarget();110 const target = comp.getTarget();
111 const arch_name = archMuslName(target.cpu.arch);111 const arch_name = archName(target.cpu.arch);
112 var source_table = std.StringArrayHashMap(Ext).init(comp.gpa);112 var source_table = std.StringArrayHashMap(Ext).init(comp.gpa);
113 defer source_table.deinit();113 defer source_table.deinit();
114114
...@@ -248,7 +248,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {...@@ -248,7 +248,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
248 }248 }
249}249}
250250
251pub fn archMuslName(arch: std.Target.Cpu.Arch) [:0]const u8 {251pub fn archName(arch: std.Target.Cpu.Arch) [:0]const u8 {
252 switch (arch) {252 switch (arch) {
253 .aarch64, .aarch64_be => return "aarch64",253 .aarch64, .aarch64_be => return "aarch64",
254 .arm, .armeb, .thumb, .thumbeb => return "arm",254 .arm, .armeb, .thumb, .thumbeb => return "arm",
...@@ -350,7 +350,7 @@ fn addCcArgs(...@@ -350,7 +350,7 @@ fn addCcArgs(
350 want_O3: bool,350 want_O3: bool,
351) error{OutOfMemory}!void {351) error{OutOfMemory}!void {
352 const target = comp.getTarget();352 const target = comp.getTarget();
353 const arch_name = archMuslName(target.cpu.arch);353 const arch_name = archName(target.cpu.arch);
354 const os_name = @tagName(target.os.tag);354 const os_name = @tagName(target.os.tag);
355 const triple = try std.fmt.allocPrint(arena, "{s}-{s}-musl", .{ arch_name, os_name });355 const triple = try std.fmt.allocPrint(arena, "{s}-{s}-musl", .{ arch_name, os_name });
356 const o_arg = if (want_O3) "-O3" else "-Os";356 const o_arg = if (want_O3) "-O3" else "-Os";
...@@ -398,7 +398,7 @@ fn addCcArgs(...@@ -398,7 +398,7 @@ fn addCcArgs(
398fn start_asm_path(comp: *Compilation, arena: *Allocator, basename: []const u8) ![]const u8 {398fn start_asm_path(comp: *Compilation, arena: *Allocator, basename: []const u8) ![]const u8 {
399 const target = comp.getTarget();399 const target = comp.getTarget();
400 return comp.zig_lib_directory.join(arena, &[_][]const u8{400 return comp.zig_lib_directory.join(arena, &[_][]const u8{
401 "libc", "musl", "crt", archMuslName(target.cpu.arch), basename,401 "libc", "musl", "crt", archName(target.cpu.arch), basename,
402 });402 });
403}403}
404404
src/wasi_libc.zig+2-1
...@@ -5,6 +5,7 @@ const Allocator = std.mem.Allocator;...@@ -5,6 +5,7 @@ const Allocator = std.mem.Allocator;
5const Compilation = @import("Compilation.zig");5const Compilation = @import("Compilation.zig");
6const build_options = @import("build_options");6const build_options = @import("build_options");
7const target_util = @import("target.zig");7const target_util = @import("target.zig");
8const musl = @import("musl.zig");
89
9pub fn buildWasiLibcSysroot(comp: *Compilation) !void {10pub fn buildWasiLibcSysroot(comp: *Compilation) !void {
10 if (!build_options.have_llvm) {11 if (!build_options.have_llvm) {
...@@ -226,7 +227,7 @@ fn addCCArgs(...@@ -226,7 +227,7 @@ fn addCCArgs(
226 want_O3: bool,227 want_O3: bool,
227) error{OutOfMemory}!void {228) error{OutOfMemory}!void {
228 const target = comp.getTarget();229 const target = comp.getTarget();
229 const arch_name = target_util.archMuslName(target.cpu.arch);230 const arch_name = musl.archName(target.cpu.arch);
230 const os_name = @tagName(target.os.tag);231 const os_name = @tagName(target.os.tag);
231 const triple = try std.fmt.allocPrint(arena, "{s}-{s}-musl", .{ arch_name, os_name });232 const triple = try std.fmt.allocPrint(arena, "{s}-{s}-musl", .{ arch_name, os_name });
232 const o_arg = if (want_O3) "-O3" else "-Os";233 const o_arg = if (want_O3) "-O3" else "-Os";