diff options
| author | dhash <me@dha.sh> | 2023-09-29 13:38:54 -0400 |
|---|---|---|
| committer | Carl Åstholm <carl@astholm.se> | 2024-01-09 17:24:11 +0100 |
| commit | 9bb643031864c8c3c2d4ac52aecb175283e335e3 (patch) | |
| tree | 20e8fa8787aa7e29e9771edff9d20f8a404ea70b /src/link/Elf.zig | |
| parent | 60094cc3fc979df0928c412c9fded457172f2060 (diff) | |
| download | zig-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/link/Elf.zig')
| -rw-r--r-- | src/link/Elf.zig | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/link/Elf.zig b/src/link/Elf.zig index 2f1d5703f9..ef06c8e1dd 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -22,6 +22,7 @@ soname: ?[]const u8, bind_global_refs_locally: bool, linker_script: ?[]const u8, version_script: ?[]const u8, +allow_undefined_version: bool, print_icf_sections: bool, print_map: bool, entry_name: ?[]const u8, @@ -325,6 +326,7 @@ pub fn createEmpty( .bind_global_refs_locally = options.bind_global_refs_locally, .linker_script = options.linker_script, .version_script = options.version_script, + .allow_undefined_version = options.allow_undefined_version, .print_icf_sections = options.print_icf_sections, .print_map = options.print_map, }; @@ -2410,10 +2412,11 @@ fn linkWithLLD(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node) !voi // We are about to obtain this lock, so here we give other processes a chance first. self.base.releaseLock(); - comptime assert(Compilation.link_hash_implementation_version == 10); + comptime assert(Compilation.link_hash_implementation_version == 11); try man.addOptionalFile(self.linker_script); try man.addOptionalFile(self.version_script); + man.hash.add(self.allow_undefined_version); for (comp.objects) |obj| { _ = try man.addFile(obj.path, null); man.hash.add(obj.must_link); @@ -2789,6 +2792,11 @@ fn linkWithLLD(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node) !voi try argv.append("-version-script"); try argv.append(version_script); } + if (self.allow_undefined_version) { + try argv.append("--undefined-version"); + } else { + try argv.append("--no-undefined-version"); + } } // Positional arguments to the linker such as object files. |
