aboutsummaryrefslogtreecommitdiff
path: root/src/target.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-08-30 14:47:43 -0700
committerGitHub <noreply@github.com>2024-08-30 14:47:43 -0700
commite4e91a1314abd78a0f06df718459e42e3c9fb62a (patch)
tree0ea10dc19eb14e62fefc329e1ead6110e7c0d5bd /src/target.zig
parent5d08b7f0548c61b918504a7b02573127c49c6f97 (diff)
parenta2e691d589ac1d234ee624fdf8fa931d89a719b1 (diff)
downloadzig-e4e91a1314abd78a0f06df718459e42e3c9fb62a.tar.gz
zig-e4e91a1314abd78a0f06df718459e42e3c9fb62a.zip
Merge pull request #21224 from alexrp/mips-gnu-fixes
Fix MIPS PIC level and work around an LLVM bug for `mips(el)-linux-gnueabi(hf)`
Diffstat (limited to 'src/target.zig')
-rw-r--r--src/target.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/target.zig b/src/target.zig
index ba586dd7a0..9147347f93 100644
--- a/src/target.zig
+++ b/src/target.zig
@@ -49,6 +49,12 @@ pub fn requiresPIC(target: std.Target, linking_libc: bool) bool {
(target.abi == .ohos and target.cpu.arch == .aarch64);
}
+pub fn usesLargePIC(target: std.Target) bool {
+ // MIPS always uses PIC level 1; other platforms vary in their default PIC levels, but they
+ // support both level 1 and 2, in which case we prefer 2.
+ return !target.cpu.arch.isMIPS();
+}
+
/// This is not whether the target supports Position Independent Code, but whether the -fPIC
/// C compiler argument is valid to Clang.
pub fn supports_fpic(target: std.Target) bool {