Skip to content

Commit

Permalink
[BOLT] Do no map sections with zero address
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
maksfb committed Sep 14, 2020
1 parent 8c4ba8f commit 62469b5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bolt/src/BinaryContext.cpp
Expand Up @@ -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");
Expand Down

0 comments on commit 62469b5

Please sign in to comment.