summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/DebugInfo/DIContext.h1
-rw-r--r--llvm/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h4
-rw-r--r--llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h33
-rw-r--r--llvm/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h2
-rw-r--r--llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h24
-rw-r--r--llvm/include/llvm/MC/MCObjectFileInfo.h4
-rw-r--r--llvm/include/llvm/Object/MachO.h2
-rw-r--r--llvm/include/llvm/Object/ObjectFile.h3
8 files changed, 58 insertions, 15 deletions
diff --git a/llvm/include/llvm/DebugInfo/DIContext.h b/llvm/include/llvm/DebugInfo/DIContext.h
index 2ab1c950852..7c9e429a189 100644
--- a/llvm/include/llvm/DebugInfo/DIContext.h
+++ b/llvm/include/llvm/DebugInfo/DIContext.h
@@ -135,6 +135,7 @@ enum DIDumpType {
DIDT_GnuPubnames,
DIDT_GnuPubtypes,
DIDT_Str,
+ DIDT_StrOffsets,
DIDT_StrDwo,
DIDT_StrOffsetsDwo,
DIDT_AppleNames,
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h
index 46c0b7f4ce6..cb3f4ae61f7 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h
@@ -19,8 +19,8 @@ class DWARFCompileUnit : public DWARFUnit {
public:
DWARFCompileUnit(DWARFContext &Context, const DWARFSection &Section,
const DWARFDebugAbbrev *DA, const DWARFSection *RS,
- StringRef SS, StringRef SOS, const DWARFSection *AOS,
- StringRef LS, bool LE, bool IsDWO,
+ StringRef SS, const DWARFSection &SOS,
+ const DWARFSection *AOS, StringRef LS, bool LE, bool IsDWO,
const DWARFUnitSectionBase &UnitSection,
const DWARFUnitIndex::Entry *Entry)
: DWARFUnit(Context, Section, DA, RS, SS, SOS, AOS, LS, LE, IsDWO,
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
index 519ecf61855..d0735dc1ddb 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
@@ -72,6 +72,9 @@ class DWARFContext : public DIContext {
std::unique_ptr<DWARFDebugAbbrev> AbbrevDWO;
std::unique_ptr<DWARFDebugLocDWO> LocDWO;
+ /// The maximum DWARF version of all units.
+ unsigned MaxVersion;
+
struct DWOFile {
object::OwningBinary<object::ObjectFile> File;
std::unique_ptr<DWARFContext> Context;
@@ -97,7 +100,7 @@ class DWARFContext : public DIContext {
void parseDWOTypeUnits();
public:
- DWARFContext() : DIContext(CK_DWARF) {}
+ DWARFContext() : DIContext(CK_DWARF), MaxVersion(0) {}
DWARFContext(DWARFContext &) = delete;
DWARFContext &operator=(DWARFContext &) = delete;
@@ -178,6 +181,13 @@ public:
/// Get a DIE given an exact offset.
DWARFDie getDIEForOffset(uint32_t Offset);
+ unsigned getMaxVersion() const { return MaxVersion; }
+
+ void setMaxVersionIfGreater(unsigned Version) {
+ if (Version > MaxVersion)
+ MaxVersion = Version;
+ }
+
const DWARFUnitIndex &getCUIndex();
DWARFGdbIndex &getGdbIndex();
const DWARFUnitIndex &getTUIndex();
@@ -237,6 +247,11 @@ public:
virtual StringRef getGnuPubNamesSection() = 0;
virtual StringRef getGnuPubTypesSection() = 0;
+ /// DWARF v5
+ /// @{
+ virtual const DWARFSection &getStringOffsetSection() = 0;
+ /// @}
+
// Sections for DWARF5 split dwarf proposal.
virtual const DWARFSection &getInfoDWOSection() = 0;
virtual const TypeSectionMap &getTypesDWOSections() = 0;
@@ -244,7 +259,7 @@ public:
virtual const DWARFSection &getLineDWOSection() = 0;
virtual const DWARFSection &getLocDWOSection() = 0;
virtual StringRef getStringDWOSection() = 0;
- virtual StringRef getStringOffsetDWOSection() = 0;
+ virtual const DWARFSection &getStringOffsetDWOSection() = 0;
virtual const DWARFSection &getRangeDWOSection() = 0;
virtual const DWARFSection &getAddrSection() = 0;
virtual const DWARFSection& getAppleNamesSection() = 0;
@@ -295,6 +310,11 @@ class DWARFContextInMemory : public DWARFContext {
StringRef GnuPubNamesSection;
StringRef GnuPubTypesSection;
+ /// DWARF v5
+ /// @{
+ DWARFSection StringOffsetSection;
+ /// @}
+
// Sections for DWARF5 split dwarf proposal.
DWARFSection InfoDWOSection;
TypeSectionMap TypesDWOSections;
@@ -302,7 +322,7 @@ class DWARFContextInMemory : public DWARFContext {
DWARFSection LineDWOSection;
DWARFSection LocDWOSection;
StringRef StringDWOSection;
- StringRef StringOffsetDWOSection;
+ DWARFSection StringOffsetDWOSection;
DWARFSection RangeDWOSection;
DWARFSection AddrSection;
DWARFSection AppleNamesSection;
@@ -353,6 +373,11 @@ public:
const DWARFSection& getAppleNamespacesSection() override { return AppleNamespacesSection; }
const DWARFSection& getAppleObjCSection() override { return AppleObjCSection; }
+ // DWARF v5
+ const DWARFSection &getStringOffsetSection() override {
+ return StringOffsetSection;
+ }
+
// Sections for DWARF5 split dwarf proposal.
const DWARFSection &getInfoDWOSection() override { return InfoDWOSection; }
@@ -365,7 +390,7 @@ public:
const DWARFSection &getLocDWOSection() override { return LocDWOSection; }
StringRef getStringDWOSection() override { return StringDWOSection; }
- StringRef getStringOffsetDWOSection() override {
+ const DWARFSection &getStringOffsetDWOSection() override {
return StringOffsetDWOSection;
}
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h
index c77d946c070..2041d40eb53 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h
@@ -31,7 +31,7 @@ private:
public:
DWARFTypeUnit(DWARFContext &Context, const DWARFSection &Section,
const DWARFDebugAbbrev *DA, const DWARFSection *RS,
- StringRef SS, StringRef SOS, const DWARFSection *AOS,
+ StringRef SS, const DWARFSection &SOS, const DWARFSection *AOS,
StringRef LS, bool LE, bool IsDWO,
const DWARFUnitSectionBase &UnitSection,
const DWARFUnitIndex::Entry *Entry)
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
index d0f7bd0d623..e49496fcb67 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
@@ -57,8 +57,9 @@ protected:
virtual void parseImpl(DWARFContext &Context, const DWARFSection &Section,
const DWARFDebugAbbrev *DA, const DWARFSection *RS,
- StringRef SS, StringRef SOS, const DWARFSection *AOS,
- StringRef LS, bool isLittleEndian, bool isDWO) = 0;
+ StringRef SS, const DWARFSection &SOS,
+ const DWARFSection *AOS, StringRef LS,
+ bool isLittleEndian, bool isDWO) = 0;
};
const DWARFUnitIndex &getDWARFUnitIndex(DWARFContext &Context,
@@ -89,7 +90,7 @@ public:
private:
void parseImpl(DWARFContext &Context, const DWARFSection &Section,
const DWARFDebugAbbrev *DA, const DWARFSection *RS,
- StringRef SS, StringRef SOS, const DWARFSection *AOS,
+ StringRef SS, const DWARFSection &SOS, const DWARFSection *AOS,
StringRef LS, bool LE, bool IsDWO) override {
if (Parsed)
return;
@@ -119,7 +120,8 @@ class DWARFUnit {
uint32_t RangeSectionBase;
StringRef LineSection;
StringRef StringSection;
- StringRef StringOffsetSection;
+ const DWARFSection &StringOffsetSection;
+ uint64_t StringOffsetSectionBase = 0;
const DWARFSection *AddrOffsetSection;
uint32_t AddrOffsetSectionBase;
bool isLittleEndian;
@@ -162,8 +164,8 @@ protected:
public:
DWARFUnit(DWARFContext &Context, const DWARFSection &Section,
const DWARFDebugAbbrev *DA, const DWARFSection *RS, StringRef SS,
- StringRef SOS, const DWARFSection *AOS, StringRef LS, bool LE,
- bool IsDWO, const DWARFUnitSectionBase &UnitSection,
+ const DWARFSection &SOS, const DWARFSection *AOS, StringRef LS,
+ bool LE, bool IsDWO, const DWARFUnitSectionBase &UnitSection,
const DWARFUnitIndex::Entry *IndexEntry = nullptr);
virtual ~DWARFUnit();
@@ -172,7 +174,9 @@ public:
StringRef getLineSection() const { return LineSection; }
StringRef getStringSection() const { return StringSection; }
- StringRef getStringOffsetSection() const { return StringOffsetSection; }
+ const DWARFSection &getStringOffsetSection() const {
+ return StringOffsetSection;
+ }
void setAddrOffsetSection(const DWARFSection *AOS, uint32_t Base) {
AddrOffsetSection = AOS;
@@ -189,7 +193,8 @@ public:
bool getAddrOffsetSectionItem(uint32_t Index, uint64_t &Result) const;
// FIXME: Result should be uint64_t in DWARF64.
- bool getStringOffsetSectionItem(uint32_t Index, uint32_t &Result) const;
+ bool getStringOffsetSectionItem(uint32_t Index, uint64_t &Result) const;
+ uint64_t getStringOffsetSectionRelocation(uint32_t Index) const;
DataExtractor getDebugInfoExtractor() const {
return DataExtractor(InfoSection.Data, isLittleEndian, AddrSize);
@@ -200,6 +205,9 @@ public:
}
const RelocAddrMap *getRelocMap() const { return &InfoSection.Relocs; }
+ const RelocAddrMap &getStringOffsetsRelocMap() const {
+ return StringOffsetSection.Relocs;
+ }
bool extract(DataExtractor debug_info, uint32_t* offset_ptr);
diff --git a/llvm/include/llvm/MC/MCObjectFileInfo.h b/llvm/include/llvm/MC/MCObjectFileInfo.h
index 8b2a1261b22..4d634447987 100644
--- a/llvm/include/llvm/MC/MCObjectFileInfo.h
+++ b/llvm/include/llvm/MC/MCObjectFileInfo.h
@@ -109,6 +109,9 @@ protected:
MCSection *DwarfLineDWOSection;
MCSection *DwarfLocDWOSection;
MCSection *DwarfStrOffDWOSection;
+
+ /// The DWARF v5 string offset and address table sections.
+ MCSection *DwarfStrOffSection;
MCSection *DwarfAddrSection;
// These are for Fission DWP files.
@@ -260,6 +263,7 @@ public:
MCSection *getDwarfLineDWOSection() const { return DwarfLineDWOSection; }
MCSection *getDwarfLocDWOSection() const { return DwarfLocDWOSection; }
MCSection *getDwarfStrOffDWOSection() const { return DwarfStrOffDWOSection; }
+ MCSection *getDwarfStrOffSection() const { return DwarfStrOffSection; }
MCSection *getDwarfAddrSection() const { return DwarfAddrSection; }
MCSection *getDwarfCUIndexSection() const { return DwarfCUIndexSection; }
MCSection *getDwarfTUIndexSection() const { return DwarfTUIndexSection; }
diff --git a/llvm/include/llvm/Object/MachO.h b/llvm/include/llvm/Object/MachO.h
index a4356d5977b..1a24094b2e4 100644
--- a/llvm/include/llvm/Object/MachO.h
+++ b/llvm/include/llvm/Object/MachO.h
@@ -550,6 +550,8 @@ public:
bool isRelocatableObject() const override;
+ StringRef mapDebugSectionName(StringRef Name) const override;
+
bool hasPageZeroSegment() const { return HasPageZeroSegment; }
static bool classof(const Binary *v) {
diff --git a/llvm/include/llvm/Object/ObjectFile.h b/llvm/include/llvm/Object/ObjectFile.h
index ea6a9049bc1..2a20eaa696d 100644
--- a/llvm/include/llvm/Object/ObjectFile.h
+++ b/llvm/include/llvm/Object/ObjectFile.h
@@ -292,6 +292,9 @@ public:
return std::error_code();
}
+ /// Maps a debug section name to a standard DWARF section name.
+ virtual StringRef mapDebugSectionName(StringRef Name) const { return Name; }
+
/// True if this is a relocatable object (.o/.obj).
virtual bool isRelocatableObject() const = 0;
OpenPOWER on IntegriCloud