Closed llvmbot closed 9 years ago
ahh, you are right. Using -D_GLIBCXX_USE_CXX11_ABI=0 fixes the problem. Sorry for the noise.
We are already linking agaist LLVMRuntimeDyld.so, but the problem is that the symbol is unresolvable:
nm /usr/lib64/libLLVMRuntimeDyld.so | grep InProc
U _ZN4llvm19RTDyldMemoryManager25getSymbolAddressInProcessERKSs
Somehow this works with gcc-4.9 but fails with gcc-5.
gcc-5 uses a new C++ ABI. If you want to use LLVM libraries with gcc-5 you must build LLVM with gcc-5, too. Building LLVM with gcc-4.9 and then using gcc-5 to build e.g. mesa will fail. Another possibility is to use -D_GLIBCXX_USE_CXX11_ABI=0 with gcc-5 to switch back to the old ABI. Both ABIs live in the same .so file.
We are already linking agaist LLVMRuntimeDyld.so, but the problem is that the symbol is unresolvable:
U _ZN4llvm19RTDyldMemoryManager25getSymbolAddressInProcessERKSs
Somehow this works with gcc-4.9 but fails with gcc-5.
Thanks Hans.
CCing Hans Wennborg, who's managing the release.
Hans - Would it be possible to cherry-pick r229343 into the release branch?
Since we're doing an rc4 anyway, I've merged it (and r229351) in r229553.
Hi Mark,
You might need to add RuntimeDyld to your list of dependencies a la r229351.
Cheers, Lang.
I already tried this with no success. Maybe a mesa patch is needed instead? My lib shows getSymbolAddressInProcess is an unresolved symbol for some reason (getSymbolAddress is ok).
CCing Hans Wennborg, who's managing the release.
Hans - Would it be possible to cherry-pick r229343 into the release branch?
same error compiling mesa with gcc 5 and llvm 3.6(rc):
/bin/sh ../../../../libtool --tag=CXX --mode=link g++-5 -O2 -Wall -fno-strict-aliasing -fno-builtin-memcmp -shared -module -no-undefined -avoid-version -Wl,--gc-sections -Wl,--no-undefined -Wl,--version-script=../../../../src/gallium/targets/omx/omx.sym -L/usr/lib64 -O2 -o libomx_mesa.la -rpath /usr/lib64/bellagio libomx_mesa_la-target.lo ../../../../src/gallium/state_trackers/omx/libomxtracker.la ../../../../src/gallium/auxiliary/libgalliumvlwinsys.la ../../../../src/gallium/auxiliary/libgalliumvl.la ../../../../src/gallium/auxiliary/libgallium.la ../../../../src/util/libmesautil.la -lomxil-bellagio -lX11-xcb -lX11 -lxcb-dri2 -lxcb -ldrm -lm -lpthread -ldl ../../../../src/loader/libloader.la ../../../../src/gallium/drivers/r600/libr600.la -ldrm_radeon -ldrm ../../../../src/gallium/winsys/radeon/drm/libradeonwinsys.la ../../../../src/gallium/drivers/radeon/libradeon.la -lLLVMAsmParser -lLLVMR600CodeGen -lLLVMipo -lLLVMVectorize -lLLVMR600AsmParser -lLLVMR600Desc -lLLVMR600Info -lLLVMR600AsmPrinter -lLLVMBitWriter -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMScalarOpts -lLLVMProfileData -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMX86Desc -lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCJIT -lLLVMTarget -lLLVMRuntimeDyld -lLLVMExecutionEngine -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMMC -lLLVMCore -lLLVMSupport -lrt -ldl -ltinfo -latomic -lpthread -lz -lm
libtool: link: g++-5 -fPIC -DPIC -shared -nostdlib /usr/lib64/gcc/x86_64-suse-linux/5/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/5/crtbeginS.o .libs/libomx_mesa_la-target.o -Wl,--whole-archive ../../../../src/gallium/state_trackers/omx/.libs/libomxtracker.a ../../../../src/gallium/auxiliary/.libs/libgalliumvlwinsys.a ../../../../src/gallium/auxiliary/.libs/libgalliumvl.a ../../../../src/gallium/auxiliary/.libs/libgallium.a ../../../../src/util/.libs/libmesautil.a ../../../../src/loader/.libs/libloader.a ../../../../src/gallium/drivers/r600/.libs/libr600.a ../../../../src/gallium/winsys/radeon/drm/.libs/libradeonwinsys.a ../../../../src/gallium/drivers/radeon/.libs/libradeon.a -Wl,--no-whole-archive -Wl,-rpath -Wl,/usr/lib64 -Wl,-rpath -Wl,/usr/lib64 -L/usr/lib64 -lnettle /usr/lib64/libomxil-bellagio.so -lX11-xcb -lX11 -lxcb-dri2 -lxcb -lexpat /usr/lib64/libdrm_radeon.so /usr/lib64/libdrm.so -lelf -lLLVMAsmParser -lLLVMR600CodeGen -lLLVMipo -lLLVMVectorize -lLLVMR600AsmParser -lLLVMR600Desc -lLLVMR600Info -lLLVMR600AsmPrinter -lLLVMBitWriter -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMScalarOpts -lLLVMProfileData -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMX86Desc -lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCJIT -lLLVMTarget -lLLVMRuntimeDyld -lLLVMExecutionEngine -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMMC -lLLVMCore -lLLVMSupport -lrt -ldl -ltinfo -latomic -lpthread -lz -L/usr/lib64/gcc/x86_64-suse-linux/5 -L/usr/lib64/gcc/x86_64-suse-linux/5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/opt/intel/composer_xe_2015.0.090/compiler/lib/intel64 -L/opt/intel/composer_xe_2015.0.090/ipp/../compiler/lib/intel64 -L/opt/intel/composer_xe_2015.0.090/ipp/lib/intel64 -L/opt/intel/composer_xe_2015.0.090/mkl/lib/intel64 -L/opt/intel/composer_xe_2015.0.090/tbb/lib/intel64/gcc4.4 -L/usr/lib64/gcc/x86_64-suse-linux/5/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc/x86_64-suse-linux/5/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib64/gcc/x86_64-suse-linux/5/crtendS.o /usr/lib64/gcc/x86_64-suse-linux/5/../../../../lib64/crtn.o -O2 -Wl,--gc-sections -Wl,--no-undefined -Wl,--version-script=../../../../src/gallium/targets/omx/omx.sym -O2 -Wl,-soname -Wl,libomx_mesa.so -o .libs/libomx_mesa.so
../../../../src/gallium/auxiliary/.libs/libgallium.a(lp_bld_misc.o):lp_bld_misc.cpp:function llvm::RTDyldMemoryManager::getSymbolAddress(std::cxx11::basic_string<char, std::char_traits
Thanks for tracking this down. I've tried to fix this dependency issue in r229343. Could you try that out and see if it fixes the issue?
Yes it does. Thanks.
Hi Octoploid,
Thanks for tracking this down. I've tried to fix this dependency issue in r229343. Could you try that out and see if it fixes the issue?
Cheers, Lang.
gcc correctly devirtualizes in this case:
markus@x4 llvm_build % cat RuntimeDyld.ii
namespace std
{
inline namespace __cxx11
{
}
template
public: basic_string (void *) : _M_dataplus (0) {} }; } }
namespace llvm
{
class RTDyldMemoryManager
{
public:
void getSymbolAddressInProcess (const std::basic_string
markus@x4 llvm_build % g++ -O2 -c -std=c++11 RuntimeDyld.ii markus@x4 llvm_build % nm RuntimeDyld.o| grep _ZN4llvm19RTDyldMemoryManager25getSymbolAddressInProcessERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE U _ZN4llvm19RTDyldMemoryManager25getSymbolAddressInProcessERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Also happens with gcc-4.9.
Extended Description
Building llvm with gcc-5 I get:
[1456/1987] Linking CXX shared library lib/libLLVMRuntimeDyld.so FAILED: : && /usr/bin/g++ -fPIC -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wnon-virtual-dtor -Wno-comment -std=c++11 -ffunction-sections -fdata-sections -O3 -fno-strict-aliasing -march=native -pipe -Wl,-z,defs -Wl,-O3 -Wl,--gc-sections -shared -Wl,-soname,libLLVMRuntimeDyld.so -o lib/libLLVMRuntimeDyld.so lib/ExecutionEngine/RuntimeDyld/CMakeFiles/LLVMRuntimeDyld.dir/RuntimeDyld.cpp.o lib/ExecutionEngine/RuntimeDyld/CMakeFiles/LLVMRuntimeDyld.dir/RuntimeDyldChecker.cpp.o lib/ExecutionEngine/RuntimeDyld/CMakeFiles/LLVMRuntimeDyld.dir/RuntimeDyldELF.cpp.o lib/ExecutionEngine/RuntimeDyld/CMakeFiles/LLVMRuntimeDyld.dir/RuntimeDyldMachO.cpp.o lib/libLLVMMC.so lib/libLLVMObject.so lib/libLLVMSupport.so -Wl,-rpath,"\$ORIGIN/../lib" && : lib/ExecutionEngine/RuntimeDyld/CMakeFiles/LLVMRuntimeDyld.dir/RuntimeDyld.cpp.o:RuntimeDyld.cpp:function llvm::RTDyldMemoryManager::getSymbolAddress(std::cxx11::basic_string<char, std::char_traits, std::allocator > const&): error: undefined reference to 'llvm::RTDyldMemoryManager::getSymbolAddressInProcess(std:: cxx11::basic_string<char, std::char_traits, std::allocator > const&)'
lib/ExecutionEngine/RuntimeDyld/CMakeFiles/LLVMRuntimeDyld.dir/RuntimeDyld.cpp.o:RuntimeDyld.cpp:function llvm::RuntimeDyldImpl::resolveExternalSymbols(): error: undefined reference to 'llvm::RTDyldMemoryManager::getSymbolAddressInProcess(std::cxx11::basic_string<char, std::char_traits, std::allocator > const&)'
lib/ExecutionEngine/RuntimeDyld/CMakeFiles/LLVMRuntimeDyld.dir/RuntimeDyldChecker.cpp.o:RuntimeDyldChecker.cpp:function llvm::RuntimeDyldCheckerImpl::getSymbolRemoteAddr(llvm::StringRef) const: error: undefined reference to 'llvm::RTDyldMemoryManager::getSymbolAddressInProcess(std:: cxx11::basic_string<char, std::char_traits, std::allocator > const&)'
collect2: error: ld returned 1 exit status
The missing symbol is defined in lib/ExecutionEngine/CMakeFiles/LLVMExecutionEngine.dir/RTDyldMemoryManager.cpp.o adding it to the link command "fixes" the issue.