aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2024-07-26 21:05:40 +0200
committerJakub Konka <kubkon@jakubkonka.com>2024-07-28 14:37:03 +0200
commit642cd730c8b588778d8c1d6953134408b30dfab3 (patch)
tree430fe8e39eb8ea0b7d3f3c07cde56c523f02f79b /src/Compilation.zig
parent91c17979f10db4fdc6639b176c0563718f060f47 (diff)
downloadzig-642cd730c8b588778d8c1d6953134408b30dfab3.tar.gz
zig-642cd730c8b588778d8c1d6953134408b30dfab3.zip
link: Accept `-Brepro` linker option and pass it to LLD.
Enable it by default when building Zig code in release modes. Contributes to #9432.
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index cd46c0fc50..e6ab42cbc2 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -1122,6 +1122,7 @@ pub const CreateOptions = struct {
linker_enable_new_dtags: ?bool = null,
soname: ?[]const u8 = null,
linker_gc_sections: ?bool = null,
+ linker_repro: ?bool = null,
linker_allow_shlib_undefined: ?bool = null,
linker_bind_global_refs_locally: ?bool = null,
linker_import_symbols: bool = false,
@@ -1602,6 +1603,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
.framework_dirs = options.framework_dirs,
.rpath_list = options.rpath_list,
.symbol_wrap_set = options.symbol_wrap_set,
+ .repro = options.linker_repro orelse (options.root_mod.optimize_mode != .Debug),
.allow_shlib_undefined = options.linker_allow_shlib_undefined,
.bind_global_refs_locally = options.linker_bind_global_refs_locally orelse false,
.compress_debug_sections = options.linker_compress_debug_sections orelse .none,
@@ -2560,7 +2562,7 @@ fn prepareWholeEmitSubPath(arena: Allocator, opt_emit: ?EmitLoc) error{OutOfMemo
/// to remind the programmer to update multiple related pieces of code that
/// are in different locations. Bump this number when adding or deleting
/// anything from the link cache manifest.
-pub const link_hash_implementation_version = 13;
+pub const link_hash_implementation_version = 14;
fn addNonIncrementalStuffToCacheManifest(
comp: *Compilation,
@@ -2569,7 +2571,7 @@ fn addNonIncrementalStuffToCacheManifest(
) !void {
const gpa = comp.gpa;
- comptime assert(link_hash_implementation_version == 13);
+ comptime assert(link_hash_implementation_version == 14);
if (comp.module) |mod| {
try addModuleTableToCacheHash(gpa, arena, &man.hash, mod.root_mod, mod.main_mod, .{ .files = man });
@@ -2660,6 +2662,7 @@ fn addNonIncrementalStuffToCacheManifest(
}
man.hash.addOptionalBytes(target.dynamic_linker.get());
}
+ man.hash.add(opts.repro);
man.hash.addOptional(opts.allow_shlib_undefined);
man.hash.add(opts.bind_global_refs_locally);