diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2024-08-28 03:02:04 +0200 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2024-08-28 06:18:06 +0200 |
| commit | 7d9edff11d4c0dd6793bfd4bb2d7e3c2d32c88cd (patch) | |
| tree | 82c547eab6f1cd93cef5905e88c14b0438cc5a12 /src/target.zig | |
| parent | 93cb44c80582dd02b63b02e7bb7e54d7ad8a4ebc (diff) | |
| download | zig-7d9edff11d4c0dd6793bfd4bb2d7e3c2d32c88cd.tar.gz zig-7d9edff11d4c0dd6793bfd4bb2d7e3c2d32c88cd.zip | |
llvm: Set PIC level 1 for MIPS.
For hysterical raisins, MIPS always uses 1, regardless of `-fpic` vs `-fPIC`.
Diffstat (limited to 'src/target.zig')
| -rw-r--r-- | src/target.zig | 6 |
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 { |
