Skip to content

Commit 129dfc8

Browse files
committed
Revert "[BOLT][NFC] Simplify addRelocation"
This reverts commit 29f2301. This change breaks one of the internal tests.
1 parent 06c02d5 commit 129dfc8

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

bolt/include/bolt/Core/BinarySection.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,16 @@ class BinarySection {
326326

327327
/// Add a new relocation at the given /p Offset.
328328
void addRelocation(uint64_t Offset, MCSymbol *Symbol, uint64_t Type,
329-
uint64_t Addend, uint64_t Value = 0, bool Pending = false);
329+
uint64_t Addend, uint64_t Value = 0,
330+
bool Pending = false) {
331+
assert(Offset < getSize() && "offset not within section bounds");
332+
if (!Pending) {
333+
Relocations.emplace(Relocation{Offset, Symbol, Type, Addend, Value});
334+
} else {
335+
PendingRelocations.emplace_back(
336+
Relocation{Offset, Symbol, Type, Addend, Value});
337+
}
338+
}
330339

331340
/// Add a dynamic relocation at the given /p Offset.
332341
void addDynamicRelocation(uint64_t Offset, MCSymbol *Symbol, uint64_t Type,

bolt/lib/Core/BinarySection.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -176,20 +176,6 @@ BinarySection::~BinarySection() {
176176

177177
void BinarySection::clearRelocations() { clearList(Relocations); }
178178

179-
void BinarySection::addRelocation(uint64_t Offset, MCSymbol *Symbol,
180-
uint64_t Type, uint64_t Addend,
181-
uint64_t Value, bool Pending) {
182-
assert(Offset < getSize() && "offset not within section bounds");
183-
LLVM_DEBUG(dbgs() << formatv(
184-
"BOLT-DEBUG: addRelocation in {0}, @{1:x} against {2}\n",
185-
getName(), Offset, Symbol->getName()));
186-
Relocation R{Offset, Symbol, Type, Addend, Value};
187-
if (Pending)
188-
PendingRelocations.emplace_back(R);
189-
else
190-
Relocations.emplace(R);
191-
}
192-
193179
void BinarySection::print(raw_ostream &OS) const {
194180
OS << getName() << ", "
195181
<< "0x" << Twine::utohexstr(getAddress()) << ", " << getSize() << " (0x"

0 commit comments

Comments
 (0)