diff options
author | Keno Fischer <kfischer@college.harvard.edu> | 2017-01-02 03:00:19 +0000 |
---|---|---|
committer | Keno Fischer <kfischer@college.harvard.edu> | 2017-01-02 03:00:19 +0000 |
commit | f7d84ee6ff35c6bfe950bbf451c3e84ef23c194f (patch) | |
tree | a0f906023142187e040db3b68eeb7a5a3f72a703 /llvm/lib/MC/WinCOFFStreamer.cpp | |
parent | efcfe860723bc611b555d8d1db8c75405807b367 (diff) | |
download | bcm5719-llvm-f7d84ee6ff35c6bfe950bbf451c3e84ef23c194f.tar.gz bcm5719-llvm-f7d84ee6ff35c6bfe950bbf451c3e84ef23c194f.zip |
Reapply "[CodeGen] Fix invalid DWARF info on Win64"
This reapplies rL289013 (reverted in rL289014) with the fixes identified
in D21731. Should hopefully pass the buildbots this time.
llvm-svn: 290809
Diffstat (limited to 'llvm/lib/MC/WinCOFFStreamer.cpp')
-rw-r--r-- | llvm/lib/MC/WinCOFFStreamer.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/llvm/lib/MC/WinCOFFStreamer.cpp b/llvm/lib/MC/WinCOFFStreamer.cpp index 5c6407ef1e5..6383d879403 100644 --- a/llvm/lib/MC/WinCOFFStreamer.cpp +++ b/llvm/lib/MC/WinCOFFStreamer.cpp @@ -195,11 +195,20 @@ void MCWinCOFFStreamer::EmitCOFFSectionIndex(MCSymbol const *Symbol) { DF->getContents().resize(DF->getContents().size() + 2, 0); } -void MCWinCOFFStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) { +void MCWinCOFFStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol, + uint64_t Offset) { MCDataFragment *DF = getOrCreateDataFragment(); - const MCSymbolRefExpr *SRE = MCSymbolRefExpr::create(Symbol, getContext()); - MCFixup Fixup = MCFixup::create(DF->getContents().size(), SRE, FK_SecRel_4); + // Create Symbol A for the relocation relative reference. + const MCExpr *MCE = MCSymbolRefExpr::create(Symbol, getContext()); + // Add the constant offset, if given. + if (Offset) + MCE = MCBinaryExpr::createAdd( + MCE, MCConstantExpr::create(Offset, getContext()), getContext()); + // Build the secrel32 relocation. + MCFixup Fixup = MCFixup::create(DF->getContents().size(), MCE, FK_SecRel_4); + // Record the relocation. DF->getFixups().push_back(Fixup); + // Emit 4 bytes (zeros) to the object file. DF->getContents().resize(DF->getContents().size() + 4, 0); } |