aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorMotiejus Jakštys <motiejus@uber.com>2022-10-16 12:53:11 +0300
committerAndrew Kelley <andrew@ziglang.org>2022-10-18 12:55:31 -0400
commit5ec76cf5c84f3863618e220ce41d09cc9781af8a (patch)
tree97d6d6bce27ed26cf543c360a90b4b877df963d7 /src/main.zig
parent787788996fbefef565b5097456463467b6b3d8d6 (diff)
downloadzig-5ec76cf5c84f3863618e220ce41d09cc9781af8a.tar.gz
zig-5ec76cf5c84f3863618e220ce41d09cc9781af8a.zip
[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 (limited to 'src/main.zig')
-rw-r--r--src/main.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig
index e18acd9051..0f08109e9b 100644
--- 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,