diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2022-06-27 09:24:18 +0200 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2022-06-27 19:53:38 +0200 |
| commit | efc5c97bff87d4c28ae9642fe69d9bc2c7e9eeb7 (patch) | |
| tree | 12b31bae7ed111c1f62541c7d46f20ad6d222717 /src/Compilation.zig | |
| parent | a76775b50a65fd0ea0fd17d6ef3c42058df13997 (diff) | |
| download | zig-efc5c97bff87d4c28ae9642fe69d9bc2c7e9eeb7.tar.gz zig-efc5c97bff87d4c28ae9642fe69d9bc2c7e9eeb7.zip | |
macho: implement -dead_strip_dylibs linker flag
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index 652938d741..fffa777f22 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -911,6 +911,8 @@ pub const InitOptions = struct { headerpad_size: ?u32 = null, /// (Darwin) set enough space as if all paths were MATPATHLEN headerpad_max_install_names: bool = false, + /// (Darwin) remove dylibs that are unreachable by the entry point or exported symbols + dead_strip_dylibs: bool = false, }; fn addPackageTableToCacheHash( @@ -1754,6 +1756,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { .search_strategy = options.search_strategy, .headerpad_size = options.headerpad_size, .headerpad_max_install_names = options.headerpad_max_install_names, + .dead_strip_dylibs = options.dead_strip_dylibs, }); errdefer bin_file.destroy(); comp.* = .{ @@ -2369,7 +2372,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 = 6; +pub const link_hash_implementation_version = 7; fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifest) !void { const gpa = comp.gpa; @@ -2379,7 +2382,7 @@ fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifes defer arena_allocator.deinit(); const arena = arena_allocator.allocator(); - comptime assert(link_hash_implementation_version == 6); + comptime assert(link_hash_implementation_version == 7); if (comp.bin_file.options.module) |mod| { const main_zig_file = try mod.main_pkg.root_src_directory.join(arena, &[_][]const u8{ @@ -2488,6 +2491,7 @@ fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifes man.hash.addOptional(comp.bin_file.options.search_strategy); man.hash.addOptional(comp.bin_file.options.headerpad_size); man.hash.add(comp.bin_file.options.headerpad_max_install_names); + man.hash.add(comp.bin_file.options.dead_strip_dylibs); // COFF specific stuff man.hash.addOptional(comp.bin_file.options.subsystem); |
