Issue 134393
Summary [Polly] Build failure with shared lib at -O0 and lld
Labels build-problem, polly
Assignees
Reporter 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 78471f0ec1e6182b51607e2b4f7f99002533e8b3 (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?)
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to