mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
COFF: Emit all MCSymbols rather than filtering out some of them
In particular, this means we emit non-external symbols defined to variables, such as aliases or absolute addresses. This is needed to implement /safeseh, and it appears there was some confusion about what symbols to emit previously. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190888 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -154,8 +154,6 @@ public:
|
|||||||
void MakeSymbolReal(COFFSymbol &S, size_t Index);
|
void MakeSymbolReal(COFFSymbol &S, size_t Index);
|
||||||
void MakeSectionReal(COFFSection &S, size_t Number);
|
void MakeSectionReal(COFFSection &S, size_t Number);
|
||||||
|
|
||||||
bool ExportSymbol(MCSymbolData const &SymbolData, MCAssembler &Asm);
|
|
||||||
|
|
||||||
bool IsPhysicalSection(COFFSection *S);
|
bool IsPhysicalSection(COFFSection *S);
|
||||||
|
|
||||||
// Entity writing methods.
|
// Entity writing methods.
|
||||||
@@ -496,18 +494,6 @@ void WinCOFFObjectWriter::MakeSymbolReal(COFFSymbol &S, size_t Index) {
|
|||||||
S.Index = Index;
|
S.Index = Index;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WinCOFFObjectWriter::ExportSymbol(MCSymbolData const &SymbolData,
|
|
||||||
MCAssembler &Asm) {
|
|
||||||
// This doesn't seem to be right. Strings referred to from the .data section
|
|
||||||
// need symbols so they can be linked to code in the .text section right?
|
|
||||||
|
|
||||||
// return Asm.isSymbolLinkerVisible (&SymbolData);
|
|
||||||
|
|
||||||
// For now, all non-variable symbols are exported,
|
|
||||||
// the linker will sort the rest out for us.
|
|
||||||
return SymbolData.isExternal() || !SymbolData.getSymbol().isVariable();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool WinCOFFObjectWriter::IsPhysicalSection(COFFSection *S) {
|
bool WinCOFFObjectWriter::IsPhysicalSection(COFFSection *S) {
|
||||||
return (S->Header.Characteristics
|
return (S->Header.Characteristics
|
||||||
& COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA) == 0;
|
& COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA) == 0;
|
||||||
@@ -609,11 +595,9 @@ void WinCOFFObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm,
|
|||||||
DefineSection(*i);
|
DefineSection(*i);
|
||||||
|
|
||||||
for (MCAssembler::const_symbol_iterator i = Asm.symbol_begin(),
|
for (MCAssembler::const_symbol_iterator i = Asm.symbol_begin(),
|
||||||
e = Asm.symbol_end(); i != e; i++) {
|
e = Asm.symbol_end();
|
||||||
if (ExportSymbol(*i, Asm)) {
|
i != e; i++)
|
||||||
DefineSymbol(*i, Asm);
|
DefineSymbol(*i, Asm);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinCOFFObjectWriter::RecordRelocation(const MCAssembler &Asm,
|
void WinCOFFObjectWriter::RecordRelocation(const MCAssembler &Asm,
|
||||||
|
@@ -45,6 +45,15 @@ weak_aliased_to_external = external2
|
|||||||
// CHECK-NEXT: AuxSymbolCount: 0
|
// CHECK-NEXT: AuxSymbolCount: 0
|
||||||
// CHECK-NEXT: }
|
// CHECK-NEXT: }
|
||||||
// CHECK-NEXT: Symbol {
|
// CHECK-NEXT: Symbol {
|
||||||
|
// CHECK-NEXT: Name: external_aliased_to_local
|
||||||
|
// CHECK-NEXT: Value: 0
|
||||||
|
// CHECK-NEXT: Section: .text (1)
|
||||||
|
// CHECK-NEXT: BaseType: Null (0x0)
|
||||||
|
// CHECK-NEXT: ComplexType: Null (0x0)
|
||||||
|
// CHECK-NEXT: StorageClass: Static (0x3)
|
||||||
|
// CHECK-NEXT: AuxSymbolCount: 0
|
||||||
|
// CHECK-NEXT: }
|
||||||
|
// CHECK-NEXT: Symbol {
|
||||||
// CHECK-NEXT: Name: global_aliased_to_external
|
// CHECK-NEXT: Name: global_aliased_to_external
|
||||||
// CHECK-NEXT: Value: 0
|
// CHECK-NEXT: Value: 0
|
||||||
// CHECK-NEXT: Section: (0)
|
// CHECK-NEXT: Section: (0)
|
||||||
@@ -89,7 +98,7 @@ weak_aliased_to_external = external2
|
|||||||
// CHECK-NEXT: StorageClass: WeakExternal (0x69)
|
// CHECK-NEXT: StorageClass: WeakExternal (0x69)
|
||||||
// CHECK-NEXT: AuxSymbolCount: 1
|
// CHECK-NEXT: AuxSymbolCount: 1
|
||||||
// CHECK-NEXT: AuxWeakExternal {
|
// CHECK-NEXT: AuxWeakExternal {
|
||||||
// CHECK-NEXT: Linked: external2 (9)
|
// CHECK-NEXT: Linked: external2 (10)
|
||||||
// CHECK-NEXT: Search: Library (0x2)
|
// CHECK-NEXT: Search: Library (0x2)
|
||||||
// CHECK-NEXT: Unused: (00 00 00 00 00 00 00 00 00 00)
|
// CHECK-NEXT: Unused: (00 00 00 00 00 00 00 00 00 00)
|
||||||
// CHECK-NEXT: }
|
// CHECK-NEXT: }
|
||||||
|
Reference in New Issue
Block a user