• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: llvm-mc -triple=powerpc64-pc-linux -filetype=obj %s -o - | \
2// RUN: llvm-readobj -r - | FileCheck %s
3
4// Test correct relocation generation for thread-local storage using
5// the local dynamic model.
6
7	.file	"/home/espindola/llvm/llvm/test/CodeGen/PowerPC/tls-ld-obj.ll"
8	.text
9	.globl	main
10	.align	2
11	.type	main,@function
12	.section	.opd,"aw",@progbits
13main:                                   # @main
14	.align	3
15	.quad	.L.main
16	.quad	.TOC.@tocbase
17	.quad	0
18	.text
19.L.main:
20# %bb.0:                                # %entry
21	addis 3, 2, a@got@tlsld@ha
22	addi 3, 3, a@got@tlsld@l
23	li 4, 0
24	bl __tls_get_addr(a@tlsld)
25	nop
26	stw 4, -4(1)
27	addis 3, 3, a@dtprel@ha
28	addi 3, 3, a@dtprel@l
29	lwz 4, 0(3)
30	extsw 3, 4
31	blr
32	.long	0
33	.quad	0
34.Ltmp0:
35	.size	main, .Ltmp0-.L.main
36
37	.hidden	a                       # @a
38	.type	a,@object
39	.section	.tbss,"awT",@nobits
40	.globl	a
41	.align	2
42a:
43	.long	0                       # 0x0
44	.size	a, 4
45
46
47// Verify generation of R_PPC64_GOT_TLSLD16_HA, R_PPC64_GOT_TLSLD16_LO,
48// R_PPC64_TLSLD, R_PPC64_DTPREL16_HA, and R_PPC64_DTPREL16_LO for
49// accessing external variable a, and R_PPC64_REL24 for the call to
50// __tls_get_addr.
51//
52// CHECK: Relocations [
53// CHECK:   Section {{.*}} .rela.text {
54// CHECK:     0x{{[0-9,A-F]+}} R_PPC64_GOT_TLSLD16_HA a
55// CHECK:     0x{{[0-9,A-F]+}} R_PPC64_GOT_TLSLD16_LO a
56// CHECK:     0x{{[0-9,A-F]+}} R_PPC64_TLSLD          a
57// CHECK:     0x{{[0-9,A-F]+}} R_PPC64_REL24          __tls_get_addr
58// CHECK:     0x{{[0-9,A-F]+}} R_PPC64_DTPREL16_HA    a
59// CHECK:     0x{{[0-9,A-F]+}} R_PPC64_DTPREL16_LO    a
60// CHECK:   }
61// CHECK: ]
62