mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-05 19:29:54 +00:00
Revert "COFF: Emit all MCSymbols rather than filtering out some of them"
This reverts commit r190888, to fix PR17967. The original change wasn't the right way to get @feat.00 into the object file. The right fix is to make @feat.00 be a global symbol. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195053 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
940267e7f2
commit
a7b7a7d629
@ -154,6 +154,8 @@ 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.
|
||||||
@ -503,6 +505,18 @@ 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;
|
||||||
@ -605,9 +619,12 @@ void WinCOFFObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm,
|
|||||||
|
|
||||||
for (MCAssembler::const_symbol_iterator i = Asm.symbol_begin(),
|
for (MCAssembler::const_symbol_iterator i = Asm.symbol_begin(),
|
||||||
e = Asm.symbol_end();
|
e = Asm.symbol_end();
|
||||||
i != e; i++)
|
i != e; i++) {
|
||||||
|
if (ExportSymbol(*i, Asm)) {
|
||||||
DefineSymbol(*i, Asm, Layout);
|
DefineSymbol(*i, Asm, Layout);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WinCOFFObjectWriter::RecordRelocation(const MCAssembler &Asm,
|
void WinCOFFObjectWriter::RecordRelocation(const MCAssembler &Asm,
|
||||||
const MCAsmLayout &Layout,
|
const MCAsmLayout &Layout,
|
||||||
|
@ -535,6 +535,7 @@ void X86AsmPrinter::EmitStartOfAsmFile(Module &M) {
|
|||||||
// cause the process to terminate immediately. LLVM does not know how to
|
// cause the process to terminate immediately. LLVM does not know how to
|
||||||
// register any SEH handlers, so its object files should be safe.
|
// register any SEH handlers, so its object files should be safe.
|
||||||
S->setAbsolute();
|
S->setAbsolute();
|
||||||
|
OutStreamer.EmitSymbolAttribute(S, MCSA_Global);
|
||||||
OutStreamer.EmitAssignment(
|
OutStreamer.EmitAssignment(
|
||||||
S, MCConstantExpr::Create(int64_t(1), MMI->getContext()));
|
S, MCConstantExpr::Create(int64_t(1), MMI->getContext()));
|
||||||
}
|
}
|
||||||
|
@ -45,15 +45,6 @@ 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)
|
||||||
@ -98,7 +89,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 (10)
|
// CHECK-NEXT: Linked: external2 (9)
|
||||||
// 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: }
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s -o - | llvm-readobj -t | FileCheck %s
|
// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s -o - | llvm-readobj -t | FileCheck %s
|
||||||
|
|
||||||
"@feat.00" = 123
|
"@feat.00" = 123
|
||||||
|
.globl @feat.00
|
||||||
|
|
||||||
// CHECK: Symbol {
|
// CHECK: Symbol {
|
||||||
// CHECK: Name: @feat.00
|
// CHECK: Name: @feat.00
|
||||||
|
12
test/MC/COFF/lset0.s
Executable file
12
test/MC/COFF/lset0.s
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s -o - | llvm-nm | FileCheck %s
|
||||||
|
|
||||||
|
not_global = 123
|
||||||
|
global = 456
|
||||||
|
.globl global
|
||||||
|
.Llocal = 789
|
||||||
|
|
||||||
|
// CHECK-NOT: not_global
|
||||||
|
// CHECK-NOT: Llocal
|
||||||
|
// CHECK: global
|
||||||
|
// CHECK-NOT: not_global
|
||||||
|
// CHECK-NOT: Llocal
|
Loading…
Reference in New Issue
Block a user