mirror of
https://github.com/ziglang/zig.git
synced 2026-02-03 05:03:38 +00:00
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.
This commit is contained in:
parent
b754068fbc
commit
247b353609
@ -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");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user