This is an archive of the discontinued LLVM Phabricator instance.

[Dsymutil][NFC] Move NonRelocatableStringpool into common CodeGen folder.
ClosedPublic

Authored by avl on Dec 5 2019, 8:08 AM.

Details

Summary

This is the first patch from the set of patches extracted from D70709.

That refactoring moves NonRelocatableStringpool into common CodeGen folder.
So that NonRelocatableStringpool could be used not only inside dsymutil.

Testing results:

check-all - passed.
golden/new comparison:

golden-dsymutil/dsymutil build-Debug/bin/clang

md5 -r build-Debug/bin/clang.dSYM/Contents/Resources/DWARF/clang

a31430a6a2fbbd81fbed88888c769213 build-Debug/bin/clang.dSYM/Contents/Resources/DWARF/clang

new-dsymutil/dsymutil build-Debug/bin/clang

md5 -r build-Debug/bin/clang.dSYM/Contents/Resources/DWARF/clang

a31430a6a2fbbd81fbed88888c769213 build-Debug/bin/clang.dSYM/Contents/Resources/DWARF/clang

Diff Detail

Event Timeline

avl created this revision.Dec 5 2019, 8:08 AM
This revision is now accepted and ready to land.Dec 5 2019, 9:04 AM
This revision was automatically updated to reflect the committed changes.
gchatelet added a subscriber: gchatelet.EditedDec 6 2019, 2:26 AM

This patch seems to break my build:

[289/332] Linking CXX executable bin/dsymutil
FAILED: bin/dsymutil 
: && /redacted/build-llvm/clang/bin/clang++  -fPIC -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -g  -fuse-ld=lld -Wl,--color-diagnostics -Wl,-allow-shlib-undefined tools/dsymutil/CMakeFiles/dsymutil.dir/dsymutil.cpp.o tools/dsymutil/CMakeFiles/dsymutil.dir/BinaryHolder.cpp.o tools/dsymutil/CMakeFiles/dsymutil.dir/CFBundle.cpp.o tools/dsymutil/CMakeFiles/dsymutil.dir/CompileUnit.cpp.o tools/dsymutil/CMakeFiles/dsymutil.dir/DebugMap.cpp.o tools/dsymutil/CMakeFiles/dsymutil.dir/DeclContext.cpp.o tools/dsymutil/CMakeFiles/dsymutil.dir/DwarfLinker.cpp.o tools/dsymutil/CMakeFiles/dsymutil.dir/DwarfStreamer.cpp.o tools/dsymutil/CMakeFiles/dsymutil.dir/MachODebugMapParser.cpp.o tools/dsymutil/CMakeFiles/dsymutil.dir/MachOUtils.cpp.o tools/dsymutil/CMakeFiles/dsymutil.dir/SymbolMap.cpp.o  -o bin/dsymutil  -Wl,-rpath,"\$ORIGIN/../lib" lib/libLLVMAArch64CodeGen.so.10git lib/libLLVMAMDGPUCodeGen.so.10git lib/libLLVMARMCodeGen.so.10git lib/libLLVMBPFCodeGen.so.10git lib/libLLVMHexagonCodeGen.so.10git lib/libLLVMLanaiCodeGen.so.10git lib/libLLVMMipsCodeGen.so.10git lib/libLLVMMSP430CodeGen.so.10git lib/libLLVMNVPTXCodeGen.so.10git lib/libLLVMPowerPCCodeGen.so.10git lib/libLLVMRISCVCodeGen.so.10git lib/libLLVMSparcCodeGen.so.10git lib/libLLVMSystemZCodeGen.so.10git lib/libLLVMWebAssemblyCodeGen.so.10git lib/libLLVMX86CodeGen.so.10git lib/libLLVMXCoreCodeGen.so.10git lib/libLLVMARCCodeGen.so.10git lib/libLLVMAVRCodeGen.so.10git lib/libLLVMAArch64Desc.so.10git lib/libLLVMAMDGPUDesc.so.10git lib/libLLVMARMDesc.so.10git lib/libLLVMBPFDesc.so.10git lib/libLLVMHexagonDesc.so.10git lib/libLLVMLanaiDesc.so.10git lib/libLLVMMipsDesc.so.10git lib/libLLVMMSP430Desc.so.10git lib/libLLVMNVPTXDesc.so.10git lib/libLLVMPowerPCDesc.so.10git lib/libLLVMRISCVDesc.so.10git lib/libLLVMSparcDesc.so.10git lib/libLLVMSystemZDesc.so.10git lib/libLLVMWebAssemblyDesc.so.10git lib/libLLVMX86Desc.so.10git lib/libLLVMXCoreDesc.so.10git lib/libLLVMARCDesc.so.10git lib/libLLVMAVRDesc.so.10git lib/libLLVMAArch64Info.so.10git lib/libLLVMAMDGPUInfo.so.10git lib/libLLVMARMInfo.so.10git lib/libLLVMBPFInfo.so.10git lib/libLLVMHexagonInfo.so.10git lib/libLLVMLanaiInfo.so.10git lib/libLLVMMipsInfo.so.10git lib/libLLVMMSP430Info.so.10git lib/libLLVMNVPTXInfo.so.10git lib/libLLVMPowerPCInfo.so.10git lib/libLLVMRISCVInfo.so.10git lib/libLLVMSparcInfo.so.10git lib/libLLVMSystemZInfo.so.10git lib/libLLVMWebAssemblyInfo.so.10git lib/libLLVMX86Info.so.10git lib/libLLVMXCoreInfo.so.10git lib/libLLVMARCInfo.so.10git lib/libLLVMAVRInfo.so.10git lib/libLLVMAsmPrinter.so.10git lib/libLLVMDebugInfoDWARF.so.10git lib/libLLVMMC.so.10git lib/libLLVMObject.so.10git lib/libLLVMOption.so.10git lib/libLLVMRemarks.so.10git lib/libLLVMSupport.so.10git lib/libLLVMTarget.so.10git -lpthread && :
ld.lld: error: undefined symbol: llvm::NonRelocatableStringpool::internString(llvm::StringRef)
>>> referenced by DeclContext.cpp:91 (/redacted/git/llvm-project/llvm/tools/dsymutil/DeclContext.cpp:91)
>>>               tools/dsymutil/CMakeFiles/dsymutil.dir/DeclContext.cpp.o:(llvm::dsymutil::DeclContextTree::getChildDeclContext(llvm::dsymutil::DeclContext&, llvm::DWARFDie const&, llvm::dsymutil::CompileUnit&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::UniqueTag>&, bool))
>>> referenced by DeclContext.cpp:95 (/redacted/git/llvm-project/llvm/tools/dsymutil/DeclContext.cpp:95)
>>>               tools/dsymutil/CMakeFiles/dsymutil.dir/DeclContext.cpp.o:(llvm::dsymutil::DeclContextTree::getChildDeclContext(llvm::dsymutil::DeclContext&, llvm::DWARFDie const&, llvm::dsymutil::CompileUnit&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::UniqueTag>&, bool))
>>> referenced by DeclContext.cpp:98 (/redacted/git/llvm-project/llvm/tools/dsymutil/DeclContext.cpp:98)
>>>               tools/dsymutil/CMakeFiles/dsymutil.dir/DeclContext.cpp.o:(llvm::dsymutil::DeclContextTree::getChildDeclContext(llvm::dsymutil::DeclContext&, llvm::DWARFDie const&, llvm::dsymutil::CompileUnit&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::UniqueTag>&, bool))
>>> referenced by DeclContext.h:49 (/redacted/git/llvm-project/llvm/tools/dsymutil/DeclContext.h:49)
>>>               tools/dsymutil/CMakeFiles/dsymutil.dir/DeclContext.cpp.o:(llvm::dsymutil::CachedPathResolver::resolve(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, llvm::NonRelocatableStringpool&))
>>> referenced by DwarfLinker.cpp:2558 (/redacted/git/llvm-project/llvm/tools/dsymutil/DwarfLinker.cpp:2558)
>>>               tools/dsymutil/CMakeFiles/dsymutil.dir/DwarfLinker.cpp.o:(llvm::dsymutil::DwarfLinker::emitPaperTrailWarnings(llvm::dsymutil::DebugMapObject const&, llvm::dsymutil::DebugMap const&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&))
>>> referenced by DwarfLinker.cpp:2559 (/redacted/git/llvm-project/llvm/tools/dsymutil/DwarfLinker.cpp:2559)
>>>               tools/dsymutil/CMakeFiles/dsymutil.dir/DwarfLinker.cpp.o:(llvm::dsymutil::DwarfLinker::emitPaperTrailWarnings(llvm::dsymutil::DebugMapObject const&, llvm::dsymutil::DebugMap const&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&))

ld.lld: error: undefined symbol: llvm::NonRelocatableStringpool::getEntry(llvm::StringRef)
>>> referenced by DwarfLinker.cpp:205 (/redacted/git/llvm-project/llvm/tools/dsymutil/DwarfLinker.cpp:205)
>>>               tools/dsymutil/CMakeFiles/dsymutil.dir/DwarfLinker.cpp.o:(llvm::dsymutil::DwarfLinker::DIECloner::getDIENames(llvm::DWARFDie const&, llvm::dsymutil::DwarfLinker::DIECloner::AttributesInfo&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&, bool))
>>> referenced by DwarfLinker.cpp:209 (/redacted/git/llvm-project/llvm/tools/dsymutil/DwarfLinker.cpp:209)
>>>               tools/dsymutil/CMakeFiles/dsymutil.dir/DwarfLinker.cpp.o:(llvm::dsymutil::DwarfLinker::DIECloner::getDIENames(llvm::DWARFDie const&, llvm::dsymutil::DwarfLinker::DIECloner::AttributesInfo&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&, bool))
>>> referenced by DwarfLinker.cpp:215 (/redacted/git/llvm-project/llvm/tools/dsymutil/DwarfLinker.cpp:215)
>>>               tools/dsymutil/CMakeFiles/dsymutil.dir/DwarfLinker.cpp.o:(llvm::dsymutil::DwarfLinker::DIECloner::getDIENames(llvm::DWARFDie const&, llvm::dsymutil::DwarfLinker::DIECloner::AttributesInfo&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&, bool))
>>> referenced by DwarfLinker.cpp:1121 (/redacted/git/llvm-project/llvm/tools/dsymutil/DwarfLinker.cpp:1121)
>>>               tools/dsymutil/CMakeFiles/dsymutil.dir/DwarfLinker.cpp.o:(llvm::dsymutil::DwarfLinker::DIECloner::cloneStringAttribute(llvm::DIE&, llvm::DWARFAbbreviationDeclaration::AttributeSpec, llvm::DWARFFormValue const&, llvm::DWARFUnit const&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&, llvm::dsymutil::DwarfLinker::DIECloner::AttributesInfo&))
>>> referenced by DwarfLinker.cpp:1555 (/redacted/git/llvm-project/llvm/tools/dsymutil/DwarfLinker.cpp:1555)
>>>               tools/dsymutil/CMakeFiles/dsymutil.dir/DwarfLinker.cpp.o:(llvm::dsymutil::DwarfLinker::DIECloner::addObjCAccelerator(llvm::dsymutil::CompileUnit&, llvm::DIE const*, llvm::DwarfStringPoolEntryRef, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&, bool))
>>> referenced by DwarfLinker.cpp:1560 (/redacted/git/llvm-project/llvm/tools/dsymutil/DwarfLinker.cpp:1560)
>>>               tools/dsymutil/CMakeFiles/dsymutil.dir/DwarfLinker.cpp.o:(llvm::dsymutil::DwarfLinker::DIECloner::addObjCAccelerator(llvm::dsymutil::CompileUnit&, llvm::DIE const*, llvm::DwarfStringPoolEntryRef, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&, bool))
>>> referenced by DwarfLinker.cpp:1566 (/redacted/git/llvm-project/llvm/tools/dsymutil/DwarfLinker.cpp:1566)
>>>               tools/dsymutil/CMakeFiles/dsymutil.dir/DwarfLinker.cpp.o:(llvm::dsymutil::DwarfLinker::DIECloner::addObjCAccelerator(llvm::dsymutil::CompileUnit&, llvm::DIE const*, llvm::DwarfStringPoolEntryRef, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&, bool))
>>> referenced by DwarfLinker.cpp:1573 (/redacted/git/llvm-project/llvm/tools/dsymutil/DwarfLinker.cpp:1573)
>>>               tools/dsymutil/CMakeFiles/dsymutil.dir/DwarfLinker.cpp.o:(llvm::dsymutil::DwarfLinker::DIECloner::addObjCAccelerator(llvm::dsymutil::CompileUnit&, llvm::DIE const*, llvm::DwarfStringPoolEntryRef, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&, bool))
>>> referenced by DwarfLinker.cpp:1740 (/redacted/git/llvm-project/llvm/tools/dsymutil/DwarfLinker.cpp:1740)
>>>               tools/dsymutil/CMakeFiles/dsymutil.dir/DwarfLinker.cpp.o:(llvm::dsymutil::DwarfLinker::DIECloner::cloneDIE(llvm::DWARFDie const&, llvm::dsymutil::DebugMapObject const&, llvm::dsymutil::CompileUnit&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&, long, unsigned int, unsigned int, bool, llvm::DIE*))
>>> referenced by NonRelocatableStringpool.h:42 (/redacted/git/llvm-project/llvm/include/llvm/CodeGen/NonRelocatableStringpool.h:42)
>>>               tools/dsymutil/CMakeFiles/dsymutil.dir/DwarfLinker.cpp.o:(llvm::NonRelocatableStringpool::getStringOffset(llvm::StringRef))
>>> referenced 1 more times

ld.lld: error: undefined symbol: llvm::NonRelocatableStringpool::getEntriesForEmission() const
>>> referenced by DwarfStreamer.cpp:196 (/redacted/git/llvm-project/llvm/tools/dsymutil/DwarfStreamer.cpp:196)
>>>               tools/dsymutil/CMakeFiles/dsymutil.dir/DwarfStreamer.cpp.o:(llvm::dsymutil::DwarfStreamer::emitStrings(llvm::NonRelocatableStringpool const&))
>>> referenced by MachOUtils.cpp:542 (/redacted/git/llvm-project/llvm/tools/dsymutil/MachOUtils.cpp:542)
>>>               tools/dsymutil/CMakeFiles/dsymutil.dir/MachOUtils.cpp.o:(llvm::dsymutil::MachOUtils::generateDsymCompanion(llvm::dsymutil::DebugMap const&, llvm::dsymutil::SymbolMapTranslator&, llvm::MCStreamer&, llvm::raw_fd_ostream&))
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[297/332] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/ThinLTOCodeGenerator.cpp.o
avl added a comment.Dec 6 2019, 3:41 AM

@gchatelet This patch seems to break my build:

I would check it. NonRelocatableStringpool was moved into llvm/CodeGen. It looks like lib/libLLVMCodeGen.so.10git library is not used. Could you tell me what options were used to build llvm, please ?

BUILD_SHARED_LIBS=ON
LLVM_ENABLE_LTO=ON

?

gchatelet added a comment.EditedDec 6 2019, 5:35 AM
In D71068#1772464, @avl wrote:

@gchatelet This patch seems to break my build:

I would check it. NonRelocatableStringpool was moved into llvm/CodeGen. It looks like lib/libLLVMCodeGen.so.10git library is not used. Could you tell me what options were used to build llvm, please ?

-DCMAKE_C_COMPILER=/redacted/build-llvm/clang/bin/clang
-DCMAKE_CXX_COMPILER=/redacted/build-llvm/clang/bin/clang++
-DCMAKE_BUILD_TYPE=Debug
-LLVM_ENABLE_ASSERTIONS=ON
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DLLVM_USE_SPLIT_DWARF=ON
-DLLVM_OPTIMIZED_TABLEGEN=ON
-DLLVM_TARGETS_TO_BUILD=all
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=ARC;AVR
-DLLVM_ENABLE_PROJECTS=clang
-DBUILD_SHARED_LIBS=ON
-DLLVM_BUILD_TESTS=ON
-DLLVM_ENABLE_WERROR=ON
-DLLVM_ENABLE_LLD=ON

I should have posted them in the first place. My apologies.

avl added a comment.Dec 6 2019, 5:55 AM

I integrated the fix which cures building of shared libraries - https://reviews.llvm.org/rG8c714c93023d7d039a23fb47c8256570ba54b9c7 . I would additionally check whether it is working now for all above settings. Thank you.

In D71068#1772572, @avl wrote:

I integrated the fix which cures building of shared libraries - https://reviews.llvm.org/rG8c714c93023d7d039a23fb47c8256570ba54b9c7 . I would additionally check whether it is working now for all above settings. Thank you.

It works ! Thank you.