1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

Consider the base pointer for setting the symbol type.

This is really a consistency fix. Since given

a = b

we propagate the information, we should propagate it too given

a = b + (1 - 1)

Fixes pr19145.

llvm-svn: 204028
This commit is contained in:
Rafael Espindola 2014-03-17 04:29:51 +00:00
parent 616f0545ea
commit 9e9323ec74
2 changed files with 21 additions and 6 deletions

View File

@ -580,8 +580,9 @@ void ELFObjectWriter::WriteSymbol(MCDataFragment *SymtabF,
ELFSymbolData &MSD,
const MCAsmLayout &Layout) {
MCSymbolData &OrigData = *MSD.SymbolData;
MCSymbolData &Data =
Layout.getAssembler().getSymbolData(OrigData.getSymbol().AliasedSymbol());
const MCSymbol *Base = OrigData.getSymbol().getBaseSymbol(Layout);
const MCSymbolData &Data =
Base ? Layout.getAssembler().getSymbolData(*Base) : OrigData;
bool IsReserved = Data.isCommon() || Data.getSymbol().isAbsolute() ||
Data.getSymbol().isVariable();

View File

@ -6,6 +6,7 @@
.data
.globl sym_a
.byte 42
.type sym_a, @object
sym_a:
// CHECK: Symbol {
@ -13,7 +14,7 @@ sym_a:
// CHECK-NEXT: Value: 0x1
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .data
// CHECK-NEXT: }
@ -28,7 +29,7 @@ sym_c = sym_a
// CHECK-NEXT: Value: 0x1
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .data
// CHECK-NEXT: }
@ -40,7 +41,7 @@ sym_d = sym_a + 1
// CHECK-NEXT: Value: 0x2
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .data
// CHECK-NEXT: }
@ -52,7 +53,20 @@ sym_e = sym_a + (sym_b - sym_a) * 3
// CHECK-NEXT: Value: 0xD
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .data
// CHECK-NEXT: }
.globl sym_f
sym_f = sym_a + (1 - 1)
// CHECK: Symbol {
// CHECK: Name: sym_f
// CHECK-NEXT: Value: 0x1
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .data
// CHECK-NEXT: }