diff options
| author | Michael Dusan <michael.dusan@gmail.com> | 2023-04-29 13:14:49 -0400 |
|---|---|---|
| committer | Michael Dusan <michael.dusan@gmail.com> | 2023-05-16 16:45:10 -0400 |
| commit | 247b35360900367c3678f2d8a6dd0d0693f17072 (patch) | |
| tree | ecf701d4c4ab701b5fdbd26b23c636899e060433 /src | |
| parent | b754068fbc7492962953068d31386d4c04e37ae5 (diff) | |
| download | zig-247b35360900367c3678f2d8a6dd0d0693f17072.tar.gz zig-247b35360900367c3678f2d8a6dd0d0693f17072.zip | |
netbsd: restrict PT_LOAD workaround to dlibs only
NetBSD supports executables with > 2 PT_LOAD segments but dynamic
libraries continue to expect exactly 2 PT_LOAD segments.
Diffstat (limited to 'src')
| -rw-r--r-- | src/link/Elf.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/link/Elf.zig b/src/link/Elf.zig index 724ec76500..2e3c2f637e 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -1654,10 +1654,10 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v try argv.append("-pie"); } - if (self.base.options.link_mode == .Dynamic and target.os.tag == .netbsd) { + if (is_dyn_lib and target.os.tag == .netbsd) { // Add options to produce shared objects with only 2 PT_LOAD segments. // NetBSD expects 2 PT_LOAD segments in a shared object, otherwise - // ld.elf_so fails to load, emitting a general "not found" error. + // ld.elf_so fails loading dynamic libraries with "not found" error. // See https://github.com/ziglang/zig/issues/9109 . try argv.append("--no-rosegment"); try argv.append("-znorelro"); |
