mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
[dsymutil] Set linked unit start offset early. NFC.
The start offset of a linked unit is known before starting to clone its DIEs. Handling DW_FORM_ref_addr attributes requires that this offset is set while cloning the unit. Split CompileUnit::computeOffsets() into setStartOffset() and computeNextUnitOffset() and call them repsectively before cloning the DIEs and right after. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231530 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -81,12 +81,13 @@ public:
|
|||||||
uint64_t getStartOffset() const { return StartOffset; }
|
uint64_t getStartOffset() const { return StartOffset; }
|
||||||
uint64_t getNextUnitOffset() const { return NextUnitOffset; }
|
uint64_t getNextUnitOffset() const { return NextUnitOffset; }
|
||||||
|
|
||||||
/// \brief Set the start and end offsets for this unit. Must be
|
void setStartOffset(uint64_t DebugInfoSize) { StartOffset = DebugInfoSize; }
|
||||||
/// called after the CU's DIEs have been cloned. The unit start
|
|
||||||
/// offset will be set to \p DebugInfoSize.
|
/// \brief Compute the end offset for this unit. Must be
|
||||||
|
/// called after the CU's DIEs have been cloned.
|
||||||
/// \returns the next unit offset (which is also the current
|
/// \returns the next unit offset (which is also the current
|
||||||
/// debug_info section size).
|
/// debug_info section size).
|
||||||
uint64_t computeOffsets(uint64_t DebugInfoSize);
|
uint64_t computeNextUnitOffset();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DWARFUnit &OrigUnit;
|
DWARFUnit &OrigUnit;
|
||||||
@@ -97,8 +98,7 @@ private:
|
|||||||
uint64_t NextUnitOffset;
|
uint64_t NextUnitOffset;
|
||||||
};
|
};
|
||||||
|
|
||||||
uint64_t CompileUnit::computeOffsets(uint64_t DebugInfoSize) {
|
uint64_t CompileUnit::computeNextUnitOffset() {
|
||||||
StartOffset = DebugInfoSize;
|
|
||||||
NextUnitOffset = StartOffset + 11 /* Header size */;
|
NextUnitOffset = StartOffset + 11 /* Header size */;
|
||||||
// The root DIE might be null, meaning that the Unit had nothing to
|
// The root DIE might be null, meaning that the Unit had nothing to
|
||||||
// contribute to the linked output. In that case, we will emit the
|
// contribute to the linked output. In that case, we will emit the
|
||||||
@@ -1307,10 +1307,11 @@ bool DwarfLinker::link(const DebugMap &Map) {
|
|||||||
if (!ValidRelocs.empty())
|
if (!ValidRelocs.empty())
|
||||||
for (auto &CurrentUnit : Units) {
|
for (auto &CurrentUnit : Units) {
|
||||||
const auto *InputDIE = CurrentUnit.getOrigUnit().getCompileUnitDIE();
|
const auto *InputDIE = CurrentUnit.getOrigUnit().getCompileUnitDIE();
|
||||||
|
CurrentUnit.setStartOffset(OutputDebugInfoSize);
|
||||||
DIE *OutputDIE =
|
DIE *OutputDIE =
|
||||||
cloneDIE(*InputDIE, CurrentUnit, 11 /* Unit Header size */);
|
cloneDIE(*InputDIE, CurrentUnit, 11 /* Unit Header size */);
|
||||||
CurrentUnit.setOutputUnitDIE(OutputDIE);
|
CurrentUnit.setOutputUnitDIE(OutputDIE);
|
||||||
OutputDebugInfoSize = CurrentUnit.computeOffsets(OutputDebugInfoSize);
|
OutputDebugInfoSize = CurrentUnit.computeNextUnitOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit all the compile unit's debug information.
|
// Emit all the compile unit's debug information.
|
||||||
|
Reference in New Issue
Block a user