authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-02-16 18:36:57-05:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-02-16 18:36:57-05:00
logf911c933b287bd9f27b6b5f977a671aef05ca6c9
tree9aa4295a424cac5c3509fb351c63e3a51e3c8ffb
parent438b71155a6e86263c61a664a1af596fe9b210bd
parent61da9a25b97289f0b1820ae2eae60066a7a871d8
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #11912 from motiejus/wl-no-undefined

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

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

src/main.zig+7
...@@ -492,6 +492,7 @@ const usage_build_generic =...@@ -492,6 +492,7 @@ const usage_build_generic =
492 \\ nodelete Indicate that the object cannot be deleted from a process492 \\ nodelete Indicate that the object cannot be deleted from a process
493 \\ notext Permit read-only relocations in read-only segments493 \\ notext Permit read-only relocations in read-only segments
494 \\ defs Force a fatal error if any undefined symbols remain494 \\ defs Force a fatal error if any undefined symbols remain
495 \\ undefs Reverse of -z defs
495 \\ origin Indicate that the object must have its origin processed496 \\ origin Indicate that the object must have its origin processed
496 \\ nocopyreloc Disable the creation of copy relocations497 \\ nocopyreloc Disable the creation of copy relocations
497 \\ now (default) Force all relocations to be processed on load498 \\ now (default) Force all relocations to be processed on load
...@@ -1333,6 +1334,8 @@ fn buildOutputType(...@@ -1333,6 +1334,8 @@ fn buildOutputType(
1333 linker_z_notext = true;1334 linker_z_notext = true;
1334 } else if (mem.eql(u8, z_arg, "defs")) {1335 } else if (mem.eql(u8, z_arg, "defs")) {
1335 linker_z_defs = true;1336 linker_z_defs = true;
1337 } else if (mem.eql(u8, z_arg, "undefs")) {
1338 linker_z_defs = false;
1336 } else if (mem.eql(u8, z_arg, "origin")) {1339 } else if (mem.eql(u8, z_arg, "origin")) {
1337 linker_z_origin = true;1340 linker_z_origin = true;
1338 } else if (mem.eql(u8, z_arg, "nocopyreloc")) {1341 } else if (mem.eql(u8, z_arg, "nocopyreloc")) {
...@@ -1879,6 +1882,8 @@ fn buildOutputType(...@@ -1879,6 +1882,8 @@ fn buildOutputType(
1879 linker_gc_sections = true;1882 linker_gc_sections = true;
1880 } else if (mem.eql(u8, arg, "-dead_strip_dylibs")) {1883 } else if (mem.eql(u8, arg, "-dead_strip_dylibs")) {
1881 dead_strip_dylibs = true;1884 dead_strip_dylibs = true;
1885 } else if (mem.eql(u8, arg, "--no-undefined")) {
1886 linker_z_defs = true;
1882 } else if (mem.eql(u8, arg, "--gc-sections")) {1887 } else if (mem.eql(u8, arg, "--gc-sections")) {
1883 linker_gc_sections = true;1888 linker_gc_sections = true;
1884 } else if (mem.eql(u8, arg, "--no-gc-sections")) {1889 } else if (mem.eql(u8, arg, "--no-gc-sections")) {
...@@ -1944,6 +1949,8 @@ fn buildOutputType(...@@ -1944,6 +1949,8 @@ fn buildOutputType(
1944 linker_z_notext = true;1949 linker_z_notext = true;
1945 } else if (mem.eql(u8, z_arg, "defs")) {1950 } else if (mem.eql(u8, z_arg, "defs")) {
1946 linker_z_defs = true;1951 linker_z_defs = true;
1952 } else if (mem.eql(u8, z_arg, "undefs")) {
1953 linker_z_defs = false;
1947 } else if (mem.eql(u8, z_arg, "origin")) {1954 } else if (mem.eql(u8, z_arg, "origin")) {
1948 linker_z_origin = true;1955 linker_z_origin = true;
1949 } else if (mem.eql(u8, z_arg, "nocopyreloc")) {1956 } else if (mem.eql(u8, z_arg, "nocopyreloc")) {