[BOLT] Fix assertion when building test binary

Summary:
The binary had some unexpected ovelapping symbols:

.str.34.llvm.2944770977690351622/1 address = 0x48e9ec7, next address =
   0x48e9ed2, size = 21
PG.LC135/1 address = 0x48e9ed2, next address = 0x48e9eef, size = 29

BOLT wasn't expecting this type of overlap when generating HOLE symbols,
so it was asserting.  I've changed the code to deal with this case.

I'll need to change the reordering pass to mark these types of symbols
as unmoveable for now.

(cherry picked from FBD7304195)
This commit is contained in:
Bill Nell 2018-03-16 09:03:12 -07:00 committed by Maksim Panchenko
parent 598a346abf
commit faacdf6080
1 changed files with 2 additions and 3 deletions

View File

@ -364,9 +364,8 @@ void BinaryContext::fixBinaryDataHoles() {
uint64_t EndAddress = Section.getAddress();
while (Itr != End) {
auto Gap = Itr->second->getAddress() - EndAddress;
if (Gap > 0) {
assert(EndAddress < Itr->second->getAddress());
if (Itr->second->getAddress() > EndAddress) {
auto Gap = Itr->second->getAddress() - EndAddress;
Holes.push_back(std::make_pair(EndAddress, Gap));
}
EndAddress = Itr->second->getEndAddress();