mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
Revert "[COFF] Make the autogenerated .weak.<name>.default symbols static"
This reverts commit 7ca86ee6494d4307333b300bae80e42df4a5140f. Apparently this change causes MS link.exe to error out with "LNK1235: corrupt or invalid COFF symbol table".
This commit is contained in:
parent
c86b4eb49f
commit
afd996b220
@ -352,10 +352,9 @@ COFFSymbol *WinCOFFObjectWriter::getLinkedSymbol(const MCSymbol &Symbol) {
|
||||
|
||||
/// This function takes a symbol data object from the assembler
|
||||
/// and creates the associated COFF symbol staging object.
|
||||
void WinCOFFObjectWriter::DefineSymbol(const MCSymbol &MCSymGeneric,
|
||||
void WinCOFFObjectWriter::DefineSymbol(const MCSymbol &MCSym,
|
||||
MCAssembler &Assembler,
|
||||
const MCAsmLayout &Layout) {
|
||||
const auto &MCSym = cast<MCSymbolCOFF>(MCSymGeneric);
|
||||
COFFSymbol *Sym = GetOrCreateCOFFSymbol(&MCSym);
|
||||
const MCSymbol *Base = Layout.getBaseSymbol(MCSym);
|
||||
COFFSection *Sec = nullptr;
|
||||
@ -366,7 +365,7 @@ void WinCOFFObjectWriter::DefineSymbol(const MCSymbol &MCSymGeneric,
|
||||
}
|
||||
|
||||
COFFSymbol *Local = nullptr;
|
||||
if (MCSym.isWeakExternal()) {
|
||||
if (cast<MCSymbolCOFF>(MCSym).isWeakExternal()) {
|
||||
Sym->Data.StorageClass = COFF::IMAGE_SYM_CLASS_WEAK_EXTERNAL;
|
||||
|
||||
COFFSymbol *WeakDefault = getLinkedSymbol(MCSym);
|
||||
@ -377,9 +376,6 @@ void WinCOFFObjectWriter::DefineSymbol(const MCSymbol &MCSymGeneric,
|
||||
WeakDefault->Data.SectionNumber = COFF::IMAGE_SYM_ABSOLUTE;
|
||||
else
|
||||
WeakDefault->Section = Sec;
|
||||
// Make the default symbol static, in order to not conflict with
|
||||
// similar default symbols for the same weak in other objects.
|
||||
WeakDefault->Data.StorageClass = COFF::IMAGE_SYM_CLASS_STATIC;
|
||||
Local = WeakDefault;
|
||||
}
|
||||
|
||||
@ -398,8 +394,14 @@ void WinCOFFObjectWriter::DefineSymbol(const MCSymbol &MCSymGeneric,
|
||||
else
|
||||
Sym->Section = Sec;
|
||||
Local = Sym;
|
||||
}
|
||||
|
||||
Local->Data.StorageClass = MCSym.getClass();
|
||||
if (Local) {
|
||||
Local->Data.Value = getSymbolValue(MCSym, Layout);
|
||||
|
||||
const MCSymbolCOFF &SymbolCOFF = cast<MCSymbolCOFF>(MCSym);
|
||||
Local->Data.Type = SymbolCOFF.getType();
|
||||
Local->Data.StorageClass = SymbolCOFF.getClass();
|
||||
|
||||
// If no storage class was specified in the streamer, define it here.
|
||||
if (Local->Data.StorageClass == COFF::IMAGE_SYM_CLASS_NULL) {
|
||||
@ -411,12 +413,6 @@ void WinCOFFObjectWriter::DefineSymbol(const MCSymbol &MCSymGeneric,
|
||||
}
|
||||
}
|
||||
|
||||
if (Local) {
|
||||
Local->Data.Value = getSymbolValue(MCSym, Layout);
|
||||
|
||||
Local->Data.Type = MCSym.getType();
|
||||
}
|
||||
|
||||
Sym->MC = &MCSym;
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,6 @@ a=b
|
||||
// CHECK-NEXT: Section: .data (2)
|
||||
// CHECK-NEXT: BaseType: Null (0x0)
|
||||
// CHECK-NEXT: ComplexType: Null (0x0)
|
||||
// CHECK-NEXT: StorageClass: Static (0x3)
|
||||
// CHECK-NEXT: StorageClass: External (0x2)
|
||||
// CHECK-NEXT: AuxSymbolCount: 0
|
||||
// CHECK-NEXT: }
|
||||
|
@ -28,6 +28,6 @@ b:
|
||||
// CHECK-NEXT: Section: .data (2)
|
||||
// CHECK-NEXT: BaseType: Null (0x0)
|
||||
// CHECK-NEXT: ComplexType: Null (0x0)
|
||||
// CHECK-NEXT: StorageClass: Static (0x3)
|
||||
// CHECK-NEXT: StorageClass: External (0x2)
|
||||
// CHECK-NEXT: AuxSymbolCount: 0
|
||||
// CHECK-NEXT: }
|
||||
|
@ -64,7 +64,7 @@ LBB0_2: # %return
|
||||
// CHECK-NEXT: Section: IMAGE_SYM_ABSOLUTE (-1)
|
||||
// CHECK-NEXT: BaseType: Null
|
||||
// CHECK-NEXT: ComplexType: Null
|
||||
// CHECK-NEXT: StorageClass: Static
|
||||
// CHECK-NEXT: StorageClass: External
|
||||
// CHECK-NEXT: AuxSymbolCount: 0
|
||||
// CHECK-NEXT: }
|
||||
|
||||
@ -88,6 +88,6 @@ LBB0_2: # %return
|
||||
// CHECK-NEXT: Section: .text
|
||||
// CHECK-NEXT: BaseType: Null
|
||||
// CHECK-NEXT: ComplexType: Null
|
||||
// CHECK-NEXT: StorageClass: Static
|
||||
// CHECK-NEXT: StorageClass: External
|
||||
// CHECK-NEXT: AuxSymbolCount: 0
|
||||
// CHECK-NEXT: }
|
||||
|
Loading…
Reference in New Issue
Block a user