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/main.zig | |
| parent | a76775b50a65fd0ea0fd17d6ef3c42058df13997 (diff) | |
| download | zig-efc5c97bff87d4c28ae9642fe69d9bc2c7e9eeb7.tar.gz zig-efc5c97bff87d4c28ae9642fe69d9bc2c7e9eeb7.zip | |
macho: implement -dead_strip_dylibs linker flag
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig index d63e235360..8f9d3e5a13 100644 --- a/src/main.zig +++ b/src/main.zig @@ -452,6 +452,7 @@ const usage_build_generic = \\ -search_dylibs_first (Darwin) search `libx.dylib` in each dir in library search paths, then `libx.a` \\ -headerpad [value] (Darwin) set minimum space for future expansion of the load commands in hexadecimal notation \\ -headerpad_max_install_names (Darwin) set enough space as if all paths were MAXPATHLEN + \\ -dead_strip_dylibs (Darwin) remove dylibs that are unreachable by the entry point or exported symbols \\ --import-memory (WebAssembly) import memory from the environment \\ --import-table (WebAssembly) import function table from the host environment \\ --export-table (WebAssembly) export function table to the host environment @@ -703,6 +704,7 @@ fn buildOutputType( var search_strategy: ?link.File.MachO.SearchStrategy = null; var headerpad_size: ?u32 = null; var headerpad_max_install_names: bool = false; + var dead_strip_dylibs: bool = false; // e.g. -m3dnow or -mno-outline-atomics. They correspond to std.Target llvm cpu feature names. // This array is populated by zig cc frontend and then has to be converted to zig-style @@ -937,6 +939,8 @@ fn buildOutputType( }; } else if (mem.eql(u8, arg, "-headerpad_max_install_names")) { headerpad_max_install_names = true; + } else if (mem.eql(u8, arg, "-dead_strip_dylibs")) { + dead_strip_dylibs = true; } else if (mem.eql(u8, arg, "-T") or mem.eql(u8, arg, "--script")) { linker_script = args_iter.next() orelse { fatal("expected parameter after {s}", .{arg}); @@ -1700,6 +1704,8 @@ fn buildOutputType( }; } else if (mem.eql(u8, arg, "-headerpad_max_install_names")) { headerpad_max_install_names = true; + } else if (mem.eql(u8, arg, "-dead_strip_dylibs")) { + dead_strip_dylibs = true; } else if (mem.eql(u8, arg, "--gc-sections")) { linker_gc_sections = true; } else if (mem.eql(u8, arg, "--no-gc-sections")) { @@ -2821,6 +2827,7 @@ fn buildOutputType( .search_strategy = search_strategy, .headerpad_size = headerpad_size, .headerpad_max_install_names = headerpad_max_install_names, + .dead_strip_dylibs = dead_strip_dylibs, }) catch |err| switch (err) { error.LibCUnavailable => { const target = target_info.target; |
