authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-12 20:34:54-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-12 20:34:54-07:00
log799d1f0d36f69c8aead5184a76f87b557d690d7b
treec731b5cebf5f86b19b381b989577cb8693af6d60
parent40a47eae65b918866abc9d745f89d837f6a1e591

build system: fix wrong glibc dir passed to qemu for i386

Without this, and with `-Denable-qemu -Denable-foreign-glibc`, i386-linux-gnu tests failed because the `-L` path passed to qemu was "i386-linux-gnu" (nonexistent) rather than "i686-linux-gnu". Fixes std lib and behavior tests when using these options to enable test coverage with cross compiled glibcs.

1 files changed, 13 insertions(+), 3 deletions(-)

lib/std/build.zig+13-3
......@@ -2480,9 +2480,19 @@ pub const LibExeObjStep = struct {
24802480 try zig_args.append("--test-cmd");
24812481 try zig_args.append(bin_name);
24822482 if (glibc_dir_arg) |dir| {
2483 const full_dir = try fs.path.join(builder.allocator, &[_][]const u8{
2484 dir,
2485 try self.target.linuxTriple(builder.allocator),
2483 // TODO look into making this a call to `linuxTriple`. This
2484 // needs the directory to be called "i686" rather than
2485 // "i386" which is why we do it manually here.
2486 const fmt_str = "{s}" ++ fs.path.sep_str ++ "{s}-{s}-{s}";
2487 const cpu_arch = self.target.getCpuArch();
2488 const os_tag = self.target.getOsTag();
2489 const abi = self.target.getAbi();
2490 const cpu_arch_name: []const u8 = if (cpu_arch == .i386)
2491 "i686"
2492 else
2493 @tagName(cpu_arch);
2494 const full_dir = try std.fmt.allocPrint(builder.allocator, fmt_str, .{
2495 dir, cpu_arch_name, @tagName(os_tag), @tagName(abi),
24862496 });
24872497
24882498 try zig_args.append("--test-cmd");