[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.
This commit is contained in:
Motiejus Jakštys 2022-10-16 12:53:11 +03:00 committed by Andrew Kelley
parent 787788996f
commit 5ec76cf5c8

View File

@ -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,