diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2023-04-01 11:51:05 +0200 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2023-04-01 14:22:44 +0200 |
| commit | a88c0b4d089d286e36351cf476c8d982fb730541 (patch) | |
| tree | a4d985e8a6bd7f7b36b66f24e21e1ff53ff5303a /src/link.zig | |
| parent | 2dd178443abcbd91a923c64a4fd066caef974a82 (diff) | |
| download | zig-a88c0b4d089d286e36351cf476c8d982fb730541.tar.gz zig-a88c0b4d089d286e36351cf476c8d982fb730541.zip | |
link: handle -u flag in all linkers
Also clean up parsing of linker args - reuse `ArgsIterator`.
In MachO, ensure we add every symbol marked with `-u` as undefined
before proceeding with symbol resolution. Additionally, ensure those
symbols are never garbage collected.
MachO entry_in_dylib test: pass `-u _my_main` when linking executable
so that it is not incorrectly garbage collected by the linker.
Diffstat (limited to 'src/link.zig')
| -rw-r--r-- | src/link.zig | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/link.zig b/src/link.zig index dc114eb0ad..05519ba6b5 100644 --- a/src/link.zig +++ b/src/link.zig @@ -186,8 +186,7 @@ pub const Options = struct { /// List of symbols forced as undefined in the symbol table /// thus forcing their resolution by the linker. - /// Corresponds to `-u <symbol>` for ELF and `/include:<symbol>` for COFF/PE. - /// TODO add handling for MachO. + /// Corresponds to `-u <symbol>` for ELF/MachO and `/include:<symbol>` for COFF/PE. force_undefined_symbols: std.StringArrayHashMapUnmanaged(void), version: ?std.builtin.Version, |
