mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-26 22:26:16 +00:00
Correctly propagates st_size.
This also finally removes a bogus call to AliasedSymbol. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204883 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e6cee9f723
commit
e459f72ee0
@ -609,9 +609,6 @@ static const MCSymbol *getBaseSymbol(const MCAsmLayout &Layout,
|
||||
void ELFObjectWriter::WriteSymbol(SymbolTableWriter &Writer, ELFSymbolData &MSD,
|
||||
const MCAsmLayout &Layout) {
|
||||
MCSymbolData &OrigData = *MSD.SymbolData;
|
||||
MCSymbolData &Data =
|
||||
Layout.getAssembler().getSymbolData(OrigData.getSymbol().AliasedSymbol());
|
||||
|
||||
const MCSymbol *Base = getBaseSymbol(Layout, OrigData.getSymbol());
|
||||
|
||||
// This has to be in sync with when computeSymbolTable uses SHN_ABS or
|
||||
@ -621,9 +618,10 @@ void ELFObjectWriter::WriteSymbol(SymbolTableWriter &Writer, ELFSymbolData &MSD,
|
||||
// Binding and Type share the same byte as upper and lower nibbles
|
||||
uint8_t Binding = MCELF::GetBinding(OrigData);
|
||||
uint8_t Type = MCELF::GetType(OrigData);
|
||||
MCSymbolData *BaseSD = nullptr;
|
||||
if (Base) {
|
||||
MCSymbolData BaseSD = Layout.getAssembler().getSymbolData(*Base);
|
||||
Type = mergeTypeForSet(Type, MCELF::GetType(BaseSD));
|
||||
BaseSD = &Layout.getAssembler().getSymbolData(*Base);
|
||||
Type = mergeTypeForSet(Type, MCELF::GetType(*BaseSD));
|
||||
}
|
||||
if (OrigData.getFlags() & ELF_Other_ThumbFunc)
|
||||
Type = ELF::STT_FUNC;
|
||||
@ -640,9 +638,10 @@ void ELFObjectWriter::WriteSymbol(SymbolTableWriter &Writer, ELFSymbolData &MSD,
|
||||
Value |= 1;
|
||||
uint64_t Size = 0;
|
||||
|
||||
assert(!(Data.isCommon() && !Data.isExternal()));
|
||||
const MCExpr *ESize = OrigData.getSize();
|
||||
if (!ESize && Base)
|
||||
ESize = BaseSD->getSize();
|
||||
|
||||
const MCExpr *ESize = Data.getSize();
|
||||
if (ESize) {
|
||||
int64_t Res;
|
||||
if (!ESize->EvaluateAsAbsolute(Res, Layout))
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
.data
|
||||
.globl sym_a
|
||||
.size sym_a, 42
|
||||
.byte 42
|
||||
.type sym_a, @object
|
||||
sym_a:
|
||||
@ -12,7 +13,7 @@ sym_a:
|
||||
// CHECK: Symbol {
|
||||
// CHECK: Name: sym_a
|
||||
// CHECK-NEXT: Value: 0x1
|
||||
// CHECK-NEXT: Size: 0
|
||||
// CHECK-NEXT: Size: 42
|
||||
// CHECK-NEXT: Binding: Global
|
||||
// CHECK-NEXT: Type: Object
|
||||
// CHECK-NEXT: Other: 0
|
||||
@ -27,7 +28,7 @@ sym_c = sym_a
|
||||
// CHECK: Symbol {
|
||||
// CHECK: Name: sym_c
|
||||
// CHECK-NEXT: Value: 0x1
|
||||
// CHECK-NEXT: Size: 0
|
||||
// CHECK-NEXT: Size: 42
|
||||
// CHECK-NEXT: Binding: Global
|
||||
// CHECK-NEXT: Type: Object
|
||||
// CHECK-NEXT: Other: 0
|
||||
@ -39,7 +40,7 @@ sym_d = sym_a + 1
|
||||
// CHECK: Symbol {
|
||||
// CHECK: Name: sym_d
|
||||
// CHECK-NEXT: Value: 0x2
|
||||
// CHECK-NEXT: Size: 0
|
||||
// CHECK-NEXT: Size: 42
|
||||
// CHECK-NEXT: Binding: Global
|
||||
// CHECK-NEXT: Type: Object
|
||||
// CHECK-NEXT: Other: 0
|
||||
@ -51,7 +52,7 @@ sym_e = sym_a + (sym_b - sym_a) * 3
|
||||
// CHECK: Symbol {
|
||||
// CHECK: Name: sym_e
|
||||
// CHECK-NEXT: Value: 0xD
|
||||
// CHECK-NEXT: Size: 0
|
||||
// CHECK-NEXT: Size: 42
|
||||
// CHECK-NEXT: Binding: Global
|
||||
// CHECK-NEXT: Type: Object
|
||||
// CHECK-NEXT: Other: 0
|
||||
@ -64,7 +65,7 @@ sym_f = sym_a + (1 - 1)
|
||||
// CHECK: Symbol {
|
||||
// CHECK: Name: sym_f
|
||||
// CHECK-NEXT: Value: 0x1
|
||||
// CHECK-NEXT: Size: 0
|
||||
// CHECK-NEXT: Size: 42
|
||||
// CHECK-NEXT: Binding: Global
|
||||
// CHECK-NEXT: Type: Object
|
||||
// CHECK-NEXT: Other: 0
|
||||
|
Loading…
Reference in New Issue
Block a user