diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2025-02-16 06:29:08 +0100 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2025-02-22 06:35:19 +0100 |
| commit | f87b443af1f654d3363ce6a1081bdf7932ae354c (patch) | |
| tree | f4b242f4e9463026e1b53cab879fd21acbbb2e9a /src/link.zig | |
| parent | a7467b9bb2aa667a8d34bc8b678ce35fcb19ebd4 (diff) | |
| download | zig-f87b443af1f654d3363ce6a1081bdf7932ae354c.tar.gz zig-f87b443af1f654d3363ce6a1081bdf7932ae354c.zip | |
link.MachO: Add support for the -x flag (discard local symbols).
This can also be extended to ELF later as it means roughly the same thing there.
This addresses the main issue in #21721 but as I don't have a macOS machine to
do further testing on, I can't confirm whether zig cc is able to pass the entire
cgo test suite after this commit. It can, however, cross-compile a basic program
that uses cgo to x86_64-macos-none which previously failed due to lack of -x
support. Unlike previously, the resulting symbol table does not contain local
symbols (such as C static functions).
I believe this satisfies the related donor bounty: https://ziglang.org/news/second-donor-bounty
Diffstat (limited to 'src/link.zig')
| -rw-r--r-- | src/link.zig | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/link.zig b/src/link.zig index d805b331e3..99d7908be1 100644 --- a/src/link.zig +++ b/src/link.zig @@ -491,6 +491,8 @@ pub const File = struct { /// Force load all members of static archives that implement an /// Objective-C class or category force_load_objc: bool, + /// Whether local symbols should be discarded from the symbol table. + discard_local_symbols: bool, /// Windows-specific linker flags: /// PDB source path prefix to instruct the linker how to resolve relative |
