OLD | NEW |
1 ; Test of global initializers. | 1 ; Test of global initializers. |
2 | 2 |
3 ; REQUIRES: allow_dump | 3 ; REQUIRES: allow_dump |
4 | 4 |
5 ; Test -filetype=asm to test the lea "hack" until we are fully confident | 5 ; Test -filetype=asm to test the lea "hack" until we are fully confident |
6 ; in -filetype=iasm . | 6 ; in -filetype=iasm . |
7 ; RUN: %p2i -i %s --args --verbose none -filetype=asm | FileCheck %s | 7 ; RUN: %p2i -i %s --args --verbose none -filetype=asm | FileCheck %s |
8 | 8 |
9 ; Test -filetype=iasm and try to cross reference instructions w/ the | 9 ; Test -filetype=iasm and try to cross reference instructions w/ the |
10 ; symbol table. | 10 ; symbol table. |
11 ; RUN: %p2i -i %s --args --verbose none \ | 11 ; RUN: %p2i --assemble --disassemble -i %s --args --verbose none \ |
12 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj \ | |
13 ; RUN: | llvm-objdump -d -r --symbolize -x86-asm-syntax=intel - \ | |
14 ; RUN: | FileCheck --check-prefix=IAS %s | 12 ; RUN: | FileCheck --check-prefix=IAS %s |
15 ; RUN: %p2i -i %s --args --verbose none \ | 13 ; RUN: %p2i --assemble --disassemble --dis-flags=-t -i %s --args \ |
16 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj \ | 14 ; RUN: --verbose none | FileCheck --check-prefix=SYMTAB %s |
17 ; RUN: | llvm-objdump -d -t --symbolize -x86-asm-syntax=intel - \ | |
18 ; RUN: | FileCheck --check-prefix=SYMTAB %s | |
19 | 15 |
20 @PrimitiveInit = internal global [4 x i8] c"\1B\00\00\00", align 4 | 16 @PrimitiveInit = internal global [4 x i8] c"\1B\00\00\00", align 4 |
21 ; CHECK: .type PrimitiveInit,@object | 17 ; CHECK: .type PrimitiveInit,@object |
22 ; CHECK-NEXT: .section .data,"aw",@progbits | 18 ; CHECK-NEXT: .section .data,"aw",@progbits |
23 ; CHECK-NEXT: .align 4 | 19 ; CHECK-NEXT: .align 4 |
24 ; CHECK-NEXT: PrimitiveInit: | 20 ; CHECK-NEXT: PrimitiveInit: |
25 ; CHECK-NEXT: .byte | 21 ; CHECK-NEXT: .byte |
26 ; CHECK: .size PrimitiveInit, 4 | 22 ; CHECK: .size PrimitiveInit, 4 |
27 | 23 |
28 @PrimitiveInitConst = internal constant [4 x i8] c"\0D\00\00\00", align 4 | 24 @PrimitiveInitConst = internal constant [4 x i8] c"\0D\00\00\00", align 4 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } | 110 } |
115 ; CHECK-LABEL: main | 111 ; CHECK-LABEL: main |
116 ; CHECK: movl $PrimitiveInit, | 112 ; CHECK: movl $PrimitiveInit, |
117 ; CHECK: movl $PrimitiveInitConst, | 113 ; CHECK: movl $PrimitiveInitConst, |
118 ; CHECK: movl $PrimitiveInitStatic, | 114 ; CHECK: movl $PrimitiveInitStatic, |
119 ; CHECK: movl $PrimitiveUninit, | 115 ; CHECK: movl $PrimitiveUninit, |
120 ; CHECK: movl $ArrayInit, | 116 ; CHECK: movl $ArrayInit, |
121 ; CHECK: movl $ArrayInitPartial, | 117 ; CHECK: movl $ArrayInitPartial, |
122 ; CHECK: movl $ArrayUninit, | 118 ; CHECK: movl $ArrayUninit, |
123 | 119 |
124 ; llvm-objdump does not indicate what symbol the mov/relocation applies to | 120 ; objdump does not indicate what symbol the mov/relocation applies to |
125 ; so we grep for "mov {{.*}}, OFFSET", along with "OFFSET {{.*}} symbol" in | 121 ; so we grep for "mov {{.*}}, OFFSET, sec", along with |
126 ; the symbol table as a sanity check. NOTE: The symbol table sorting has no | 122 ; "OFFSET {{.*}} sec {{.*}} symbol" in the symbol table as a sanity check. |
127 ; relation to the code's references. | 123 ; NOTE: The symbol table sorting has no relation to the code's references. |
128 ; IAS-LABEL: main | 124 ; IAS-LABEL: main |
129 ; SYMTAB-LABEL: SYMBOL TABLE | 125 ; SYMTAB-LABEL: SYMBOL TABLE |
130 | 126 |
131 ; SYMTAB-DAG: 00000000 {{.*}} .data {{.*}} PrimitiveInit | 127 ; SYMTAB-DAG: 00000000 {{.*}} .data {{.*}} PrimitiveInit |
132 ; IAS: mov {{.*}}, .data | 128 ; IAS: mov {{.*}},0x0 {{.*}} .data |
133 ; IAS-NEXT: R_386_32 | |
134 ; IAS: call | 129 ; IAS: call |
135 | 130 |
136 ; SYMTAB-DAG: 00000000 {{.*}} .rodata {{.*}} PrimitiveInitConst | 131 ; SYMTAB-DAG: 00000000 {{.*}} .rodata {{.*}} PrimitiveInitConst |
137 ; IAS: mov {{.*}}, .rodata | 132 ; IAS: mov {{.*}},0x0 {{.*}} .rodata |
138 ; IAS-NEXT: R_386_32 | |
139 ; IAS: call | 133 ; IAS: call |
140 | 134 |
141 ; SYMTAB-DAG: 00000000 {{.*}} .bss {{.*}} PrimitiveInitStatic | 135 ; SYMTAB-DAG: 00000000 {{.*}} .bss {{.*}} PrimitiveInitStatic |
142 ; IAS: mov {{.*}}, .bss | 136 ; IAS: mov {{.*}},0x0 {{.*}} .bss |
143 ; IAS-NEXT: R_386_32 | |
144 ; IAS: call | 137 ; IAS: call |
145 | 138 |
146 ; SYMTAB-DAG: 00000004 {{.*}} .bss {{.*}} PrimitiveUninit | 139 ; SYMTAB-DAG: 00000004 {{.*}} .bss {{.*}} PrimitiveUninit |
147 ; IAS: mov {{.*}}, .bss | 140 ; IAS: mov {{.*}},0x4 {{.*}} .bss |
148 ; IAS-NEXT: R_386_32 | |
149 ; IAS: call | 141 ; IAS: call |
150 | 142 |
151 ; SYMTAB-DAG: 00000004{{.*}}.data{{.*}}ArrayInit | 143 ; SYMTAB-DAG: 00000004{{.*}}.data{{.*}}ArrayInit |
152 ; IAS: mov {{.*}}, .data | 144 ; IAS: mov {{.*}},0x4 {{.*}} .data |
153 ; IAS-NEXT: R_386_32 | |
154 ; IAS: call | 145 ; IAS: call |
155 | 146 |
156 ; SYMTAB-DAG: 00000018 {{.*}} .data {{.*}} ArrayInitPartial | 147 ; SYMTAB-DAG: 00000018 {{.*}} .data {{.*}} ArrayInitPartial |
157 ; IAS: mov {{.*}}, .data | 148 ; IAS: mov {{.*}},0x18 {{.*}} .data |
158 ; IAS-NEXT: R_386_32 | |
159 ; IAS: call | 149 ; IAS: call |
160 | 150 |
161 ; SYMTAB-DAG: 00000008 {{.*}} .bss {{.*}} ArrayUninit | 151 ; SYMTAB-DAG: 00000008 {{.*}} .bss {{.*}} ArrayUninit |
162 ; IAS: mov {{.*}}, .bss | 152 ; IAS: mov {{.*}},0x8 {{.*}} .bss |
163 ; IAS-NEXT: R_386_32 | |
164 ; IAS: call | 153 ; IAS: call |
165 | 154 |
166 | 155 |
167 declare void @use(i32) | 156 declare void @use(i32) |
168 | 157 |
169 define internal i32 @nacl_tp_tdb_offset(i32 %__0) { | 158 define internal i32 @nacl_tp_tdb_offset(i32 %__0) { |
170 entry: | 159 entry: |
171 ret i32 0 | 160 ret i32 0 |
172 } | 161 } |
173 | 162 |
174 define internal i32 @nacl_tp_tls_offset(i32 %size) { | 163 define internal i32 @nacl_tp_tls_offset(i32 %size) { |
175 entry: | 164 entry: |
176 %result = sub i32 0, %size | 165 %result = sub i32 0, %size |
177 ret i32 %result | 166 ret i32 %result |
178 } | 167 } |
OLD | NEW |