forked from OSchip/llvm-project
[BOLT] Remove allow-section-relocations option
Summary: The option is not used. Remove all related code. (cherry picked from FBD20237859)
This commit is contained in:
parent
c7e012e145
commit
cb9c991dcb
|
@ -882,22 +882,19 @@ MCSymbol *BinaryContext::registerNameAtAddress(StringRef Name,
|
|||
}
|
||||
|
||||
const BinaryData *
|
||||
BinaryContext::getBinaryDataContainingAddressImpl(uint64_t Address,
|
||||
bool IncludeEnd) const {
|
||||
BinaryContext::getBinaryDataContainingAddressImpl(uint64_t Address) const {
|
||||
auto NI = BinaryDataMap.lower_bound(Address);
|
||||
auto End = BinaryDataMap.end();
|
||||
if ((NI != End && Address == NI->first && !IncludeEnd) ||
|
||||
if ((NI != End && Address == NI->first) ||
|
||||
((NI != BinaryDataMap.begin()) && (NI-- != BinaryDataMap.begin()))) {
|
||||
if (NI->second->containsAddress(Address) ||
|
||||
(IncludeEnd && NI->second->getEndAddress() == Address)) {
|
||||
if (NI->second->containsAddress(Address)) {
|
||||
return NI->second;
|
||||
}
|
||||
|
||||
// If this is a sub-symbol, see if a parent data contains the address.
|
||||
auto *BD = NI->second->getParent();
|
||||
while (BD) {
|
||||
if (BD->containsAddress(Address) ||
|
||||
(IncludeEnd && NI->second->getEndAddress() == Address))
|
||||
if (BD->containsAddress(Address))
|
||||
return BD;
|
||||
BD = BD->getParent();
|
||||
}
|
||||
|
|
|
@ -270,8 +270,7 @@ public:
|
|||
/// Look up the symbol entry that contains the given \p Address (based on
|
||||
/// the start address and size for each symbol). Returns a pointer to
|
||||
/// the BinaryData for that symbol. If no data is found, nullptr is returned.
|
||||
const BinaryData *getBinaryDataContainingAddressImpl(uint64_t Address,
|
||||
bool IncludeEnd) const;
|
||||
const BinaryData *getBinaryDataContainingAddressImpl(uint64_t Address) const;
|
||||
|
||||
/// Update the Parent fields in BinaryDatas after adding a new entry into
|
||||
/// \p BinaryDataMap.
|
||||
|
@ -620,16 +619,13 @@ public:
|
|||
/// the start address and size for each symbol). Returns a pointer to
|
||||
/// the BinaryData for that symbol. If no data is found, nullptr is returned.
|
||||
const BinaryData *
|
||||
getBinaryDataContainingAddress(uint64_t Address,
|
||||
bool IncludeEnd = false) const {
|
||||
return getBinaryDataContainingAddressImpl(Address, IncludeEnd);
|
||||
getBinaryDataContainingAddress(uint64_t Address) const {
|
||||
return getBinaryDataContainingAddressImpl(Address);
|
||||
}
|
||||
|
||||
BinaryData *getBinaryDataContainingAddress(uint64_t Address,
|
||||
bool IncludeEnd = false) {
|
||||
BinaryData *getBinaryDataContainingAddress(uint64_t Address) {
|
||||
return
|
||||
const_cast<BinaryData *>(getBinaryDataContainingAddressImpl(Address,
|
||||
IncludeEnd));
|
||||
const_cast<BinaryData *>(getBinaryDataContainingAddressImpl(Address));
|
||||
}
|
||||
|
||||
/// Return BinaryData for the given \p Name or nullptr if no
|
||||
|
|
|
@ -122,16 +122,6 @@ ForceToDataRelocations("force-data-relocations",
|
|||
cl::ZeroOrMore,
|
||||
cl::cat(BoltCategory));
|
||||
|
||||
// Note: enabling this is liable to make things break.
|
||||
static cl::opt<bool>
|
||||
AllowSectionRelocations("allow-section-relocations",
|
||||
cl::desc("allow reordering of data referenced by section relocations "
|
||||
"(experimental)"),
|
||||
cl::init(false),
|
||||
cl::Hidden,
|
||||
cl::ZeroOrMore,
|
||||
cl::cat(BoltOptCategory));
|
||||
|
||||
static cl::opt<bool>
|
||||
PrintCacheMetrics("print-cache-metrics",
|
||||
cl::desc("calculate and print various metrics for instruction cache"),
|
||||
|
@ -2235,21 +2225,7 @@ void RewriteInstance::readRelocations(const SectionRef &Section) {
|
|||
Addend = 0;
|
||||
}
|
||||
|
||||
// If we are allowing section relocations, we assign relocations
|
||||
// that are pointing to the end of a symbol to that symbol rather
|
||||
// than the following symbol.
|
||||
const auto IncludeEnd =
|
||||
opts::AllowSectionRelocations && IsSectionRelocation;
|
||||
|
||||
if (auto *BD = BC->getBinaryDataContainingAddress(SymbolAddress,
|
||||
IncludeEnd)) {
|
||||
assert(!IncludeEnd ||
|
||||
(BD == BC->getBinaryDataContainingAddress(SymbolAddress) ||
|
||||
!BC->getBinaryDataContainingAddress(SymbolAddress) ||
|
||||
(IsSectionRelocation && BD->getEndAddress() ==
|
||||
BC->getBinaryDataContainingAddress(SymbolAddress)->
|
||||
getAddress())));
|
||||
|
||||
if (auto *BD = BC->getBinaryDataContainingAddress(SymbolAddress)) {
|
||||
// Note: this assertion is trying to check sanity of BinaryData objects
|
||||
// but AArch64 has inferred and incomplete object locations coming from
|
||||
// GOT/TLS or any other non-trivial relocation (that requires creation
|
||||
|
@ -2266,7 +2242,7 @@ void RewriteInstance::readRelocations(const SectionRef &Section) {
|
|||
"BOLT symbol names of all non-section relocations must match "
|
||||
"up with symbol names referenced in the relocation");
|
||||
|
||||
if (!opts::AllowSectionRelocations && IsSectionRelocation) {
|
||||
if (IsSectionRelocation) {
|
||||
BC->markAmbiguousRelocations(*BD, Address);
|
||||
}
|
||||
|
||||
|
@ -2310,7 +2286,7 @@ void RewriteInstance::readRelocations(const SectionRef &Section) {
|
|||
SymbolFlags);
|
||||
}
|
||||
|
||||
if (!opts::AllowSectionRelocations && IsSectionRelocation) {
|
||||
if (IsSectionRelocation) {
|
||||
auto *BD = BC->getBinaryDataByName(ReferencedSymbol->getName());
|
||||
BC->markAmbiguousRelocations(*BD, Address);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue