diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-03-27 20:45:58 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-03-27 20:45:58 +0000 |
commit | 0a0c4cc56f8bb143443894cb5053c418002587b9 (patch) | |
tree | 41769f23203d9fd0ed0895b2809b709887ef7b9a /lib/MC/MCContext.cpp | |
parent | 8040d49d85fd0a7c26fdbc2676afe4556d12f15a (diff) | |
download | llvm-0a0c4cc56f8bb143443894cb5053c418002587b9.tar.gz llvm-0a0c4cc56f8bb143443894cb5053c418002587b9.tar.bz2 llvm-0a0c4cc56f8bb143443894cb5053c418002587b9.tar.xz |
DebugInfo: Support for compressed debug info sections
1) When creating a .debug_* section and instead create a .zdebug_
section.
2) When creating a fragment in a .zdebug_* section, make it a compressed
fragment.
3) When computing the size of a compressed section, compress the data
and use the size of the compressed data.
4) Emit the compressed bytes.
Also, check that only if a section has a compressed fragment, then that
is the only fragment in the section.
Assert-fail if the fragment's data is modified after it is compressed.
Initial review on llvm-commits by Eric Christopher and Rafael Espindola.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204958 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCContext.cpp')
-rw-r--r-- | lib/MC/MCContext.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp index ede3b3cd23..b228d18ba7 100644 --- a/lib/MC/MCContext.cpp +++ b/lib/MC/MCContext.cpp @@ -37,13 +37,13 @@ typedef std::map<SectionGroupPair, const MCSectionCOFF *> COFFUniqueMapTy; MCContext::MCContext(const MCAsmInfo *mai, const MCRegisterInfo *mri, const MCObjectFileInfo *mofi, const SourceMgr *mgr, - bool DoAutoReset) : - SrcMgr(mgr), MAI(mai), MRI(mri), MOFI(mofi), - Allocator(), Symbols(Allocator), UsedNames(Allocator), - NextUniqueID(0), - CurrentDwarfLoc(0,0,0,DWARF2_FLAG_IS_STMT,0,0), - DwarfLocSeen(false), GenDwarfForAssembly(false), GenDwarfFileNumber(0), - AllowTemporaryLabels(true), DwarfCompileUnitID(0), AutoReset(DoAutoReset) { + bool DoAutoReset) + : SrcMgr(mgr), MAI(mai), MRI(mri), MOFI(mofi), Allocator(), + Symbols(Allocator), UsedNames(Allocator), NextUniqueID(0), + CurrentDwarfLoc(0, 0, 0, DWARF2_FLAG_IS_STMT, 0, 0), DwarfLocSeen(false), + GenDwarfForAssembly(false), GenDwarfFileNumber(0), + AllowTemporaryLabels(true), DwarfCompileUnitID(0), + AutoReset(DoAutoReset) { error_code EC = llvm::sys::fs::current_path(CompilationDir); if (EC) @@ -251,6 +251,11 @@ getELFSection(StringRef Section, unsigned Type, unsigned Flags, ELFUniquingMap = new ELFUniqueMapTy(); ELFUniqueMapTy &Map = *(ELFUniqueMapTy*)ELFUniquingMap; + SmallString<32> ZDebugName; + if (MAI->compressDebugSections() && Section.startswith(".debug_") && + Section != ".debug_frame") + Section = (".z" + Section.drop_front(1)).toStringRef(ZDebugName); + // Do the lookup, if we have a hit, return it. std::pair<ELFUniqueMapTy::iterator, bool> Entry = Map.insert( std::make_pair(SectionGroupPair(Section, Group), (MCSectionELF *)0)); |