aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2021-03-08 09:49:16 +0100
committerAndrew Kelley <andrew@ziglang.org>2021-03-09 18:20:34 -0500
commitf2b96782ecdc9e2f8740eb7d294203b2a585ea52 (patch)
tree743585e5917b7e5829a9019a681f84d3d122d265
parent1a5d0cea15963437af68bbb7a50354a378cf4efd (diff)
downloadzig-f2b96782ecdc9e2f8740eb7d294203b2a585ea52.tar.gz
zig-f2b96782ecdc9e2f8740eb7d294203b2a585ea52.zip
stage2: Fix glibc lookup path for MIPS crt files
Add some more rules to let the compiler find the correct startup files for the selected target and ABI.
-rw-r--r--src/glibc.zig15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/glibc.zig b/src/glibc.zig
index b154bd530d..1acf57e267 100644
--- a/src/glibc.zig
+++ b/src/glibc.zig
@@ -453,7 +453,20 @@ fn start_asm_path(comp: *Compilation, arena: *Allocator, basename: []const u8) !
} else if (arch.isARM()) {
try result.appendSlice("arm");
} else if (arch.isMIPS()) {
- try result.appendSlice("mips");
+ if (!mem.eql(u8, basename, "crti.S") and !mem.eql(u8, basename, "crtn.S")) {
+ try result.appendSlice("mips");
+ } else {
+ if (is_64) {
+ const abi_dir = if (comp.getTarget().abi == .gnuabin32)
+ "n32"
+ else
+ "n64";
+ try result.appendSlice("mips" ++ s ++ "mips64" ++ s);
+ try result.appendSlice(abi_dir);
+ } else {
+ try result.appendSlice("mips" ++ s ++ "mips32");
+ }
+ }
} else if (arch == .x86_64) {
try result.appendSlice("x86_64");
} else if (arch == .i386) {