| author | |
| committer | |
| log | 1d532f12b568c924baead9de78701f66a526e16b |
| tree | 648c562336582e2bb3c4c81a21db2876ca1a2679 |
| parent | 7b63f98cd7d86337e8157afc9600e1e17c27db80 |
Warnings about non-implemented `-z nocopyreloc` are common when
compiling go code (including Go's tests themselves). Let's just
make it stop complaining.7 files changed, 16 insertions(+), 6 deletions(-)
src/Compilation.zig+5-2| ... | @@ -764,6 +764,7 @@ pub const InitOptions = struct { | ... | @@ -764,6 +764,7 @@ pub const InitOptions = struct { |
| 764 | linker_z_noexecstack: bool = false, | 764 | linker_z_noexecstack: bool = false, |
| 765 | linker_z_now: bool = false, | 765 | linker_z_now: bool = false, |
| 766 | linker_z_relro: bool = false, | 766 | linker_z_relro: bool = false, |
| 767 | linker_z_nocopyreloc: bool = false, | ||
| 767 | linker_tsaware: bool = false, | 768 | linker_tsaware: bool = false, |
| 768 | linker_nxcompat: bool = false, | 769 | linker_nxcompat: bool = false, |
| 769 | linker_dynamicbase: bool = false, | 770 | linker_dynamicbase: bool = false, |
| ... | @@ -1597,6 +1598,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { | ... | @@ -1597,6 +1598,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { |
| 1597 | .z_notext = options.linker_z_notext, | 1598 | .z_notext = options.linker_z_notext, |
| 1598 | .z_defs = options.linker_z_defs, | 1599 | .z_defs = options.linker_z_defs, |
| 1599 | .z_origin = options.linker_z_origin, | 1600 | .z_origin = options.linker_z_origin, |
| 1601 | .z_nocopyreloc = options.linker_z_nocopyreloc, | ||
| 1600 | .z_noexecstack = options.linker_z_noexecstack, | 1602 | .z_noexecstack = options.linker_z_noexecstack, |
| 1601 | .z_now = options.linker_z_now, | 1603 | .z_now = options.linker_z_now, |
| 1602 | .z_relro = options.linker_z_relro, | 1604 | .z_relro = options.linker_z_relro, |
| ... | @@ -2255,7 +2257,7 @@ fn prepareWholeEmitSubPath(arena: Allocator, opt_emit: ?EmitLoc) error{OutOfMemo | ... | @@ -2255,7 +2257,7 @@ fn prepareWholeEmitSubPath(arena: Allocator, opt_emit: ?EmitLoc) error{OutOfMemo |
| 2255 | /// to remind the programmer to update multiple related pieces of code that | 2257 | /// to remind the programmer to update multiple related pieces of code that |
| 2256 | /// are in different locations. Bump this number when adding or deleting | 2258 | /// are in different locations. Bump this number when adding or deleting |
| 2257 | /// anything from the link cache manifest. | 2259 | /// anything from the link cache manifest. |
| 2258 | pub const link_hash_implementation_version = 2; | 2260 | pub const link_hash_implementation_version = 3; |
| 2259 | 2261 | ||
| 2260 | fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifest) !void { | 2262 | fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifest) !void { |
| 2261 | const gpa = comp.gpa; | 2263 | const gpa = comp.gpa; |
| ... | @@ -2265,7 +2267,7 @@ fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifes | ... | @@ -2265,7 +2267,7 @@ fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifes |
| 2265 | defer arena_allocator.deinit(); | 2267 | defer arena_allocator.deinit(); |
| 2266 | const arena = arena_allocator.allocator(); | 2268 | const arena = arena_allocator.allocator(); |
| 2267 | 2269 | ||
| 2268 | comptime assert(link_hash_implementation_version == 2); | 2270 | comptime assert(link_hash_implementation_version == 3); |
| 2269 | 2271 | ||
| 2270 | if (comp.bin_file.options.module) |mod| { | 2272 | if (comp.bin_file.options.module) |mod| { |
| 2271 | const main_zig_file = try mod.main_pkg.root_src_directory.join(arena, &[_][]const u8{ | 2273 | const main_zig_file = try mod.main_pkg.root_src_directory.join(arena, &[_][]const u8{ |
| ... | @@ -2333,6 +2335,7 @@ fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifes | ... | @@ -2333,6 +2335,7 @@ fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifes |
| 2333 | man.hash.add(comp.bin_file.options.z_notext); | 2335 | man.hash.add(comp.bin_file.options.z_notext); |
| 2334 | man.hash.add(comp.bin_file.options.z_defs); | 2336 | man.hash.add(comp.bin_file.options.z_defs); |
| 2335 | man.hash.add(comp.bin_file.options.z_origin); | 2337 | man.hash.add(comp.bin_file.options.z_origin); |
| 2338 | man.hash.add(comp.bin_file.options.z_nocopyreloc); | ||
| 2336 | man.hash.add(comp.bin_file.options.z_noexecstack); | 2339 | man.hash.add(comp.bin_file.options.z_noexecstack); |
| 2337 | man.hash.add(comp.bin_file.options.z_now); | 2340 | man.hash.add(comp.bin_file.options.z_now); |
| 2338 | man.hash.add(comp.bin_file.options.z_relro); | 2341 | man.hash.add(comp.bin_file.options.z_relro); |
src/link.zig+1| ... | @@ -112,6 +112,7 @@ pub const Options = struct { | ... | @@ -112,6 +112,7 @@ pub const Options = struct { |
| 112 | z_notext: bool, | 112 | z_notext: bool, |
| 113 | z_defs: bool, | 113 | z_defs: bool, |
| 114 | z_origin: bool, | 114 | z_origin: bool, |
| 115 | z_nocopyreloc: bool, | ||
| 115 | z_noexecstack: bool, | 116 | z_noexecstack: bool, |
| 116 | z_now: bool, | 117 | z_now: bool, |
| 117 | z_relro: bool, | 118 | z_relro: bool, |
src/link/Coff.zig+1-1| ... | @@ -969,7 +969,7 @@ fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Node) ! | ... | @@ -969,7 +969,7 @@ fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Node) ! |
| 969 | man = comp.cache_parent.obtain(); | 969 | man = comp.cache_parent.obtain(); |
| 970 | self.base.releaseLock(); | 970 | self.base.releaseLock(); |
| 971 | 971 | ||
| 972 | comptime assert(Compilation.link_hash_implementation_version == 2); | 972 | comptime assert(Compilation.link_hash_implementation_version == 3); |
| 973 | 973 | ||
| 974 | for (self.base.options.objects) |obj| { | 974 | for (self.base.options.objects) |obj| { |
| 975 | _ = try man.addFile(obj.path, null); | 975 | _ = try man.addFile(obj.path, null); |
src/link/Elf.zig+6-1| ... | @@ -1294,7 +1294,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v | ... | @@ -1294,7 +1294,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v |
| 1294 | // We are about to obtain this lock, so here we give other processes a chance first. | 1294 | // We are about to obtain this lock, so here we give other processes a chance first. |
| 1295 | self.base.releaseLock(); | 1295 | self.base.releaseLock(); |
| 1296 | 1296 | ||
| 1297 | comptime assert(Compilation.link_hash_implementation_version == 2); | 1297 | comptime assert(Compilation.link_hash_implementation_version == 3); |
| 1298 | 1298 | ||
| 1299 | try man.addOptionalFile(self.base.options.linker_script); | 1299 | try man.addOptionalFile(self.base.options.linker_script); |
| 1300 | try man.addOptionalFile(self.base.options.version_script); | 1300 | try man.addOptionalFile(self.base.options.version_script); |
| ... | @@ -1325,6 +1325,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v | ... | @@ -1325,6 +1325,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v |
| 1325 | man.hash.add(self.base.options.z_notext); | 1325 | man.hash.add(self.base.options.z_notext); |
| 1326 | man.hash.add(self.base.options.z_defs); | 1326 | man.hash.add(self.base.options.z_defs); |
| 1327 | man.hash.add(self.base.options.z_origin); | 1327 | man.hash.add(self.base.options.z_origin); |
| 1328 | man.hash.add(self.base.options.z_nocopyreloc); | ||
| 1328 | man.hash.add(self.base.options.z_noexecstack); | 1329 | man.hash.add(self.base.options.z_noexecstack); |
| 1329 | man.hash.add(self.base.options.z_now); | 1330 | man.hash.add(self.base.options.z_now); |
| 1330 | man.hash.add(self.base.options.z_relro); | 1331 | man.hash.add(self.base.options.z_relro); |
| ... | @@ -1496,6 +1497,10 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v | ... | @@ -1496,6 +1497,10 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v |
| 1496 | try argv.append("-z"); | 1497 | try argv.append("-z"); |
| 1497 | try argv.append("origin"); | 1498 | try argv.append("origin"); |
| 1498 | } | 1499 | } |
| 1500 | if (self.base.options.z_nocopyreloc) { | ||
| 1501 | try argv.append("-z"); | ||
| 1502 | try argv.append("nocopyreloc"); | ||
| 1503 | } | ||
| 1499 | if (self.base.options.z_noexecstack) { | 1504 | if (self.base.options.z_noexecstack) { |
| 1500 | try argv.append("-z"); | 1505 | try argv.append("-z"); |
| 1501 | try argv.append("noexecstack"); | 1506 | try argv.append("noexecstack"); |
src/link/MachO.zig+1-1| ... | @@ -527,7 +527,7 @@ pub fn flushModule(self: *MachO, comp: *Compilation, prog_node: *std.Progress.No | ... | @@ -527,7 +527,7 @@ pub fn flushModule(self: *MachO, comp: *Compilation, prog_node: *std.Progress.No |
| 527 | // We are about to obtain this lock, so here we give other processes a chance first. | 527 | // We are about to obtain this lock, so here we give other processes a chance first. |
| 528 | self.base.releaseLock(); | 528 | self.base.releaseLock(); |
| 529 | 529 | ||
| 530 | comptime assert(Compilation.link_hash_implementation_version == 2); | 530 | comptime assert(Compilation.link_hash_implementation_version == 3); |
| 531 | 531 | ||
| 532 | for (self.base.options.objects) |obj| { | 532 | for (self.base.options.objects) |obj| { |
| 533 | _ = try man.addFile(obj.path, null); | 533 | _ = try man.addFile(obj.path, null); |
src/link/Wasm.zig+1-1| ... | @@ -2274,7 +2274,7 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) ! | ... | @@ -2274,7 +2274,7 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) ! |
| 2274 | // We are about to obtain this lock, so here we give other processes a chance first. | 2274 | // We are about to obtain this lock, so here we give other processes a chance first. |
| 2275 | self.base.releaseLock(); | 2275 | self.base.releaseLock(); |
| 2276 | 2276 | ||
| 2277 | comptime assert(Compilation.link_hash_implementation_version == 2); | 2277 | comptime assert(Compilation.link_hash_implementation_version == 3); |
| 2278 | 2278 | ||
| 2279 | for (self.base.options.objects) |obj| { | 2279 | for (self.base.options.objects) |obj| { |
| 2280 | _ = try man.addFile(obj.path, null); | 2280 | _ = try man.addFile(obj.path, null); |
src/main.zig+1| ... | @@ -430,6 +430,7 @@ const usage_build_generic = | ... | @@ -430,6 +430,7 @@ const usage_build_generic = |
| 430 | \\ notext Permit read-only relocations in read-only segments | 430 | \\ notext Permit read-only relocations in read-only segments |
| 431 | \\ defs Force a fatal error if any undefined symbols remain | 431 | \\ defs Force a fatal error if any undefined symbols remain |
| 432 | \\ origin Indicate that the object must have its origin processed | 432 | \\ origin Indicate that the object must have its origin processed |
| 433 | \\ nocopyreloc Disable the creation of copy relocations | ||
| 433 | \\ noexecstack Indicate that the object requires an executable stack | 434 | \\ noexecstack Indicate that the object requires an executable stack |
| 434 | \\ now Force all relocations to be processed on load | 435 | \\ now Force all relocations to be processed on load |
| 435 | \\ relro Force all relocations to be resolved and be read-only on load | 436 | \\ relro Force all relocations to be resolved and be read-only on load |