Produce a R_X86_64_32 when the value is >=0.
[oota-llvm.git] / test / MC / ELF / basic-elf.ll
1 ; RUN: llc -filetype=obj -mtriple i686-pc-linux-gnu %s -o - | elf-dump | FileCheck -check-prefix=32 %s
2 ; RUN: llc -filetype=obj -mtriple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck -check-prefix=64 %s
3
4 @.str1 = private constant [6 x i8] c"Hello\00"
5 @.str2 = private constant [7 x i8] c"World!\00"
6
7 define i32 @main() nounwind {
8   %1 = call i32 @puts(i8* getelementptr inbounds ([6 x i8]* @.str1, i32 0, i32 0))
9   %2 = call i32 @puts(i8* getelementptr inbounds ([7 x i8]* @.str2, i32 0, i32 0))
10   ret i32 0
11 }
12
13 declare i32 @puts(i8* nocapture) nounwind
14
15 ; 32: ('e_indent[EI_CLASS]', 1)
16 ; 32: ('e_indent[EI_DATA]', 1)
17 ; 32: ('e_indent[EI_VERSION]', 1)
18 ; 32: ('_sections', [
19 ; 32:   # Section 0
20 ; 32:   (('sh_name', 0) # ''
21
22 ; 32:   # '.text'
23 ; 32:   # '.rel.text'
24
25 ; 32:   ('_relocations', [
26 ; 32:     # Relocation 0
27 ; 32:     (('r_offset', 6)
28 ; 32:      ('r_type', 1)
29 ; 32:     ),
30 ; 32:     # Relocation 1
31 ; 32:     (('r_offset', 11)
32 ; 32:      ('r_type', 2)
33 ; 32:     ),
34 ; 32:     # Relocation 2
35 ; 32:     (('r_offset', 18)
36 ; 32:      ('r_type', 1)
37 ; 32:     ),
38 ; 32:     # Relocation 3
39 ; 32:     (('r_offset', 23)
40 ; 32:      ('r_type', 2)
41 ; 32:     ),
42 ; 32:   ])
43
44 ; 32: ('st_bind', 0)
45 ; 32: ('st_type', 3)
46
47 ; 32: ('st_bind', 0)
48 ; 32: ('st_type', 3)
49
50 ; 32: ('st_bind', 0)
51 ; 32: ('st_type', 3)
52
53 ; 32:   # 'main'
54 ; 32:   ('st_bind', 1)
55 ; 32-NEXT: ('st_type', 2)
56
57 ; 32:   # 'puts'
58 ; 32:   ('st_bind', 1)
59 ; 32-NEXT: ('st_type', 0)
60
61
62 ; 64: ('e_indent[EI_CLASS]', 2)
63 ; 64: ('e_indent[EI_DATA]', 1)
64 ; 64: ('e_indent[EI_VERSION]', 1)
65 ; 64: ('_sections', [
66 ; 64:   # Section 0
67 ; 64:   (('sh_name', 0) # ''
68
69 ; 64:   # '.text'
70 ; 64:   # '.rela.text'
71
72 ; 64:   ('_relocations', [
73 ; 64:     # Relocation 0
74 ; 64:     (('r_offset', 5)
75 ; 64:      ('r_type', 10)
76 ; 64:      ('r_addend', 0)
77 ; 64:     ),
78 ; 64:     # Relocation 1
79 ; 64:     (('r_offset', 10)
80 ; 64:      ('r_type', 2)
81 ; 64:      ('r_addend', -4)
82 ; 64:     ),
83 ; 64:     # Relocation 2
84 ; 64:     (('r_offset', 15)
85 ; 64:      ('r_type', 10)
86 ; 64:      ('r_addend', 6)
87 ; 64:     ),
88 ; 64:     # Relocation 3
89 ; 64:     (('r_offset', 20)
90 ; 64:      ('r_type', 2)
91 ; 64:      ('r_addend', -4)
92 ; 64:     ),
93 ; 64:   ])
94
95 ; 64: ('st_bind', 0)
96 ; 64: ('st_type', 3)
97
98 ; 64: ('st_bind', 0)
99 ; 64: ('st_type', 3)
100
101 ; 64: ('st_bind', 0)
102 ; 64: ('st_type', 3)
103
104 ; 64:   # 'main'
105 ; 64-NEXT: ('st_bind', 1)
106 ; 64-NEXT: ('st_type', 2)
107
108 ; 64:   # 'puts'
109 ; 64-NEXT: ('st_bind', 1)
110 ; 64-NEXT: ('st_type', 0)