public:
virtual ~AddressesMap();
- /// Returns true if represented addresses are from linked file.
- /// Returns false if represented addresses are from not-linked
- /// object file.
- virtual bool areRelocationsResolved() const = 0;
-
/// Checks that there are valid relocations against a .debug_info
/// section.
virtual bool hasValidRelocs() = 0;
- /// Checks that the specified DIE has a DW_AT_Location attribute
- /// that references into a live code section.
- ///
+ /// Checks that the specified variable \p DIE references live code section.
+ /// Allowed kind of input die: DW_TAG_variable, DW_TAG_constant.
/// \returns true and sets Info.InDebugMap if it is the case.
- virtual bool hasLiveMemoryLocation(const DWARFDie &DIE,
- CompileUnit::DIEInfo &Info) = 0;
+ virtual bool isLiveVariable(const DWARFDie &DIE,
+ CompileUnit::DIEInfo &Info) = 0;
- /// Checks that the specified DIE has a DW_AT_Low_pc attribute
- /// that references into a live code section.
- ///
+ /// Checks that the specified subprogram \p DIE references live code section.
+ /// Allowed kind of input die: DW_TAG_subprogram, DW_TAG_label.
/// \returns true and sets Info.InDebugMap if it is the case.
- virtual bool hasLiveAddressRange(const DWARFDie &DIE,
- CompileUnit::DIEInfo &Info) = 0;
+ virtual bool isLiveSubprogram(const DWARFDie &DIE,
+ CompileUnit::DIEInfo &Info) = 0;
/// Apply the valid relocations to the buffer \p Data, taking into
/// account that Data is at \p BaseOffset in the .debug_info section.
// if the variable has a valid relocation, so that the DIEInfo is filled.
// However, we don't want a static variable in a function to force us to keep
// the enclosing function, unless requested explicitly.
- const bool HasLiveMemoryLocation =
- RelocMgr.hasLiveMemoryLocation(DIE, MyInfo);
+ const bool HasLiveMemoryLocation = RelocMgr.isLiveVariable(DIE, MyInfo);
if (!HasLiveMemoryLocation || ((Flags & TF_InFunctionScope) &&
!LLVM_UNLIKELY(Options.KeepFunctionForStatic)))
return Flags;
return Flags;
assert(LowPc.hasValue() && "low_pc attribute is not an address.");
- if (!RelocMgr.hasLiveAddressRange(DIE, MyInfo))
+ if (!RelocMgr.isLiveSubprogram(DIE, MyInfo))
return Flags;
if (Options.Verbose) {
DWARFDataExtractor(DIECopy, Data.isLittleEndian(), Data.getAddressSize());
// Modify the copy with relocated addresses.
- if (ObjFile.Addresses->areRelocationsResolved() &&
- ObjFile.Addresses->applyValidRelocs(DIECopy, Offset,
+ if (ObjFile.Addresses->applyValidRelocs(DIECopy, Offset,
Data.isLittleEndian())) {
// If we applied relocations, we store the value of high_pc that was
// potentially stored in the input DIE. If high_pc is an address
return std::make_pair(Offset, End);
}
-bool DwarfLinkerForBinary::AddressManager::hasLiveMemoryLocation(
+bool DwarfLinkerForBinary::AddressManager::isLiveVariable(
const DWARFDie &DIE, CompileUnit::DIEInfo &MyInfo) {
const auto *Abbrev = DIE.getAbbreviationDeclarationPtr();
LocationEndOffset, MyInfo);
}
-bool DwarfLinkerForBinary::AddressManager::hasLiveAddressRange(
+bool DwarfLinkerForBinary::AddressManager::isLiveSubprogram(
const DWARFDie &DIE, CompileUnit::DIEInfo &MyInfo) {
const auto *Abbrev = DIE.getAbbreviationDeclarationPtr();
/// \returns whether any reloc has been applied.
bool DwarfLinkerForBinary::AddressManager::applyValidRelocs(
MutableArrayRef<char> Data, uint64_t BaseOffset, bool IsLittleEndian) {
- assert(areRelocationsResolved());
std::vector<ValidReloc> Relocs = getRelocations(
ValidDebugInfoRelocs, BaseOffset, BaseOffset + Data.size());
}
virtual ~AddressManager() override { clear(); }
- virtual bool areRelocationsResolved() const override { return true; }
-
bool hasValidRelocs() override {
return !ValidDebugInfoRelocs.empty() || !ValidDebugAddrRelocs.empty();
}
uint64_t StartOffset, uint64_t EndOffset,
CompileUnit::DIEInfo &Info);
- bool hasLiveMemoryLocation(const DWARFDie &DIE,
- CompileUnit::DIEInfo &Info) override;
- bool hasLiveAddressRange(const DWARFDie &DIE,
- CompileUnit::DIEInfo &Info) override;
+ bool isLiveVariable(const DWARFDie &DIE,
+ CompileUnit::DIEInfo &Info) override;
+ bool isLiveSubprogram(const DWARFDie &DIE,
+ CompileUnit::DIEInfo &Info) override;
bool applyValidRelocs(MutableArrayRef<char> Data, uint64_t BaseOffset,
bool IsLittleEndian) override;