mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 02:52:53 +02:00
[DebugInfo] Make offsets of dwarf units 64-bit (19/19).
In the case of LTO, several DWARF units can be emitted in one section. For an extremely large application, they may exceed the limit of 4GiB for 32-bit offsets. As it is now possible to emit 64-bit debugging info, the patch enables storing the larger offsets. Differential Revision: https://reviews.llvm.org/D87026
This commit is contained in:
parent
4b9083329d
commit
fc38e7e608
@ -788,7 +788,7 @@ public:
|
||||
|
||||
/// Get the absolute offset within the .debug_info or .debug_types section
|
||||
/// for this DIE.
|
||||
unsigned getDebugSectionOffset() const;
|
||||
uint64_t getDebugSectionOffset() const;
|
||||
|
||||
/// Compute the offset of this DIE and all its children.
|
||||
///
|
||||
@ -890,8 +890,8 @@ public:
|
||||
///
|
||||
/// \returns Section pointer which can be NULL.
|
||||
MCSection *getSection() const { return Section; }
|
||||
void setDebugSectionOffset(unsigned O) { Offset = O; }
|
||||
unsigned getDebugSectionOffset() const { return Offset; }
|
||||
void setDebugSectionOffset(uint64_t O) { Offset = O; }
|
||||
uint64_t getDebugSectionOffset() const { return Offset; }
|
||||
DIE &getUnitDie() { return Die; }
|
||||
const DIE &getUnitDie() const { return Die; }
|
||||
};
|
||||
|
@ -591,10 +591,14 @@ void llvm::emitDWARF5AccelTable(
|
||||
}
|
||||
|
||||
void AppleAccelTableOffsetData::emit(AsmPrinter *Asm) const {
|
||||
assert(Die.getDebugSectionOffset() <= UINT32_MAX &&
|
||||
"The section offset exceeds the limit.");
|
||||
Asm->emitInt32(Die.getDebugSectionOffset());
|
||||
}
|
||||
|
||||
void AppleAccelTableTypeData::emit(AsmPrinter *Asm) const {
|
||||
assert(Die.getDebugSectionOffset() <= UINT32_MAX &&
|
||||
"The section offset exceeds the limit.");
|
||||
Asm->emitInt32(Die.getDebugSectionOffset());
|
||||
Asm->emitInt16(Die.getTag());
|
||||
Asm->emitInt8(0);
|
||||
|
@ -194,7 +194,7 @@ DIEAbbrev DIE::generateAbbrev() const {
|
||||
return Abbrev;
|
||||
}
|
||||
|
||||
unsigned DIE::getDebugSectionOffset() const {
|
||||
uint64_t DIE::getDebugSectionOffset() const {
|
||||
const DIEUnit *Unit = getUnit();
|
||||
assert(Unit && "DIE must be owned by a DIEUnit to get its absolute offset");
|
||||
return Unit->getDebugSectionOffset() + getOffset();
|
||||
@ -662,7 +662,7 @@ void DIEEntry::emitValue(const AsmPrinter *AP, dwarf::Form Form) const {
|
||||
|
||||
case dwarf::DW_FORM_ref_addr: {
|
||||
// Get the absolute offset for this DIE within the debug info/types section.
|
||||
unsigned Addr = Entry->getDebugSectionOffset();
|
||||
uint64_t Addr = Entry->getDebugSectionOffset();
|
||||
if (const MCSymbol *SectionSym =
|
||||
Entry->getUnit()->getCrossSectionRelativeBaseAddress()) {
|
||||
AP->emitLabelPlusOffset(SectionSym, Addr, SizeOf(AP, Form), true);
|
||||
|
@ -59,7 +59,7 @@ void DwarfFile::emitUnit(DwarfUnit *TheU, bool UseOffsets) {
|
||||
// Compute the size and offset for each DIE.
|
||||
void DwarfFile::computeSizeAndOffsets() {
|
||||
// Offset from the first CU in the debug info section is 0 initially.
|
||||
unsigned SecOffset = 0;
|
||||
uint64_t SecOffset = 0;
|
||||
|
||||
// Iterate over each compile unit and set the size and offsets for each
|
||||
// DIE within each compile unit. All offsets are CU relative.
|
||||
@ -75,6 +75,9 @@ void DwarfFile::computeSizeAndOffsets() {
|
||||
TheU->setDebugSectionOffset(SecOffset);
|
||||
SecOffset += computeSizeAndOffsetsForUnit(TheU.get());
|
||||
}
|
||||
if (SecOffset > UINT32_MAX && !Asm->isDwarf64())
|
||||
report_fatal_error("The generated debug information is too large "
|
||||
"for the 32-bit DWARF format.");
|
||||
}
|
||||
|
||||
unsigned DwarfFile::computeSizeAndOffsetsForUnit(DwarfUnit *TheU) {
|
||||
|
@ -504,7 +504,7 @@ llvm::Error dwarfgen::Generator::init(Triple TheTriple, uint16_t V) {
|
||||
|
||||
StringRef dwarfgen::Generator::generate() {
|
||||
// Offset from the first CU in the debug info section is 0 initially.
|
||||
unsigned SecOffset = 0;
|
||||
uint64_t SecOffset = 0;
|
||||
|
||||
// Iterate over each compile unit and set the size and offsets for each
|
||||
// DIE within each compile unit. All offsets are CU relative.
|
||||
|
Loading…
Reference in New Issue
Block a user