summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCWinCOFFStreamer.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-06-22 21:02:14 +0000
committerReid Kleckner <rnk@google.com>2017-06-22 21:02:14 +0000
commit40a47a870294cdc0bacb40d6a66e18781fd40d32 (patch)
treecb033e8e16f22d4a78a495b5d54076ca0d4d5ae9 /llvm/lib/MC/MCWinCOFFStreamer.cpp
parent9940203a2cffb678ee3c393dda03023bdf137646 (diff)
downloadbcm5719-llvm-40a47a870294cdc0bacb40d6a66e18781fd40d32.tar.gz
bcm5719-llvm-40a47a870294cdc0bacb40d6a66e18781fd40d32.zip
[MC] Allow assembling .secidx and .secrel32 for undefined symbols
There's nothing incorrect about emitting such relocations against symbols defined in other objects. The code in EmitCOFFSec* was missing the visitUsedExpr part of MCStreamer::EmitValueImpl, so these symbols were not being registered with the object file assembler. This will be used to make reduced test cases for LLD. llvm-svn: 306057
Diffstat (limited to 'llvm/lib/MC/MCWinCOFFStreamer.cpp')
-rw-r--r--llvm/lib/MC/MCWinCOFFStreamer.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCWinCOFFStreamer.cpp b/llvm/lib/MC/MCWinCOFFStreamer.cpp
index dc5c21190de..bf341bb1f45 100644
--- a/llvm/lib/MC/MCWinCOFFStreamer.cpp
+++ b/llvm/lib/MC/MCWinCOFFStreamer.cpp
@@ -190,7 +190,8 @@ void MCWinCOFFStreamer::EmitCOFFSafeSEH(MCSymbol const *Symbol) {
<< COFF::SCT_COMPLEX_TYPE_SHIFT);
}
-void MCWinCOFFStreamer::EmitCOFFSectionIndex(MCSymbol const *Symbol) {
+void MCWinCOFFStreamer::EmitCOFFSectionIndex(const MCSymbol *Symbol) {
+ visitUsedSymbol(*Symbol);
MCDataFragment *DF = getOrCreateDataFragment();
const MCSymbolRefExpr *SRE = MCSymbolRefExpr::create(Symbol, getContext());
MCFixup Fixup = MCFixup::create(DF->getContents().size(), SRE, FK_SecRel_2);
@@ -198,8 +199,9 @@ void MCWinCOFFStreamer::EmitCOFFSectionIndex(MCSymbol const *Symbol) {
DF->getContents().resize(DF->getContents().size() + 2, 0);
}
-void MCWinCOFFStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol,
+void MCWinCOFFStreamer::EmitCOFFSecRel32(const MCSymbol *Symbol,
uint64_t Offset) {
+ visitUsedSymbol(*Symbol);
MCDataFragment *DF = getOrCreateDataFragment();
// Create Symbol A for the relocation relative reference.
const MCExpr *MCE = MCSymbolRefExpr::create(Symbol, getContext());
OpenPOWER on IntegriCloud