Skip to content

Commit 5ec76cf

Browse files
motiejusandrewrk
authored andcommitted
[elf] main.zig: add -z nocopyreloc
I did not fully wire it up in main.zig when I originally implemented `-z nocopyreloc` in #11679 (440f524). 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 parent 7877889 commit 5ec76cf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main.zig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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,

0 commit comments

Comments
 (0)