summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/WinCOFFObjectWriter.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-04-08 22:33:40 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-04-08 22:33:40 +0000
commita9bdb32f045fefc4d750c941ed4dbd436475367a (patch)
treef6327019c8493746f65e2fd7e3d61347fe7469d7 /llvm/lib/MC/WinCOFFObjectWriter.cpp
parentc3b18967ed07d939e70564882806c9729f67637d (diff)
downloadbcm5719-llvm-a9bdb32f045fefc4d750c941ed4dbd436475367a.tar.gz
bcm5719-llvm-a9bdb32f045fefc4d750c941ed4dbd436475367a.zip
WinCOFF: Emit common symbols as specified in the COFF spec
Summary: Local common symbols were properly inserted into the .bss section. However, putting external common symbols in the .bss section would give them a strong definition. Instead, encode them as undefined, external symbols who's symbol value is equivalent to their size. Reviewers: Bigcheese, rafael, rnk CC: llvm-commits Differential Revision: http://reviews.llvm.org/D3324 llvm-svn: 205811
Diffstat (limited to 'llvm/lib/MC/WinCOFFObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/WinCOFFObjectWriter.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/MC/WinCOFFObjectWriter.cpp b/llvm/lib/MC/WinCOFFObjectWriter.cpp
index 500acd8f14e..f9426c61bde 100644
--- a/llvm/lib/MC/WinCOFFObjectWriter.cpp
+++ b/llvm/lib/MC/WinCOFFObjectWriter.cpp
@@ -394,7 +394,7 @@ void WinCOFFObjectWriter::DefineSection(MCSectionData const &SectionData) {
SectionMap[&SectionData.getSection()] = coff_section;
}
-/// This function takes a section data object from the assembler
+/// This function takes a symbol data object from the assembler
/// and creates the associated COFF symbol staging object.
void WinCOFFObjectWriter::DefineSymbol(MCSymbolData const &SymbolData,
MCAssembler &Assembler,
@@ -443,6 +443,8 @@ void WinCOFFObjectWriter::DefineSymbol(MCSymbolData const &SymbolData,
int64_t Addr;
if (Symbol.getVariableValue()->EvaluateAsAbsolute(Addr, Layout))
coff_symbol->Data.Value = Addr;
+ } else if (SymbolData.isExternal() && SymbolData.isCommon()) {
+ coff_symbol->Data.Value = SymbolData.getCommonSize();
}
coff_symbol->Data.Type = (ResSymData.getFlags() & 0x0000FFFF) >> 0;
OpenPOWER on IntegriCloud