[BOLT] Force non-relocation mode for heatmap generation

Summary: BOLT operates in relocation mode by default when .reloc is in the binary. This changes disables relocation mode for heatmap generation so we can use that for more cases. There's a small separate change that ignores zero-sized symbol in zero-sized code section during function discovery.

(cherry picked from FBD16009610)
This commit is contained in:
Wenlei He 2019-06-26 11:06:46 -07:00 committed by Maksim Panchenko
parent 0d23cbaa52
commit 459add2827
1 changed files with 11 additions and 0 deletions

View File

@ -1486,6 +1486,11 @@ void RewriteInstance::discoverFileObjects() {
BF->addAlternativeName(UniqueName);
} else {
auto Section = BC->getSectionForAddress(Address);
// Skip zero-size symbol in zero-size section
if (!Section && !SymbolSize)
continue;
assert(Section && "section for functions must be registered.");
BF = BC->createBinaryFunction(UniqueName, *Section, Address,
SymbolSize, IsSimple);
@ -1868,6 +1873,12 @@ void RewriteInstance::readSpecialSections() {
BC->HasRelocations = HasTextRelocations &&
(opts::RelocationMode != cl::BOU_FALSE);
// Force non-relocation mode for heatmap generation
if (opts::HeatmapMode) {
BC->HasRelocations = false;
}
if (BC->HasRelocations) {
outs() << "BOLT-INFO: enabling relocation mode\n";
}