aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authordhash <me@dha.sh>2023-09-29 13:38:54 -0400
committerCarl Åstholm <carl@astholm.se>2024-01-09 17:24:11 +0100
commit9bb643031864c8c3c2d4ac52aecb175283e335e3 (patch)
tree20e8fa8787aa7e29e9771edff9d20f8a404ea70b /src/Compilation.zig
parent60094cc3fc979df0928c412c9fded457172f2060 (diff)
downloadzig-9bb643031864c8c3c2d4ac52aecb175283e335e3.tar.gz
zig-9bb643031864c8c3c2d4ac52aecb175283e335e3.zip
Add support for `--(no-)undefined-version`
Co-authored-by: Motiejus Jakštys <motiejus@jakstys.lt> Co-authored-by: Jakub Konka <kubkon@jakubkonka.com> Co-authored-by: Samuel Cantero <scanterog@gmail.com> Co-authored-by: Giorgos Georgiou <giorgos.georgiou@datadoghq.com> Co-authored-by: Carl Åstholm <carl@astholm.se>
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 ccd64ca9b3..9dd45d8ced 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -1033,6 +1033,7 @@ pub const CreateOptions = struct {
link_emit_relocs: bool = false,
linker_script: ?[]const u8 = null,
version_script: ?[]const u8 = null,
+ linker_allow_undefined_version: bool = false,
soname: ?[]const u8 = null,
linker_gc_sections: ?bool = null,
linker_allow_shlib_undefined: ?bool = null,
@@ -1572,6 +1573,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
.stack_size = options.stack_size,
.image_base = options.image_base,
.version_script = options.version_script,
+ .allow_undefined_version = options.linker_allow_undefined_version,
.gc_sections = options.linker_gc_sections,
.emit_relocs = options.link_emit_relocs,
.soname = options.soname,
@@ -2458,7 +2460,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 = 10;
+pub const link_hash_implementation_version = 11;
fn addNonIncrementalStuffToCacheManifest(
comp: *Compilation,
@@ -2467,7 +2469,7 @@ fn addNonIncrementalStuffToCacheManifest(
) !void {
const gpa = comp.gpa;
- comptime assert(link_hash_implementation_version == 10);
+ comptime assert(link_hash_implementation_version == 11);
if (comp.module) |mod| {
const main_zig_file = try mod.main_mod.root.joinString(arena, mod.main_mod.root_src_path);
@@ -2541,6 +2543,7 @@ fn addNonIncrementalStuffToCacheManifest(
try man.addOptionalFile(opts.linker_script);
try man.addOptionalFile(opts.version_script);
+ man.hash.add(opts.allow_undefined_version);
man.hash.addOptional(opts.stack_size);
man.hash.addOptional(opts.image_base);