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(
31803180 const generic_name = target_util.libCGenericName(target);
31813181 // Some architectures are handled by the same set of headers.
31823182 const arch_name = if (target.abi.isMusl())
3183 musl.archMuslName(target.cpu.arch)
3183 musl.archName(target.cpu.arch)
31843184 else if (target.cpu.arch.isThumb())
31853185 // ARM headers are valid for Thumb too.
31863186 switch (target.cpu.arch) {
src/musl.zig+4-4
......@@ -108,7 +108,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
108108 // When there is a src/<arch>/foo.* then it should substitute for src/foo.*
109109 // Even a .s file can substitute for a .c file.
110110 const target = comp.getTarget();
111 const arch_name = archMuslName(target.cpu.arch);
111 const arch_name = archName(target.cpu.arch);
112112 var source_table = std.StringArrayHashMap(Ext).init(comp.gpa);
113113 defer source_table.deinit();
114114
......@@ -248,7 +248,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
248248 }
249249}
250250
251pub fn archMuslName(arch: std.Target.Cpu.Arch) [:0]const u8 {
251pub fn archName(arch: std.Target.Cpu.Arch) [:0]const u8 {
252252 switch (arch) {
253253 .aarch64, .aarch64_be => return "aarch64",
254254 .arm, .armeb, .thumb, .thumbeb => return "arm",
......@@ -350,7 +350,7 @@ fn addCcArgs(
350350 want_O3: bool,
351351) error{OutOfMemory}!void {
352352 const target = comp.getTarget();
353 const arch_name = archMuslName(target.cpu.arch);
353 const arch_name = archName(target.cpu.arch);
354354 const os_name = @tagName(target.os.tag);
355355 const triple = try std.fmt.allocPrint(arena, "{s}-{s}-musl", .{ arch_name, os_name });
356356 const o_arg = if (want_O3) "-O3" else "-Os";
......@@ -398,7 +398,7 @@ fn addCcArgs(
398398fn start_asm_path(comp: *Compilation, arena: *Allocator, basename: []const u8) ![]const u8 {
399399 const target = comp.getTarget();
400400 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,
402402 });
403403}
404404
src/wasi_libc.zig+2-1
......@@ -5,6 +5,7 @@ const Allocator = std.mem.Allocator;
55const Compilation = @import("Compilation.zig");
66const build_options = @import("build_options");
77const target_util = @import("target.zig");
8const musl = @import("musl.zig");
89
910pub fn buildWasiLibcSysroot(comp: *Compilation) !void {
1011 if (!build_options.have_llvm) {
......@@ -226,7 +227,7 @@ fn addCCArgs(
226227 want_O3: bool,
227228) error{OutOfMemory}!void {
228229 const target = comp.getTarget();
229 const arch_name = target_util.archMuslName(target.cpu.arch);
230 const arch_name = musl.archName(target.cpu.arch);
230231 const os_name = @tagName(target.os.tag);
231232 const triple = try std.fmt.allocPrint(arena, "{s}-{s}-musl", .{ arch_name, os_name });
232233 const o_arg = if (want_O3) "-O3" else "-Os";