Don't skip non-simple functions on function address ranges update.

Summary:
This fixes a problem in which bolt was generating a malformed .debug_info
section on the bzip2 binary. The bug was the following:

- A simple and a non-simple function shared an abbreviation
- The abbreviation was patched to contain DW_AT_ranges because of the simple function
- The non-simple function's data was not updated, but then it didn't match the
  layout expected by the abbreviation anymore

And because we were already creating an address ranges list in .debug_ranges even
for non-simple functions, it doesn't make sense not to use it anyway.

(cherry picked from FBD3129219)
This commit is contained in:
Gabriel Poesia 2016-04-01 15:09:34 -07:00 committed by Maksim Panchenko
parent ffa9641e16
commit 0a07d9bf88
1 changed files with 5 additions and 7 deletions

View File

@ -2038,15 +2038,13 @@ void RewriteInstance::updateDWARFAddressRanges() {
SectionPatchers[".debug_abbrev"] = llvm::make_unique<DebugAbbrevPatcher>();
SectionPatchers[".debug_info"] = llvm::make_unique<SimpleBinaryPatcher>();
// Update address ranges of simple functions.
// Update address ranges of functions.
for (const auto &BFI : BinaryFunctions) {
const auto &Function = BFI.second;
if (Function.isSimple()) {
updateDWARFObjectAddressRanges(
Function.getAddressRangesOffset() + DebugRangesSize,
Function.getSubprocedureDIECompileUnit(),
Function.getSubprocedureDIE());
}
updateDWARFObjectAddressRanges(
Function.getAddressRangesOffset() + DebugRangesSize,
Function.getSubprocedureDIECompileUnit(),
Function.getSubprocedureDIE());
}
// Update address ranges of lexical blocks.