From 9bb643031864c8c3c2d4ac52aecb175283e335e3 Mon Sep 17 00:00:00 2001 From: dhash Date: Fri, 29 Sep 2023 13:38:54 -0400 Subject: Add support for `--(no-)undefined-version` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Motiejus Jakštys Co-authored-by: Jakub Konka Co-authored-by: Samuel Cantero Co-authored-by: Giorgos Georgiou Co-authored-by: Carl Åstholm --- src/Compilation.zig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/Compilation.zig') 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); -- cgit v1.2.3