aboutsummaryrefslogtreecommitdiff
path: root/src/link.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2020-11-05 11:29:58 +0100
committerJakub Konka <kubkon@jakubkonka.com>2020-11-05 18:35:51 +0100
commite0e3ceac19c0de0f8b3e408f9d3728496bc051f7 (patch)
tree676bca514c95c540837e42106cd8b9e9bb998531 /src/link.zig
parent17837affd22a6055c65a14252fa38610fdeabc3a (diff)
downloadzig-e0e3ceac19c0de0f8b3e408f9d3728496bc051f7.tar.gz
zig-e0e3ceac19c0de0f8b3e408f9d3728496bc051f7.zip
Re-enable system linker hack
It is now possible to force linking with system linker `ld` instead of the LLVM `lld` linker when building natively on the target. This can be done at each stage by specifying `--system-linker-hack` flag, and can be useful on platforms where `lld` fails to operate properly such as macOS 11 Big Sur on ARM64 where every binary/dylib is expected to be codesigned. Some example invocations for each stage of compilation of Zig toolchain: ``` cmake .. -DCMAKE_PREFIX_PATH=/path/to/llvm -DSYSTEM_LINKER_HACK=1 ``` ``` build/zig build test --system-linker-hack ``` ``` build/zig build --prefix $(pwd)/stage2 -Denable-llvm --system-linker-hack ``` ``` build/zig build-exe hello.zig --system-linker-hack ```
Diffstat (limited to 'src/link.zig')
-rw-r--r--src/link.zig3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/link.zig b/src/link.zig
index 02433ecde7..65074924d1 100644
--- a/src/link.zig
+++ b/src/link.zig
@@ -57,6 +57,9 @@ pub const Options = struct {
/// other objects.
/// Otherwise (depending on `use_lld`) this link code directly outputs and updates the final binary.
use_llvm: bool,
+ /// If this is true and `use_llvm` is true, this link code will use system linker `ld` instead of
+ /// the LLD.
+ system_linker_hack: bool,
link_libc: bool,
link_libcpp: bool,
function_sections: bool,