netbsd: add args to limit number of PT_LOAD segs
NetBSD expects 2 PT_LOAD segments in a shared object, otherwise ld.elf_so fails to load, emitting a general "not found" error. Workaround issue by adding args `--no-rosegment` and `-znorelro`. see #9109
This commit is contained in:
committed by
Andrew Kelley
parent
8be29674a9
commit
162b92c93e
@@ -1496,6 +1496,15 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
|
||||
try argv.append("-pie");
|
||||
}
|
||||
|
||||
if (self.base.options.link_mode == .Dynamic 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.
|
||||
// See https://github.com/ziglang/zig/issues/9109 .
|
||||
try argv.append("--no-rosegment");
|
||||
try argv.append("-znorelro");
|
||||
}
|
||||
|
||||
try argv.append("-o");
|
||||
try argv.append(full_out_path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user