aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCObjectFileInfo.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2018-04-04 12:28:20 +0000
committerPavel Labath <labath@google.com>2018-04-04 12:28:20 +0000
commit69baab103ac6eb5236690905e443d1b2b65920d0 (patch)
tree69ccfcc335bb921aca70ffaec3ed5162e8ef0b63 /llvm/lib/MC/MCObjectFileInfo.cpp
parent644d456a5f8fb6cc4547c8f5cbe7e7fbbf740a10 (diff)
downloadllvm-69baab103ac6eb5236690905e443d1b2b65920d0.zip
llvm-69baab103ac6eb5236690905e443d1b2b65920d0.tar.gz
llvm-69baab103ac6eb5236690905e443d1b2b65920d0.tar.bz2
[CodeGen] Generate DWARF v5 Accelerator Tables
Summary: This patch adds a DwarfAccelTableEmitter class, which generates an accelerator table, as specified in DWARF v5 standard. At the moment it only generates a DIE offset column and (if we are indexing more than one compile unit) a CU column. Indexing type units is not currently supported, as we don't even have the ability to generate DWARF v5-compatible compile units. The implementation is not data-source agnostic like the one generating apple tables. This was not necessary as we currently only have one user of this code, and without a second user it was not obvious to me how to best abstract this. (The difference between these tables and the apple ones is that they need a lot more metadata about the debug info they are indexing). The generation is triggered by the --accel-tables argument, which supersedes the --dwarf-accel-tables arg -- the latter was a simple on-off switch, but not we can choose between two kinds of accelerator tables we can generate. This is tested by parsing the generated tables with llvm-dwarfdump and the DWARFVerifier, and I've also checked that GNU readelf is able to make sense of the tables. Differential Revision: https://reviews.llvm.org/D43286 llvm-svn: 329179
Diffstat (limited to 'llvm/lib/MC/MCObjectFileInfo.cpp')
-rw-r--r--llvm/lib/MC/MCObjectFileInfo.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp
index 83da8ac..b154c98 100644
--- a/llvm/lib/MC/MCObjectFileInfo.cpp
+++ b/llvm/lib/MC/MCObjectFileInfo.cpp
@@ -201,6 +201,9 @@ void MCObjectFileInfo::initMachOMCObjectFileInfo(const Triple &T) {
}
// Debug Information.
+ DwarfDebugNamesSection =
+ Ctx->getMachOSection("__DWARF", "__debug_names", MachO::S_ATTR_DEBUG,
+ SectionKind::getMetadata(), "debug_names_begin");
DwarfAccelNamesSection =
Ctx->getMachOSection("__DWARF", "__apple_names", MachO::S_ATTR_DEBUG,
SectionKind::getMetadata(), "names_begin");
@@ -558,6 +561,8 @@ void MCObjectFileInfo::initELFMCObjectFileInfo(const Triple &T, bool Large) {
// DWARF5 Experimental Debug Info
// Accelerator Tables
+ DwarfDebugNamesSection =
+ Ctx->getELFSection(".debug_names", ELF::SHT_PROGBITS, 0);
DwarfAccelNamesSection =
Ctx->getELFSection(".apple_names", ELF::SHT_PROGBITS, 0);
DwarfAccelObjCSection =
@@ -795,6 +800,11 @@ void MCObjectFileInfo::initCOFFMCObjectFileInfo(const Triple &T) {
COFF::IMAGE_SCN_MEM_DISCARDABLE | COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
COFF::IMAGE_SCN_MEM_READ,
SectionKind::getMetadata());
+ DwarfDebugNamesSection = Ctx->getCOFFSection(
+ ".debug_names",
+ COFF::IMAGE_SCN_MEM_DISCARDABLE | COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
+ COFF::IMAGE_SCN_MEM_READ,
+ SectionKind::getMetadata(), "debug_names_begin");
DwarfAccelNamesSection = Ctx->getCOFFSection(
".apple_names",
COFF::IMAGE_SCN_MEM_DISCARDABLE | COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |