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

Nathan Chancellor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 8 08:35:25 PST 2022


nathanchance added a comment.

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

> 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`

This set of options and commands reproduces the issue for me. This is the first stage building the second (instrumented) stage of a PGO build.

  $ cmake \
  -B build/stage1 \
  -G Ninja \
  -DCMAKE_AR=$(command -v llvm-ar) \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_C_COMPILER=$(command -v clang) \
  -DCMAKE_CXX_COMPILER=$(command -v clang++) \
  -DCMAKE_RANLIB=$(command -v llvm-ranlib) \
  -DCOMPILER_RT_BUILD_LIBFUZZER=OFF \
  -DCOMPILER_RT_BUILD_CRT=OFF \
  -DCOMPILER_RT_BUILD_XRAY=OFF \
  -DCOMPILER_RT_BUILD_SANITIZERS=OFF \
  -DLLVM_ENABLE_PROJECTS="clang;lld;compiler-rt" \
  -DLLVM_ENABLE_TERMINFO=OFF \
  -DLLVM_USE_LINKER=lld \
  -S llvm >/dev/null
  
  $ ninja -C build/stage1
  
  $ cmake \
  -B build/stage2 \
  -G Ninja \
  -DCLANG_TABLEGEN=$PWD/build/stage1/bin/clang-tblgen \
  -DCMAKE_AR=$PWD/build/stage1/bin/llvm-ar \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_C_COMPILER=$PWD/build/stage1/bin/clang \
  -DCMAKE_CXX_COMPILER=$PWD/build/stage1/bin/clang++ \
  -DCMAKE_RANLIB=$PWD/build/stage1/bin/llvm-ranlib \
  -DLLVM_BINUTILS_INCDIR=/usr/include \
  -DLLVM_BUILD_INSTRUMENTED=IR \
  -DLLVM_BUILD_RUNTIME=OFF \
  -DLLVM_ENABLE_ASSERTIONS=ON \
  -DLLVM_ENABLE_PLUGINS=ON \
  -DLLVM_ENABLE_PROJECTS="clang;lld" \
  -DLLVM_ENABLE_TERMINFO=OFF \
  -DLLVM_LINK_LLVM_DYLIB=ON \
  -DLLVM_TABLEGEN=$PWD/build/stage1/bin/llvm-tblgen \
  -DLLVM_USE_LINKER=$PWD/build/stage1/bin/ld.lld \
  -DLLVM_VP_COUNTERS_PER_SITE=6 \
  -S llvm >/dev/null
  
  $ ninja -C build/stage2
  ...
  [2802/2803] Linking CXX shared library lib/libRemarks.so.16git
  FAILED: lib/libRemarks.so.16git
  : && /home/nathan/cbl/src/llvm-project/build/stage1/bin/clang++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fprofile-generate="/home/nathan/cbl/src/llvm-project/build/stage2/profiles" -Xclang -mllvm -Xclang -vp-counters-per-site=6 -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete -fuse-ld=/home/nathan/cbl/src/llvm-project/build/stage1/bin/ld.lld -Wl,--color-diagnostics -fprofile-generate="/home/nathan/cbl/src/llvm-project/build/stage2/profiles"   -Wl,--gc-sections  -Wl,--version-script,"/home/nathan/cbl/src/llvm-project/build/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 && :
  clang-16: warning: '-fuse-ld=' taking a path is deprecated; use '--ld-path=' instead [-Wfuse-ld-path]
  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)
  [2803/2803] Linking CXX shared library lib/libLTO.so.16git
  FAILED: lib/libLTO.so.16git
  : && /home/nathan/cbl/src/llvm-project/build/stage1/bin/clang++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fprofile-generate="/home/nathan/cbl/src/llvm-project/build/stage2/profiles" -Xclang -mllvm -Xclang -vp-counters-per-site=6 -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete -fuse-ld=/home/nathan/cbl/src/llvm-project/build/stage1/bin/ld.lld -Wl,--color-diagnostics -fprofile-generate="/home/nathan/cbl/src/llvm-project/build/stage2/profiles"   -Wl,--gc-sections  -Wl,--version-script,"/home/nathan/cbl/src/llvm-project/build/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 && :
  clang-16: warning: '-fuse-ld=' taking a path is deprecated; use '--ld-path=' instead [-Wfuse-ld-path]
  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)
  ninja: build stopped: subcommand failed.


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