aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-05-12 20:34:54 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-05-12 20:34:54 -0700
commit799d1f0d36f69c8aead5184a76f87b557d690d7b (patch)
treec731b5cebf5f86b19b381b989577cb8693af6d60
parent40a47eae65b918866abc9d745f89d837f6a1e591 (diff)
downloadzig-799d1f0d36f69c8aead5184a76f87b557d690d7b.tar.gz
zig-799d1f0d36f69c8aead5184a76f87b557d690d7b.zip
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.
-rw-r--r--lib/std/build.zig16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/std/build.zig b/lib/std/build.zig
index 1bdd97b253..9d12a4de51 100644
--- a/lib/std/build.zig
+++ b/lib/std/build.zig
@@ -2480,9 +2480,19 @@ pub const LibExeObjStep = struct {
try zig_args.append("--test-cmd");
try zig_args.append(bin_name);
if (glibc_dir_arg) |dir| {
- const full_dir = try fs.path.join(builder.allocator, &[_][]const u8{
- dir,
- try self.target.linuxTriple(builder.allocator),
+ // TODO look into making this a call to `linuxTriple`. This
+ // needs the directory to be called "i686" rather than
+ // "i386" which is why we do it manually here.
+ const fmt_str = "{s}" ++ fs.path.sep_str ++ "{s}-{s}-{s}";
+ const cpu_arch = self.target.getCpuArch();
+ const os_tag = self.target.getOsTag();
+ const abi = self.target.getAbi();
+ const cpu_arch_name: []const u8 = if (cpu_arch == .i386)
+ "i686"
+ else
+ @tagName(cpu_arch);
+ const full_dir = try std.fmt.allocPrint(builder.allocator, fmt_str, .{
+ dir, cpu_arch_name, @tagName(os_tag), @tagName(abi),
});
try zig_args.append("--test-cmd");