mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 12:19:53 +00:00
Fix and add tests for all cases in x86 and x86_64 where gnu as implicitly
sets the type of a symbol to STT_TLS. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120100 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5c7106b2e3
commit
bf8209daf8
@ -467,12 +467,20 @@ void MCELFStreamer::fixSymbolsInTLSFixups(const MCExpr *expr) {
|
||||
|
||||
case MCExpr::SymbolRef: {
|
||||
const MCSymbolRefExpr &symRef = *cast<MCSymbolRefExpr>(expr);
|
||||
MCSymbolRefExpr::VariantKind kind = symRef.getKind();
|
||||
if (kind != MCSymbolRefExpr::VK_TLSGD &&
|
||||
kind != MCSymbolRefExpr::VK_TLSLD &&
|
||||
kind != MCSymbolRefExpr::VK_TLSLDM &&
|
||||
kind != MCSymbolRefExpr::VK_ARM_TLSGD)
|
||||
switch (symRef.getKind()) {
|
||||
default:
|
||||
return;
|
||||
case MCSymbolRefExpr::VK_NTPOFF:
|
||||
case MCSymbolRefExpr::VK_GOTNTPOFF:
|
||||
case MCSymbolRefExpr::VK_TLSGD:
|
||||
case MCSymbolRefExpr::VK_TLSLDM:
|
||||
case MCSymbolRefExpr::VK_TPOFF:
|
||||
case MCSymbolRefExpr::VK_DTPOFF:
|
||||
case MCSymbolRefExpr::VK_GOTTPOFF:
|
||||
case MCSymbolRefExpr::VK_TLSLD:
|
||||
case MCSymbolRefExpr::VK_ARM_TLSGD:
|
||||
break;
|
||||
}
|
||||
MCSymbolData &SD = getAssembler().getOrCreateSymbolData(symRef.getSymbol());
|
||||
SetType(SD, ELF::STT_TLS);
|
||||
break;
|
||||
|
64
test/MC/ELF/tls-i386.s
Normal file
64
test/MC/ELF/tls-i386.s
Normal file
@ -0,0 +1,64 @@
|
||||
// RUN: llvm-mc -filetype=obj -triple i386-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
|
||||
|
||||
// Test that all symbols are of type STT_TLS.
|
||||
|
||||
movl foo1@NTPOFF(%eax), %eax
|
||||
movl foo2@GOTNTPOFF(%eax), %eax
|
||||
movl foo3@TLSGD(%eax), %eax
|
||||
movl foo4@TLSLDM(%eax), %eax
|
||||
movl foo5@TPOFF(%eax), %eax
|
||||
movl foo6@DTPOFF(%eax), %eax
|
||||
|
||||
// CHECK: (('st_name', 0x00000001) # 'foo1'
|
||||
// CHECK-NEXT: ('st_value', 0x00000000)
|
||||
// CHECK-NEXT: ('st_size', 0x00000000)
|
||||
// CHECK-NEXT: ('st_bind', 0x00000001)
|
||||
// CHECK-NEXT: ('st_type', 0x00000006)
|
||||
// CHECK-NEXT: ('st_other', 0x00000000)
|
||||
// CHECK-NEXT: ('st_shndx', 0x00000000)
|
||||
// CHECK-NEXT: ),
|
||||
// CHECK-NEXT: # Symbol 0x00000006
|
||||
// CHECK-NEXT: (('st_name', 0x00000006) # 'foo2'
|
||||
// CHECK-NEXT: ('st_value', 0x00000000)
|
||||
// CHECK-NEXT: ('st_size', 0x00000000)
|
||||
// CHECK-NEXT: ('st_bind', 0x00000001)
|
||||
// CHECK-NEXT: ('st_type', 0x00000006)
|
||||
// CHECK-NEXT: ('st_other', 0x00000000)
|
||||
// CHECK-NEXT: ('st_shndx', 0x00000000)
|
||||
// CHECK-NEXT: ),
|
||||
// CHECK-NEXT: # Symbol 0x00000007
|
||||
// CHECK-NEXT: (('st_name', 0x0000000b) # 'foo3'
|
||||
// CHECK-NEXT: ('st_value', 0x00000000)
|
||||
// CHECK-NEXT: ('st_size', 0x00000000)
|
||||
// CHECK-NEXT: ('st_bind', 0x00000001)
|
||||
// CHECK-NEXT: ('st_type', 0x00000006)
|
||||
// CHECK-NEXT: ('st_other', 0x00000000)
|
||||
// CHECK-NEXT: ('st_shndx', 0x00000000)
|
||||
// CHECK-NEXT: ),
|
||||
// CHECK-NEXT: # Symbol 0x00000008
|
||||
// CHECK-NEXT: (('st_name', 0x00000010) # 'foo4'
|
||||
// CHECK-NEXT: ('st_value', 0x00000000)
|
||||
// CHECK-NEXT: ('st_size', 0x00000000)
|
||||
// CHECK-NEXT: ('st_bind', 0x00000001)
|
||||
// CHECK-NEXT: ('st_type', 0x00000006)
|
||||
// CHECK-NEXT: ('st_other', 0x00000000)
|
||||
// CHECK-NEXT: ('st_shndx', 0x00000000)
|
||||
// CHECK-NEXT: ),
|
||||
// CHECK-NEXT: # Symbol 0x00000009
|
||||
// CHECK-NEXT: (('st_name', 0x00000015) # 'foo5'
|
||||
// CHECK-NEXT: ('st_value', 0x00000000)
|
||||
// CHECK-NEXT: ('st_size', 0x00000000)
|
||||
// CHECK-NEXT: ('st_bind', 0x00000001)
|
||||
// CHECK-NEXT: ('st_type', 0x00000006)
|
||||
// CHECK-NEXT: ('st_other', 0x00000000)
|
||||
// CHECK-NEXT: ('st_shndx', 0x00000000)
|
||||
// CHECK-NEXT: ),
|
||||
// CHECK-NEXT: # Symbol 0x0000000a
|
||||
// CHECK-NEXT: (('st_name', 0x0000001a) # 'foo6'
|
||||
// CHECK-NEXT: ('st_value', 0x00000000)
|
||||
// CHECK-NEXT: ('st_size', 0x00000000)
|
||||
// CHECK-NEXT: ('st_bind', 0x00000001)
|
||||
// CHECK-NEXT: ('st_type', 0x00000006)
|
||||
// CHECK-NEXT: ('st_other', 0x00000000)
|
||||
// CHECK-NEXT: ('st_shndx', 0x00000000)
|
||||
// CHECK-NEXT: ),
|
@ -1,14 +1,16 @@
|
||||
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
|
||||
|
||||
// Test that foo and foobar is of type STT_TLS.
|
||||
// Test that all symbols are of type STT_TLS.
|
||||
|
||||
leaq foo@TLSGD(%rip), %rdi
|
||||
leaq foo1@TLSGD(%rip), %rdi
|
||||
leaq foo2@GOTTPOFF(%rip), %rdi
|
||||
leaq foo3@TLSLD(%rip), %rdi
|
||||
|
||||
.section .zed,"awT",@progbits
|
||||
foobar:
|
||||
.long 43
|
||||
|
||||
// CHECK: (('st_name', 0x00000005) # 'foobar'
|
||||
// CHECK: (('st_name', 0x00000010) # 'foobar'
|
||||
// CHECK-NEXT: ('st_bind', 0x00000000)
|
||||
// CHECK-NEXT: ('st_type', 0x00000006)
|
||||
// CHECK-NEXT: ('st_other', 0x00000000)
|
||||
@ -17,11 +19,30 @@ foobar:
|
||||
// CHECK-NEXT: ('st_size', 0x00000000)
|
||||
// CHECK-NEXT: ),
|
||||
|
||||
// CHECK: (('st_name', 0x00000001) # 'foo'
|
||||
// CHECK-NEXT: ('st_bind', 0x00000001)
|
||||
// CHECK-NEXT: ('st_type', 0x00000006)
|
||||
// CHECK-NEXT: ('st_other', 0x00000000)
|
||||
// CHECK-NEXT: ('st_shndx', 0x00000000)
|
||||
// CHECK-NEXT: ('st_value', 0x00000000)
|
||||
// CHECK-NEXT: ('st_size', 0x00000000)
|
||||
// CHECK-NEXT: ),
|
||||
// CHECK: # Symbol 0x00000007
|
||||
// CHECK-NEXT: (('st_name', 0x00000001) # 'foo1'
|
||||
// CHECK-NEXT: ('st_bind', 0x00000001)
|
||||
// CHECK-NEXT: ('st_type', 0x00000006)
|
||||
// CHECK-NEXT: ('st_other', 0x00000000)
|
||||
// CHECK-NEXT: ('st_shndx', 0x00000000)
|
||||
// CHECK-NEXT: ('st_value', 0x00000000)
|
||||
// CHECK-NEXT: ('st_size', 0x00000000)
|
||||
// CHECK-NEXT: ),
|
||||
// CHECK-NEXT: # Symbol 0x00000008
|
||||
// CHECK-NEXT: (('st_name', 0x00000006) # 'foo2'
|
||||
// CHECK-NEXT: ('st_bind', 0x00000001)
|
||||
// CHECK-NEXT: ('st_type', 0x00000006)
|
||||
// CHECK-NEXT: ('st_other', 0x00000000)
|
||||
// CHECK-NEXT: ('st_shndx', 0x00000000)
|
||||
// CHECK-NEXT: ('st_value', 0x00000000)
|
||||
// CHECK-NEXT: ('st_size', 0x00000000)
|
||||
// CHECK-NEXT: ),
|
||||
// CHECK-NEXT: # Symbol 0x00000009
|
||||
// CHECK-NEXT: (('st_name', 0x0000000b) # 'foo3'
|
||||
// CHECK-NEXT: ('st_bind', 0x00000001)
|
||||
// CHECK-NEXT: ('st_type', 0x00000006)
|
||||
// CHECK-NEXT: ('st_other', 0x00000000)
|
||||
// CHECK-NEXT: ('st_shndx', 0x00000000)
|
||||
// CHECK-NEXT: ('st_value', 0x00000000)
|
||||
// CHECK-NEXT: ('st_size', 0x00000000)
|
||||
// CHECK-NEXT: ),
|
||||
|
Loading…
Reference in New Issue
Block a user