diff options
author | Reid Kleckner <rnk@google.com> | 2016-02-04 00:21:42 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-02-04 00:21:42 +0000 |
commit | cb91e7d395d3f6995061d348717b717448c18503 (patch) | |
tree | 2f2579a785208b5a43765945107a076452d710ca /llvm/lib/MC/MCCodeView.cpp | |
parent | ce925c580e4171b62738e379a10d7241aaf2deca (diff) | |
download | bcm5719-llvm-cb91e7d395d3f6995061d348717b717448c18503.tar.gz bcm5719-llvm-cb91e7d395d3f6995061d348717b717448c18503.zip |
[codeview] Don't attempt a cross-section label diff
This only comes up when we're trying to find the next .cv_loc label.
Fixes PR26467
llvm-svn: 259733
Diffstat (limited to 'llvm/lib/MC/MCCodeView.cpp')
-rw-r--r-- | llvm/lib/MC/MCCodeView.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/llvm/lib/MC/MCCodeView.cpp b/llvm/lib/MC/MCCodeView.cpp index 81597f6c145..f50fdab8dfa 100644 --- a/llvm/lib/MC/MCCodeView.cpp +++ b/llvm/lib/MC/MCCodeView.cpp @@ -236,8 +236,8 @@ void CodeViewContext::emitInlineLineTableForFunction( SecondaryFunctionIds, OS.getCurrentSectionOnly()); } -unsigned computeLabelDiff(MCAsmLayout &Layout, const MCSymbol *Begin, - const MCSymbol *End) { +static unsigned computeLabelDiff(MCAsmLayout &Layout, const MCSymbol *Begin, + const MCSymbol *End) { MCContext &Ctx = Layout.getAssembler().getContext(); MCSymbolRefExpr::VariantKind Variant = MCSymbolRefExpr::VK_None; const MCExpr *BeginRef = MCSymbolRefExpr::create(Begin, Variant, Ctx), @@ -338,9 +338,15 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout, computeLabelDiff(Layout, LastLoc->getLabel(), Frag.getFnEndSym()); unsigned LocAfterLength = ~0U; ArrayRef<MCCVLineEntry> LocAfter = getLinesForExtent(LocEnd, LocEnd + 1); - if (!LocAfter.empty()) - LocAfterLength = - computeLabelDiff(Layout, LastLoc->getLabel(), LocAfter[0].getLabel()); + if (!LocAfter.empty()) { + // Only try to compute this difference if we're in the same section. + const MCCVLineEntry &Loc = LocAfter[0]; + if (&Loc.getLabel()->getSection(false) == + &LastLoc->getLabel()->getSection(false)) { + LocAfterLength = + computeLabelDiff(Layout, LastLoc->getLabel(), Loc.getLabel()); + } + } compressAnnotation(ChangeCodeLength, Buffer); compressAnnotation(std::min(EndSymLength, LocAfterLength), Buffer); |