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
5// using the initial-exec model and integrated assembly.
6
7	.file	"/home/espindola/llvm/llvm/test/CodeGen/PowerPC/tls-ie-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	li 3, 0
22	addis 4, 2, a@got@tprel@ha
23	ld 4, a@got@tprel@l(4)
24	add 4, 4, a@tls
25	stw 3, -4(1)
26	lwz 3, 0(4)
27	extsw 3, 3
28	blr
29	.long	0
30	.quad	0
31.Ltmp0:
32	.size	main, .Ltmp0-.L.main
33
34
35// Verify generation of R_PPC64_GOT_TPREL16_DS and R_PPC64_TLS for
36// accessing external variable a.
37//
38// CHECK: Relocations [
39// CHECK:   Section (2) .rela.text {
40// CHECK:     0x{{[0-9,A-F]+}} R_PPC64_GOT_TPREL16_HA    a
41// CHECK:     0x{{[0-9,A-F]+}} R_PPC64_GOT_TPREL16_LO_DS a
42// CHECK:     0x{{[0-9,A-F]+}} R_PPC64_TLS               a
43// CHECK:   }
44// CHECK: ]
45