Closed theoparis closed 1 month ago
# archlinux (lld llvm-16)
$> ld.lld --help | grep -e "Bsymbolic-functions"
--Bsymbolic-functions Bind default visibility defined function symbols locally for -shared
# zig v0.12.0-dev/master
$> zig ld.lld --help | grep -e "Bsymbolic-functions"
--Bsymbolic-functions Bind default visibility defined function symbols locally for -shared
# GNU ld (GNU Binutils) 2.42.0
$> ld --help | grep -e "Bsymbolic-functions"
-Bsymbolic-functions Bind global function references locally
yeah, patching clang with that patch solves it.
Using zig c++ to compile LLVM 18.1.8 (latest) fails with this problem as well. Why would zig patches LLVM source code instead of fixing this bug?
The use case described here is not compelling because the purpose of zig-bootstrap is to build a static zig compiler, which makes this flag irrelevant. However the feature is still OK to support.
Okay that seems to make sense.
This seems to be a blocker in my fork of zig-bootstrap when rebuilding LLVM 17.0.6 with zig.
See https://github.com/llvm/llvm-project/blob/llvmorg-17.0.6/clang/tools/clang-shlib/CMakeLists.txt#L54
The current solution is to either patch LLVM or to disable shared libraries entirely with
-DLLVM_ENABLE_PIC=OFF
.