• 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 general dynamic model and integrated assembly.
6
7
8	.file	"/home/espindola/llvm/llvm/test/CodeGen/PowerPC/tls-gd-obj.ll"
9	.text
10	.globl	main
11	.align	2
12	.type	main,@function
13	.section	.opd,"aw",@progbits
14main:                                   # @main
15	.align	3
16	.quad	.L.main
17	.quad	.TOC.@tocbase
18	.quad	0
19	.text
20.L.main:
21# %bb.0:                                # %entry
22	addis 3, 2, a@got@tlsgd@ha
23	addi 3, 3, a@got@tlsgd@l
24	li 4, 0
25	bl __tls_get_addr(a@tlsgd)
26	nop
27	stw 4, -4(1)
28	lwz 4, 0(3)
29	extsw 3, 4
30	blr
31	.long	0
32	.quad	0
33.Ltmp0:
34	.size	main, .Ltmp0-.L.main
35
36	.type	a,@object               # @a
37	.section	.tbss,"awT",@nobits
38	.globl	a
39	.align	2
40a:
41	.long	0                       # 0x0
42	.size	a, 4
43
44
45// Verify generation of R_PPC64_GOT_TLSGD16_HA, R_PPC64_GOT_TLSGD16_LO,
46// and R_PPC64_TLSGD for accessing external variable a, and R_PPC64_REL24
47// for the call to __tls_get_addr.
48//
49// CHECK: Relocations [
50// CHECK:   Section {{.*}} .rela.text {
51// CHECK:     0x{{[0-9,A-F]+}} R_PPC64_GOT_TLSGD16_HA a
52// CHECK:     0x{{[0-9,A-F]+}} R_PPC64_GOT_TLSGD16_LO a
53// CHECK:     0x{{[0-9,A-F]+}} R_PPC64_TLSGD          a
54// CHECK:     0x{{[0-9,A-F]+}} R_PPC64_REL24          __tls_get_addr
55// CHECK:   }
56// CHECK: ]
57