From 62469b503671162a01f3c7343c804228e1759279 Mon Sep 17 00:00:00 2001 From: Maksim Panchenko Date: Mon, 14 Sep 2020 14:31:50 -0700 Subject: [PATCH] [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) --- bolt/src/BinaryContext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bolt/src/BinaryContext.cpp b/bolt/src/BinaryContext.cpp index d3cb2ead3c27..e9f2c1ee01b3 100644 --- a/bolt/src/BinaryContext.cpp +++ b/bolt/src/BinaryContext.cpp @@ -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");