zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 5ec76cf5c84f3863618e220ce41d09cc9781af8a (tree)
parent 787788996fbefef565b5097456463467b6b3d8d6
Author: Motiejus Jakštys <motiejus@uber.com>
Date:   Sun, 16 Oct 2022 12:53:11 +0300

[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.

Diffstat:
Msrc/main.zig | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/main.zig b/src/main.zig @@ -696,6 +696,7 @@ fn buildOutputType( var linker_print_gc_sections: bool = false; var linker_print_icf_sections: bool = false; var linker_print_map: bool = false; + var linker_z_nocopyreloc = false; var linker_z_nodelete = false; var linker_z_notext = false; var linker_z_defs = false; @@ -1262,6 +1263,8 @@ fn buildOutputType( linker_z_defs = true; } else if (mem.eql(u8, z_arg, "origin")) { linker_z_origin = true; + } else if (mem.eql(u8, z_arg, "nocopyreloc")) { + linker_z_nocopyreloc = true; } else if (mem.eql(u8, z_arg, "now")) { linker_z_now = true; } else if (mem.eql(u8, z_arg, "lazy")) { @@ -1825,6 +1828,8 @@ fn buildOutputType( linker_z_defs = true; } else if (mem.eql(u8, z_arg, "origin")) { linker_z_origin = true; + } else if (mem.eql(u8, z_arg, "nocopyreloc")) { + linker_z_nocopyreloc = true; } else if (mem.eql(u8, z_arg, "noexecstack")) { // noexecstack is the default when linking with LLD } else if (mem.eql(u8, z_arg, "now")) { @@ -2894,6 +2899,7 @@ fn buildOutputType( .linker_print_map = linker_print_map, .linker_global_base = linker_global_base, .linker_export_symbol_names = linker_export_symbol_names.items, + .linker_z_nocopyreloc = linker_z_nocopyreloc, .linker_z_nodelete = linker_z_nodelete, .linker_z_notext = linker_z_notext, .linker_z_defs = linker_z_defs,