mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-07 14:33:15 +00:00
Revert "[dsymutil] Gather function ranges during DIE selection."
This reverts commit r231957. IntervalMap currently doesn't support keys more aligned than host pointers and I've been using it with uint64_t keys. This asserts on some 32bits systems. Revert while I work on an IntervalMap generalization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231967 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a2b4e9a30e
commit
d5fb5250fc
@ -10,7 +10,6 @@
|
|||||||
#include "BinaryHolder.h"
|
#include "BinaryHolder.h"
|
||||||
#include "DebugMap.h"
|
#include "DebugMap.h"
|
||||||
#include "dsymutil.h"
|
#include "dsymutil.h"
|
||||||
#include "llvm/ADT/IntervalMap.h"
|
|
||||||
#include "llvm/ADT/StringMap.h"
|
#include "llvm/ADT/StringMap.h"
|
||||||
#include "llvm/ADT/STLExtras.h"
|
#include "llvm/ADT/STLExtras.h"
|
||||||
#include "llvm/CodeGen/AsmPrinter.h"
|
#include "llvm/CodeGen/AsmPrinter.h"
|
||||||
@ -50,11 +49,6 @@ bool error(const Twine &Error, const Twine &Context) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename KeyT, typename ValT>
|
|
||||||
using HalfOpenIntervalMap =
|
|
||||||
IntervalMap<KeyT, ValT, IntervalMapImpl::NodeSizer<KeyT, ValT>::LeafSize,
|
|
||||||
IntervalMapHalfOpenInfo<KeyT>>;
|
|
||||||
|
|
||||||
/// \brief Stores all information relating to a compile unit, be it in
|
/// \brief Stores all information relating to a compile unit, be it in
|
||||||
/// its original instance in the object file to its brand new cloned
|
/// its original instance in the object file to its brand new cloned
|
||||||
/// and linked DIE tree.
|
/// and linked DIE tree.
|
||||||
@ -69,19 +63,15 @@ public:
|
|||||||
bool InDebugMap; ///< Was this DIE's entity found in the map?
|
bool InDebugMap; ///< Was this DIE's entity found in the map?
|
||||||
};
|
};
|
||||||
|
|
||||||
CompileUnit(DWARFUnit &OrigUnit)
|
CompileUnit(DWARFUnit &OrigUnit) : OrigUnit(OrigUnit) {
|
||||||
: OrigUnit(OrigUnit), RangeAlloc(), Ranges(RangeAlloc) {
|
|
||||||
Info.resize(OrigUnit.getNumDIEs());
|
Info.resize(OrigUnit.getNumDIEs());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Workaround MSVC not supporting implicit move ops
|
||||||
CompileUnit(CompileUnit &&RHS)
|
CompileUnit(CompileUnit &&RHS)
|
||||||
: OrigUnit(RHS.OrigUnit), Info(std::move(RHS.Info)),
|
: OrigUnit(RHS.OrigUnit), Info(std::move(RHS.Info)),
|
||||||
CUDie(std::move(RHS.CUDie)), StartOffset(RHS.StartOffset),
|
CUDie(std::move(RHS.CUDie)), StartOffset(RHS.StartOffset),
|
||||||
NextUnitOffset(RHS.NextUnitOffset), RangeAlloc(), Ranges(RangeAlloc) {
|
NextUnitOffset(RHS.NextUnitOffset) {}
|
||||||
// The CompileUnit container has been 'reserve()'d with the right
|
|
||||||
// size. We cannot move the IntervalMap anyway.
|
|
||||||
llvm_unreachable("CompileUnits should not be moved.");
|
|
||||||
}
|
|
||||||
|
|
||||||
DWARFUnit &getOrigUnit() const { return OrigUnit; }
|
DWARFUnit &getOrigUnit() const { return OrigUnit; }
|
||||||
|
|
||||||
@ -110,10 +100,6 @@ public:
|
|||||||
/// \brief Apply all fixups recored by noteForwardReference().
|
/// \brief Apply all fixups recored by noteForwardReference().
|
||||||
void fixupForwardReferences();
|
void fixupForwardReferences();
|
||||||
|
|
||||||
/// \brief Add a function range [\p LowPC, \p HighPC) that is
|
|
||||||
/// relocatad by applying offset \p PCOffset.
|
|
||||||
void addFunctionRange(uint64_t LowPC, uint64_t HighPC, int64_t PCOffset);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DWARFUnit &OrigUnit;
|
DWARFUnit &OrigUnit;
|
||||||
std::vector<DIEInfo> Info; ///< DIE info indexed by DIE index.
|
std::vector<DIEInfo> Info; ///< DIE info indexed by DIE index.
|
||||||
@ -129,12 +115,6 @@ private:
|
|||||||
/// cloning because for forward refences the target DIE's offset isn't
|
/// cloning because for forward refences the target DIE's offset isn't
|
||||||
/// known you emit the reference attribute.
|
/// known you emit the reference attribute.
|
||||||
std::vector<std::pair<DIE *, DIEInteger *>> ForwardDIEReferences;
|
std::vector<std::pair<DIE *, DIEInteger *>> ForwardDIEReferences;
|
||||||
|
|
||||||
HalfOpenIntervalMap<uint64_t, int64_t>::Allocator RangeAlloc;
|
|
||||||
/// \brief The ranges in that interval map are the PC ranges for
|
|
||||||
/// functions in this unit, associated with the PC offset to apply
|
|
||||||
/// to the addresses to get the linked address.
|
|
||||||
HalfOpenIntervalMap<uint64_t, int64_t> Ranges;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
uint64_t CompileUnit::computeNextUnitOffset() {
|
uint64_t CompileUnit::computeNextUnitOffset() {
|
||||||
@ -158,11 +138,6 @@ void CompileUnit::fixupForwardReferences() {
|
|||||||
Ref.second->setValue(Ref.first->getOffset() + getStartOffset());
|
Ref.second->setValue(Ref.first->getOffset() + getStartOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompileUnit::addFunctionRange(uint64_t LowPC, uint64_t HighPC,
|
|
||||||
int64_t PCOffset) {
|
|
||||||
Ranges.insert(LowPC, HighPC, PCOffset);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// \brief A string table that doesn't need relocations.
|
/// \brief A string table that doesn't need relocations.
|
||||||
///
|
///
|
||||||
/// We are doing a final link, no need for a string table that
|
/// We are doing a final link, no need for a string table that
|
||||||
@ -969,25 +944,7 @@ unsigned DwarfLinker::shouldKeepSubprogramDIE(
|
|||||||
if (Options.Verbose)
|
if (Options.Verbose)
|
||||||
DIE.dump(outs(), const_cast<DWARFUnit *>(&OrigUnit), 0, 8 /* Indent */);
|
DIE.dump(outs(), const_cast<DWARFUnit *>(&OrigUnit), 0, 8 /* Indent */);
|
||||||
|
|
||||||
Flags |= TF_Keep;
|
return Flags | TF_Keep;
|
||||||
|
|
||||||
DWARFFormValue HighPcValue;
|
|
||||||
if (!DIE.getAttributeValue(&OrigUnit, dwarf::DW_AT_high_pc, HighPcValue)) {
|
|
||||||
reportWarning("Function without high_pc. Range will be discarded.\n",
|
|
||||||
&OrigUnit, &DIE);
|
|
||||||
return Flags;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t HighPc;
|
|
||||||
if (HighPcValue.isFormClass(DWARFFormValue::FC_Address)) {
|
|
||||||
HighPc = *HighPcValue.getAsAddress(&OrigUnit);
|
|
||||||
} else {
|
|
||||||
assert(HighPcValue.isFormClass(DWARFFormValue::FC_Constant));
|
|
||||||
HighPc = LowPc + *HighPcValue.getAsUnsignedConstant();
|
|
||||||
}
|
|
||||||
|
|
||||||
Unit.addFunctionRange(LowPc, HighPc, MyInfo.AddrAdjust);
|
|
||||||
return Flags;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Check if a DIE should be kept.
|
/// \brief Check if a DIE should be kept.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user