[PATCH] D135402: [LLD] Enable --no-undefined-version by default.

Joseph Huber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 8 06:45:53 PST 2022


jhuber6 added a comment.

In D135402#3913815 <https://reviews.llvm.org/D135402#3913815>, @MaskRay wrote:

> In D135402#3913785 <https://reviews.llvm.org/D135402#3913785>, @nathanchance wrote:
>
>> For what's worth, I now see the `libLTO` failures that @jhuber6 saw above and similar failures in `libRemarks` when doing a multistage build. I can dig out the cmake commands tomorrow if a standard one does not reproduce it.
>>
>>   [3825/4195] Linking CXX shared library lib/libLTO.so.16git
>>   FAILED: lib/libLTO.so.16git
>>   : && /mnt/nvme/tmp/build/llvm/stage1/bin/clang++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -w -fdiagnostics-color -ffunction-sections -fdata-sections -fprofile-generate="/mnt/nvme/tmp/build/llvm/stage2/profiles" -Xclang -mllvm -Xclang -vp-counters-per-site=6 -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete -fuse-ld=/mnt/nvme/tmp/build/llvm/stage1/bin/ld.lld -Wl,--color-diagnostics -fprofile-generate="/mnt/nvme/tmp/build/llvm/stage2/profiles"   -Wl,--gc-sections -Wl,--version-script,"/mnt/nvme/tmp/build/llvm/stage2/tools/lto/LTO.exports" -shared -Wl,-soname,libLTO.so.16git -o lib/libLTO.so.16git tools/lto/CMakeFiles/LTO.dir/LTODisassembler.cpp.o tools/lto/CMakeFiles/LTO.dir/lto.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib"  lib/libLLVM-16git.so && :
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMCreateDisasm' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMCreateDisasmCPU' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMDisasmDispose' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMDisasmInstruction' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMSetDisasmOptions' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMCreateDisasmCPUFeatures' failed: symbol not defined
>>   clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
>>   [3826/4195] Linking CXX shared library lib/libRemarks.so.16git
>>   FAILED: lib/libRemarks.so.16git
>>   : && /mnt/nvme/tmp/build/llvm/stage1/bin/clang++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -w -fdiagnostics-color -ffunction-sections -fdata-sections -fprofile-generate="/mnt/nvme/tmp/build/llvm/stage2/profiles" -Xclang -mllvm -Xclang -vp-counters-per-site=6 -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete -fuse-ld=/mnt/nvme/tmp/build/llvm/stage1/bin/ld.lld -Wl,--color-diagnostics -fprofile-generate="/mnt/nvme/tmp/build/llvm/stage2/profiles"   -Wl,--gc-sections -Wl,--version-script,"/mnt/nvme/tmp/build/llvm/stage2/tools/remarks-shlib/Remarks.exports" -shared -Wl,-soname,libRemarks.so.16git -o lib/libRemarks.so.16git tools/remarks-shlib/CMakeFiles/Remarks.dir/libremarks.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib"  lib/libLLVM-16git.so && :
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMRemarkStringGetData' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMRemarkStringGetLen' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMRemarkDebugLocGetSourceFilePath' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMRemarkDebugLocGetSourceLine' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMRemarkDebugLocGetSourceColumn' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMRemarkArgGetKey' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMRemarkArgGetValue' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMRemarkArgGetDebugLoc' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMRemarkEntryDispose' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMRemarkEntryGetType' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMRemarkEntryGetPassName' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMRemarkEntryGetRemarkName' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMRemarkEntryGetFunctionName' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMRemarkEntryGetDebugLoc' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMRemarkEntryGetHotness' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMRemarkEntryGetNumArgs' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMRemarkEntryGetFirstArg' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMRemarkEntryGetNextArg' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMRemarkParserCreateYAML' failed: symbol not defined
>>   ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMRemarkParserCreateBitstream' failed: symbol not defined
>>   ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
>>   clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
>
> What's the reproduce instruction? My two-stage build using LLVM_ENABLE_LLD=on works fine: `ninja -C /tmp/out/s2-custom lib/libLTO.so.16git lib/libRemarks.so.16git clang`

IIRC this was a somewhat weird scenario. I only noticed these errors after doing a re-build. If I deleted everything and did a fresh build it would work fine but would start failing again once I started trying to recompile without starting from scratch. Makes me thing it's a CMake problem.

FWIW I fixed all the issues `libomptarget` had. `libomp` had the issues I outlined above and I didn't get a solid recommendation on what to do about it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135402/new/

https://reviews.llvm.org/D135402



More information about the llvm-commits mailing list