authorgravatar for motiejus@jakstys.ltMotiejus Jakštys <motiejus@jakstys.lt> 2022-06-23 06:41:30+03:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-02-16 16:33:05-07:00
log4c7ca20da56d86636dfcc35a6982ad10b147cece
tree79d9593c4c67712ca5127e8b158dada78d8eada0
parent438b71155a6e86263c61a664a1af596fe9b210bd

[linker] add --no-undefined, -z undefs

Refs https://github.com/zigchroot/zig-chroot/issues/1

1 files changed, 8 insertions(+), 0 deletions(-)

src/main.zig+8
......@@ -488,10 +488,12 @@ const usage_build_generic =
488488 \\ -fno-build-id (default) Saves a bit of time linking
489489 \\ --eh-frame-hdr Enable C++ exception handling by passing --eh-frame-hdr to linker
490490 \\ --emit-relocs Enable output of relocation sections for post build tools
491 \\ --no-undefined Alias of -z defs
491492 \\ -z [arg] Set linker extension flags
492493 \\ nodelete Indicate that the object cannot be deleted from a process
493494 \\ notext Permit read-only relocations in read-only segments
494495 \\ defs Force a fatal error if any undefined symbols remain
496 \\ undefs Reverse of -z defs
495497 \\ origin Indicate that the object must have its origin processed
496498 \\ nocopyreloc Disable the creation of copy relocations
497499 \\ now (default) Force all relocations to be processed on load
......@@ -1333,6 +1335,8 @@ fn buildOutputType(
13331335 linker_z_notext = true;
13341336 } else if (mem.eql(u8, z_arg, "defs")) {
13351337 linker_z_defs = true;
1338 } else if (mem.eql(u8, z_arg, "undefs")) {
1339 linker_z_defs = false;
13361340 } else if (mem.eql(u8, z_arg, "origin")) {
13371341 linker_z_origin = true;
13381342 } else if (mem.eql(u8, z_arg, "nocopyreloc")) {
......@@ -1879,6 +1883,8 @@ fn buildOutputType(
18791883 linker_gc_sections = true;
18801884 } else if (mem.eql(u8, arg, "-dead_strip_dylibs")) {
18811885 dead_strip_dylibs = true;
1886 } else if (mem.eql(u8, arg, "--no-undefined")) {
1887 linker_z_defs = true;
18821888 } else if (mem.eql(u8, arg, "--gc-sections")) {
18831889 linker_gc_sections = true;
18841890 } else if (mem.eql(u8, arg, "--no-gc-sections")) {
......@@ -1944,6 +1950,8 @@ fn buildOutputType(
19441950 linker_z_notext = true;
19451951 } else if (mem.eql(u8, z_arg, "defs")) {
19461952 linker_z_defs = true;
1953 } else if (mem.eql(u8, z_arg, "undefs")) {
1954 linker_z_defs = false;
19471955 } else if (mem.eql(u8, z_arg, "origin")) {
19481956 linker_z_origin = true;
19491957 } else if (mem.eql(u8, z_arg, "nocopyreloc")) {