blob: 9f33fee8ad35b3191e0e0f474c6cd8f7af42ebe8 [file] [log] [blame]
Bill Schmidt24b8dd62012-12-12 19:29:35 +00001; RUN: llc -mcpu=pwr7 -O0 -filetype=obj -relocation-model=pic %s -o - | \
2; RUN: elf-dump --dump-section-data | FileCheck %s
3
4; Test correct relocation generation for thread-local storage using
5; the local dynamic model.
6
Bill Schmidt25ffd192012-12-12 20:29:20 +00007; Relocations 2 and 3 seem to come out in unpredictable order on some
8; architectures, so restrict this for now.
9; REQUIRES: ppc64-registered-target
10
Bill Schmidt24b8dd62012-12-12 19:29:35 +000011target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
12target triple = "powerpc64-unknown-linux-gnu"
13
14@a = hidden thread_local global i32 0, align 4
15
16define signext i32 @main() nounwind {
17entry:
18 %retval = alloca i32, align 4
19 store i32 0, i32* %retval
20 %0 = load i32* @a, align 4
21 ret i32 %0
22}
23
Bill Schmidt25ffd192012-12-12 20:29:20 +000024; Verify generation of R_PPC64_GOT_TLSLD16_HA, R_PPC64_GOT_TLSLD16_LO,
25; R_PPC64_TLSLD, R_PPC64_DTPREL16_HA, and R_PPC64_DTPREL16_LO for
26; accessing external variable a, and R_PPC64_REL24 for the call to
27; __tls_get_addr.
Bill Schmidt24b8dd62012-12-12 19:29:35 +000028;
29; CHECK: '.rela.text'
30; CHECK: Relocation 0
31; CHECK-NEXT: 'r_offset'
32; CHECK-NEXT: 'r_sym', 0x[[SYM1:[0-9a-f]+]]
33; CHECK-NEXT: 'r_type', 0x00000056
34; CHECK: Relocation 1
35; CHECK-NEXT: 'r_offset'
36; CHECK-NEXT: 'r_sym', 0x[[SYM1]]
37; CHECK-NEXT: 'r_type', 0x00000054
38; CHECK: Relocation 2
39; CHECK-NEXT: 'r_offset'
40; CHECK-NEXT: 'r_sym', 0x[[SYM1]]
41; CHECK-NEXT: 'r_type', 0x0000006c
42; CHECK: Relocation 3
43; CHECK-NEXT: 'r_offset'
44; CHECK-NEXT: 'r_sym', 0x{{[0-9a-f]+}}
45; CHECK-NEXT: 'r_type', 0x0000000a
46; CHECK: Relocation 4
47; CHECK-NEXT: 'r_offset'
48; CHECK-NEXT: 'r_sym', 0x[[SYM1]]
49; CHECK-NEXT: 'r_type', 0x0000004d
50; CHECK: Relocation 5
51; CHECK-NEXT: 'r_offset'
52; CHECK-NEXT: 'r_sym', 0x[[SYM1]]
53; CHECK-NEXT: 'r_type', 0x0000004b
54