[BOLT] Do no map sections with zero address

Summary:
Sections that do not originate from the input binary will have an
input address set to zero and thus do not have to be mapped.

Mapping such sections caused a build time regression in non-relocation
mode.

(cherry picked from FBD23670334)
This commit is contained in:
Maksim Panchenko 2020-09-14 14:31:50 -07:00
parent 8c4ba8f165
commit 62469b5036
1 changed files with 1 additions and 1 deletions

View File

@ -1632,7 +1632,7 @@ BinarySection &BinaryContext::registerSection(BinarySection *Section) {
assert(Res.second && "can't register the same section twice.");
// Only register allocatable sections in the AddressToSection map.
if (Section->isAllocatable())
if (Section->isAllocatable() && Section->getAddress())
AddressToSection.insert(std::make_pair(Section->getAddress(), Section));
NameToSection.insert(std::make_pair(Section->getName(), Section));
DEBUG(dbgs() << "BOLT-DEBUG: registering " << *Section << "\n");