| author | |
| committer | |
| log | 701cae9d6b54f180fb2e2d62e55a0d890af8b182 |
| tree | 69239436dc2a8cdef4cf40b2bafe019917142d37 |
| parent | 199d0b90294af4fbec6890b2675c3272da0be1cc |
| signature | Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM |
This allows linking statically against native libc with -fno-PIC.2 files changed, 3 insertions(+), 5 deletions(-)
src/Module.zig+1-1| ... | ... | @@ -174,7 +174,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Module { |
| 174 | 174 | }; |
| 175 | 175 | |
| 176 | 176 | const pic = b: { |
| 177 | if (target_util.requiresPic(target, options.global.link_libc)) { | |
| 177 | if (target_util.requiresPic(target)) { | |
| 178 | 178 | if (options.inherited.pic == false) |
| 179 | 179 | return error.TargetRequiresPic; |
| 180 | 180 | break :b true; |
src/target.zig+2-4| ... | ... | @@ -72,10 +72,8 @@ pub fn requiresPie(target: *const std.Target, link_mode: std.lang.LinkMode) bool |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /// This function returns whether non-pic code is completely invalid on the given target. |
| 75 | pub fn requiresPic(target: *const std.Target, linking_libc: bool) bool { | |
| 76 | return ((target.os.tag == .windows or target.os.tag == .uefi) and (target.cpu.arch == .aarch64 or target.cpu.arch == .x86_64)) or | |
| 77 | target.requiresLibC() or | |
| 78 | (linking_libc and target.isGnuLibC()); | |
| 75 | pub fn requiresPic(target: *const std.Target) bool { | |
| 76 | return (target.os.tag == .windows or target.os.tag == .uefi) and (target.cpu.arch == .aarch64 or target.cpu.arch == .x86_64); | |
| 79 | 77 | } |
| 80 | 78 | |
| 81 | 79 | pub fn requiresPicForDynamicLink(target: *const std.Target) bool { |