mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-25 10:27:04 +00:00
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205811 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user