-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[Polly] Build failure with shared lib at -O0 and lld #134393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@llvm/issue-subscribers-polly Author: Alexis Engelke (aengelke)
Polly uses `AllAnalysesOn<Loop>`, which has an explicit template instantiation in LoopAnalysisManager.cpp/h. Therefore, there are multiple (weak) definitions for libLLVM.so, the Polly ones are hidden (`STV_HIDDEN`) due to `-fvisibility-inlines-hidden` while the explicit instantiation has default visibility. According to the gABI, the non-default visibility wins (implemented by LLD/Gold; with BFD, default wins). The symbol ends up with `STV_HIDDEN` in libLLVM.so and linking the unit tests therefore fails with `undefined symbol: llvm::AllAnalysesOn<llvm::Loop>::ID()`.
(FWIW, this behavior was implemented in LLD in 78471f0 (2015).) CMake command: (cc @MaskRay – could we get a warning when a previously default-visible symbol gets hidden? Or are there cases where this is intended?) |
GNU ld doesn't behave differently from gold / LLD. The non-default visibility wins per gABI
This is an intended behavior and allows users to constrain a symbol. I don't think we could implement a warning... |
This problem doesn't seem Polly-specific, but applies to any NPM pass plugin. Anyway, use of |
Polly uses
AllAnalysesOn<Loop>
, which has an explicit template instantiation in LoopAnalysisManager.cpp/h. Therefore, there are multiple (weak) definitions for libLLVM.so, the Polly ones are hidden (STV_HIDDEN
) due to-fvisibility-inlines-hidden
while the explicit instantiation has default visibility. According to the gABI, the non-default visibility wins (implemented by LLD/Gold; with BFD, default wins). The symbol ends up withSTV_HIDDEN
in libLLVM.so and linking the unit tests therefore fails withundefined symbol: llvm::AllAnalysesOn<llvm::Loop>::ID()
.(FWIW, this behavior was implemented in LLD in 78471f0 (2015).)
CMake command:
cmake -DLLVM_ENABLE_PROJECTS="polly" -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_BUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS_RELEASE=-O0 -DCMAKE_CXX_FLAGS_RELEASE=-O0 -G Ninja -DLLVM_ENABLE_ASSERTIONS=OFF -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON -DCMAKE_C_COMPILER=clang-19 -DCMAKE_CXX_COMPILER=clang++-19 -DLLVM_USE_LINKER=lld -B llvm-build-tmp -S llvm-project/llvm
.(cc @MaskRay – could we get a warning when a previously default-visible symbol gets hidden? Or are there cases where this is intended?)
The text was updated successfully, but these errors were encountered: