authorgravatar for motiejus@jakstys.ltMotiejus Jakštys <motiejus@jakstys.lt> 2022-10-16 12:53:11+03:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-10-18 12:55:31-04:00
log5ec76cf5c84f3863618e220ce41d09cc9781af8a
tree97d6d6bce27ed26cf543c360a90b4b877df963d7
parent787788996fbefef565b5097456463467b6b3d8d6

[elf] main.zig: add -z nocopyreloc

I did not fully wire it up in main.zig when I originally implemented `-z nocopyreloc` in #11679 (440f5249f1a). Finish it. If we strictly follow the rules, we should bump the cache has version, since the field was technically added only now. But since nobody complained thus far, I don't think many users care that much about it and we can omit it.

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

src/main.zig+6
......@@ -696,6 +696,7 @@ fn buildOutputType(
696696 var linker_print_gc_sections: bool = false;
697697 var linker_print_icf_sections: bool = false;
698698 var linker_print_map: bool = false;
699 var linker_z_nocopyreloc = false;
699700 var linker_z_nodelete = false;
700701 var linker_z_notext = false;
701702 var linker_z_defs = false;
......@@ -1262,6 +1263,8 @@ fn buildOutputType(
12621263 linker_z_defs = true;
12631264 } else if (mem.eql(u8, z_arg, "origin")) {
12641265 linker_z_origin = true;
1266 } else if (mem.eql(u8, z_arg, "nocopyreloc")) {
1267 linker_z_nocopyreloc = true;
12651268 } else if (mem.eql(u8, z_arg, "now")) {
12661269 linker_z_now = true;
12671270 } else if (mem.eql(u8, z_arg, "lazy")) {
......@@ -1825,6 +1828,8 @@ fn buildOutputType(
18251828 linker_z_defs = true;
18261829 } else if (mem.eql(u8, z_arg, "origin")) {
18271830 linker_z_origin = true;
1831 } else if (mem.eql(u8, z_arg, "nocopyreloc")) {
1832 linker_z_nocopyreloc = true;
18281833 } else if (mem.eql(u8, z_arg, "noexecstack")) {
18291834 // noexecstack is the default when linking with LLD
18301835 } else if (mem.eql(u8, z_arg, "now")) {
......@@ -2894,6 +2899,7 @@ fn buildOutputType(
28942899 .linker_print_map = linker_print_map,
28952900 .linker_global_base = linker_global_base,
28962901 .linker_export_symbol_names = linker_export_symbol_names.items,
2902 .linker_z_nocopyreloc = linker_z_nocopyreloc,
28972903 .linker_z_nodelete = linker_z_nodelete,
28982904 .linker_z_notext = linker_z_notext,
28992905 .linker_z_defs = linker_z_defs,