| 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 initializers with -filetype=asm. |
| 6 ; in -filetype=iasm . | 6 ; RUN: %if --need=target_X8632 --command %p2i --filetype=asm --target x8632 \ |
| 7 ; RUN: %p2i -i %s --filetype=asm --args --verbose none | FileCheck %s | 7 ; RUN: -i %s --args -O2 | %if --need=target_X8632 --command FileCheck %s |
| 8 | 8 |
| 9 ; Test -filetype=iasm and try to cross reference instructions w/ the | 9 ; RUN: %if --need=target_ARM32 --command %p2i --filetype=asm --target arm32 \ |
| 10 ; symbol table. | 10 ; RUN: -i %s --args -O2 --skip-unimplemented \ |
| 11 ; RUN: %p2i --assemble --disassemble -i %s --args --verbose none \ | 11 ; RUN: | %if --need=target_ARM32 --command FileCheck %s |
| 12 ; RUN: | FileCheck --check-prefix=IAS %s | 12 |
| 13 ; RUN: %p2i --assemble --disassemble --dis-flags=-t -i %s --args \ | 13 ; Test instructions for materializing addresses. |
| 14 ; RUN: --verbose none | FileCheck --check-prefix=SYMTAB %s | 14 ; RUN: %if --need=target_X8632 --command %p2i --filetype=asm --target x8632 \ |
| 15 ; RUN: -i %s --args -O2 \ |
| 16 ; RUN: | %if --need=target_X8632 --command FileCheck %s --check-prefix=X8632 |
| 17 |
| 18 ; Test instructions with -filetype=obj and try to cross reference instructions |
| 19 ; w/ the symbol table. |
| 20 ; RUN: %if --need=target_X8632 --command %p2i --assemble --disassemble \ |
| 21 ; RUN: --target x8632 -i %s --args --verbose none \ |
| 22 ; RUN: | %if --need=target_X8632 --command FileCheck --check-prefix=IAS %s |
| 23 |
| 24 ; RUN: %if --need=target_X8632 --command %p2i --assemble --disassemble \ |
| 25 ; RUN: --dis-flags=-t --target x8632 -i %s --args --verbose none \ |
| 26 ; RUN: | %if --need=target_X8632 --command FileCheck --check-prefix=SYMTAB %s |
| 27 |
| 28 ; Only checking symtab for ARM for now. TODO(jvoung): Need to lower |
| 29 ; arguments at callsite. |
| 30 ; RUN: %if --need=target_ARM32 --command %p2i --filetype=asm --assemble \ |
| 31 ; RUN: --disassemble --dis-flags=-t --target arm32 -i %s \ |
| 32 ; RUN: --args --verbose none --skip-unimplemented \ |
| 33 ; RUN: | %if --need=target_ARM32 --command FileCheck --check-prefix=SYMTAB %s |
| 15 | 34 |
| 16 define internal i32 @main(i32 %argc, i32 %argv) { | 35 define internal i32 @main(i32 %argc, i32 %argv) { |
| 17 entry: | 36 entry: |
| 18 %expanded1 = ptrtoint [4 x i8]* @PrimitiveInit to i32 | 37 %expanded1 = ptrtoint [4 x i8]* @PrimitiveInit to i32 |
| 19 call void @use(i32 %expanded1) | 38 call void @use(i32 %expanded1) |
| 20 %expanded3 = ptrtoint [4 x i8]* @PrimitiveInitConst to i32 | 39 %expanded3 = ptrtoint [4 x i8]* @PrimitiveInitConst to i32 |
| 21 call void @use(i32 %expanded3) | 40 call void @use(i32 %expanded3) |
| 22 %expanded5 = ptrtoint [4 x i8]* @PrimitiveInitStatic to i32 | 41 %expanded5 = ptrtoint [4 x i8]* @PrimitiveInitStatic to i32 |
| 23 call void @use(i32 %expanded5) | 42 call void @use(i32 %expanded5) |
| 24 %expanded7 = ptrtoint [4 x i8]* @PrimitiveUninit to i32 | 43 %expanded7 = ptrtoint [4 x i8]* @PrimitiveUninit to i32 |
| 25 call void @use(i32 %expanded7) | 44 call void @use(i32 %expanded7) |
| 26 %expanded9 = ptrtoint [20 x i8]* @ArrayInit to i32 | 45 %expanded9 = ptrtoint [20 x i8]* @ArrayInit to i32 |
| 27 call void @use(i32 %expanded9) | 46 call void @use(i32 %expanded9) |
| 28 %expanded11 = ptrtoint [40 x i8]* @ArrayInitPartial to i32 | 47 %expanded11 = ptrtoint [40 x i8]* @ArrayInitPartial to i32 |
| 29 call void @use(i32 %expanded11) | 48 call void @use(i32 %expanded11) |
| 30 %expanded13 = ptrtoint [20 x i8]* @ArrayUninit to i32 | 49 %expanded13 = ptrtoint [20 x i8]* @ArrayUninit to i32 |
| 31 call void @use(i32 %expanded13) | 50 call void @use(i32 %expanded13) |
| 32 ret i32 0 | 51 ret i32 0 |
| 33 } | 52 } |
| 34 ; CHECK-LABEL: main | 53 ; X8632-LABEL: main |
| 35 ; CHECK: movl $PrimitiveInit, | 54 ; X8632: movl $PrimitiveInit, |
| 36 ; CHECK: movl $PrimitiveInitConst, | 55 ; X8632: movl $PrimitiveInitConst, |
| 37 ; CHECK: movl $PrimitiveInitStatic, | 56 ; X8632: movl $PrimitiveInitStatic, |
| 38 ; CHECK: movl $PrimitiveUninit, | 57 ; X8632: movl $PrimitiveUninit, |
| 39 ; CHECK: movl $ArrayInit, | 58 ; X8632: movl $ArrayInit, |
| 40 ; CHECK: movl $ArrayInitPartial, | 59 ; X8632: movl $ArrayInitPartial, |
| 41 ; CHECK: movl $ArrayUninit, | 60 ; X8632: movl $ArrayUninit, |
| 42 | 61 |
| 43 ; objdump does not indicate what symbol the mov/relocation applies to | 62 ; objdump does not indicate what symbol the mov/relocation applies to |
| 44 ; so we grep for "mov {{.*}}, OFFSET, sec", along with | 63 ; so we grep for "mov {{.*}}, OFFSET, sec", along with |
| 45 ; "OFFSET {{.*}} sec {{.*}} symbol" in the symbol table as a sanity check. | 64 ; "OFFSET {{.*}} sec {{.*}} symbol" in the symbol table as a sanity check. |
| 46 ; NOTE: The symbol table sorting has no relation to the code's references. | 65 ; NOTE: The symbol table sorting has no relation to the code's references. |
| 47 ; IAS-LABEL: main | 66 ; IAS-LABEL: main |
| 48 ; SYMTAB-LABEL: SYMBOL TABLE | 67 ; SYMTAB-LABEL: SYMBOL TABLE |
| 49 | 68 |
| 50 ; SYMTAB-DAG: 00000000 {{.*}} .data {{.*}} PrimitiveInit | 69 ; SYMTAB-DAG: 00000000 {{.*}} .data {{.*}} PrimitiveInit |
| 51 ; IAS: mov {{.*}},0x0 {{.*}} .data | 70 ; IAS: mov {{.*}},0x0 {{.*}} .data |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 } | 103 } |
| 85 | 104 |
| 86 define internal i32 @nacl_tp_tls_offset(i32 %size) { | 105 define internal i32 @nacl_tp_tls_offset(i32 %size) { |
| 87 entry: | 106 entry: |
| 88 %result = sub i32 0, %size | 107 %result = sub i32 0, %size |
| 89 ret i32 %result | 108 ret i32 %result |
| 90 } | 109 } |
| 91 | 110 |
| 92 | 111 |
| 93 @PrimitiveInit = internal global [4 x i8] c"\1B\00\00\00", align 4 | 112 @PrimitiveInit = internal global [4 x i8] c"\1B\00\00\00", align 4 |
| 94 ; CHECK: .type PrimitiveInit,@object | 113 ; CHECK: .type PrimitiveInit,%object |
| 95 ; CHECK-NEXT: .section .data,"aw",@progbits | 114 ; CHECK-NEXT: .section .data,"aw",%progbits |
| 96 ; CHECK-NEXT: .align 4 | 115 ; CHECK-NEXT: .p2align 2 |
| 97 ; CHECK-NEXT: PrimitiveInit: | 116 ; CHECK-NEXT: PrimitiveInit: |
| 98 ; CHECK-NEXT: .byte | 117 ; CHECK-NEXT: .byte |
| 99 ; CHECK: .size PrimitiveInit, 4 | 118 ; CHECK: .size PrimitiveInit, 4 |
| 100 | 119 |
| 101 @PrimitiveInitConst = internal constant [4 x i8] c"\0D\00\00\00", align 4 | 120 @PrimitiveInitConst = internal constant [4 x i8] c"\0D\00\00\00", align 4 |
| 102 ; CHECK: .type PrimitiveInitConst,@object | 121 ; CHECK: .type PrimitiveInitConst,%object |
| 103 ; CHECK-NEXT: .section .rodata,"a",@progbits | 122 ; CHECK-NEXT: .section .rodata,"a",%progbits |
| 104 ; CHECK-NEXT: .align 4 | 123 ; CHECK-NEXT: .p2align 2 |
| 105 ; CHECK-NEXT: PrimitiveInitConst: | 124 ; CHECK-NEXT: PrimitiveInitConst: |
| 106 ; CHECK-NEXT: .byte | 125 ; CHECK-NEXT: .byte |
| 107 ; CHECK: .size PrimitiveInitConst, 4 | 126 ; CHECK: .size PrimitiveInitConst, 4 |
| 108 | 127 |
| 109 @ArrayInit = internal global [20 x i8] c"\0A\00\00\00\14\00\00\00\1E\00\00\00(\0
0\00\002\00\00\00", align 4 | 128 @ArrayInit = internal global [20 x i8] c"\0A\00\00\00\14\00\00\00\1E\00\00\00(\0
0\00\002\00\00\00", align 4 |
| 110 ; CHECK: .type ArrayInit,@object | 129 ; CHECK: .type ArrayInit,%object |
| 111 ; CHECK-NEXT: .section .data,"aw",@progbits | 130 ; CHECK-NEXT: .section .data,"aw",%progbits |
| 112 ; CHECK-NEXT: .align 4 | 131 ; CHECK-NEXT: .p2align 2 |
| 113 ; CHECK-NEXT: ArrayInit: | 132 ; CHECK-NEXT: ArrayInit: |
| 114 ; CHECK-NEXT: .byte | 133 ; CHECK-NEXT: .byte |
| 115 ; CHECK: .size ArrayInit, 20 | 134 ; CHECK: .size ArrayInit, 20 |
| 116 | 135 |
| 117 @ArrayInitPartial = internal global [40 x i8] c"<\00\00\00F\00\00\00P\00\00\00Z\
00\00\00d\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00",
align 4 | 136 @ArrayInitPartial = internal global [40 x i8] c"<\00\00\00F\00\00\00P\00\00\00Z\
00\00\00d\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00",
align 4 |
| 118 ; CHECK: .type ArrayInitPartial,@object | 137 ; CHECK: .type ArrayInitPartial,%object |
| 119 ; CHECK-NEXT: .section .data,"aw",@progbits | 138 ; CHECK-NEXT: .section .data,"aw",%progbits |
| 120 ; CHECK-NEXT: .align 4 | 139 ; CHECK-NEXT: .p2align 2 |
| 121 ; CHECK-NEXT: ArrayInitPartial: | 140 ; CHECK-NEXT: ArrayInitPartial: |
| 122 ; CHECK-NEXT: .byte | 141 ; CHECK-NEXT: .byte |
| 123 ; CHECK: .size ArrayInitPartial, 40 | 142 ; CHECK: .size ArrayInitPartial, 40 |
| 124 | 143 |
| 125 @PrimitiveInitStatic = internal global [4 x i8] zeroinitializer, align 4 | 144 @PrimitiveInitStatic = internal global [4 x i8] zeroinitializer, align 4 |
| 126 ; CHECK: .type PrimitiveInitStatic,@object | 145 ; CHECK: .type PrimitiveInitStatic,%object |
| 127 ; CHECK-NEXT: .section .bss,"aw",@nobits | 146 ; CHECK-NEXT: .section .bss,"aw",%nobits |
| 128 ; CHECK-NEXT: .align 4 | 147 ; CHECK-NEXT: .p2align 2 |
| 129 ; CHECK-NEXT: PrimitiveInitStatic: | 148 ; CHECK-NEXT: PrimitiveInitStatic: |
| 130 ; CHECK-NEXT: .zero 4 | 149 ; CHECK-NEXT: .zero 4 |
| 131 ; CHECK-NEXT: .size PrimitiveInitStatic, 4 | 150 ; CHECK-NEXT: .size PrimitiveInitStatic, 4 |
| 132 | 151 |
| 133 @PrimitiveUninit = internal global [4 x i8] zeroinitializer, align 4 | 152 @PrimitiveUninit = internal global [4 x i8] zeroinitializer, align 4 |
| 134 ; CHECK: .type PrimitiveUninit,@object | 153 ; CHECK: .type PrimitiveUninit,%object |
| 135 ; CHECK-NEXT: .section .bss,"aw",@nobits | 154 ; CHECK-NEXT: .section .bss,"aw",%nobits |
| 136 ; CHECK-NEXT: .align 4 | 155 ; CHECK-NEXT: .p2align 2 |
| 137 ; CHECK-NEXT: PrimitiveUninit: | 156 ; CHECK-NEXT: PrimitiveUninit: |
| 138 ; CHECK-NEXT: .zero 4 | 157 ; CHECK-NEXT: .zero 4 |
| 139 ; CHECK-NEXT: .size PrimitiveUninit, 4 | 158 ; CHECK-NEXT: .size PrimitiveUninit, 4 |
| 140 | 159 |
| 141 @ArrayUninit = internal global [20 x i8] zeroinitializer, align 4 | 160 @ArrayUninit = internal global [20 x i8] zeroinitializer, align 4 |
| 142 ; CHECK: .type ArrayUninit,@object | 161 ; CHECK: .type ArrayUninit,%object |
| 143 ; CHECK-NEXT: .section .bss,"aw",@nobits | 162 ; CHECK-NEXT: .section .bss,"aw",%nobits |
| 144 ; CHECK-NEXT: .align 4 | 163 ; CHECK-NEXT: .p2align 2 |
| 145 ; CHECK-NEXT: ArrayUninit: | 164 ; CHECK-NEXT: ArrayUninit: |
| 146 ; CHECK-NEXT: .zero 20 | 165 ; CHECK-NEXT: .zero 20 |
| 147 ; CHECK-NEXT: .size ArrayUninit, 20 | 166 ; CHECK-NEXT: .size ArrayUninit, 20 |
| 148 | 167 |
| 149 @ArrayUninitConstDouble = internal constant [200 x i8] zeroinitializer, align 8 | 168 @ArrayUninitConstDouble = internal constant [200 x i8] zeroinitializer, align 8 |
| 150 ; CHECK: .type ArrayUninitConstDouble,@object | 169 ; CHECK: .type ArrayUninitConstDouble,%object |
| 151 ; CHECK-NEXT: .section .rodata,"a",@progbits | 170 ; CHECK-NEXT: .section .rodata,"a",%progbits |
| 152 ; CHECK-NEXT: .align 8 | 171 ; CHECK-NEXT: .p2align 3 |
| 153 ; CHECK-NEXT: ArrayUninitConstDouble: | 172 ; CHECK-NEXT: ArrayUninitConstDouble: |
| 154 ; CHECK-NEXT: .zero 200 | 173 ; CHECK-NEXT: .zero 200 |
| 155 ; CHECK-NEXT: .size ArrayUninitConstDouble, 200 | 174 ; CHECK-NEXT: .size ArrayUninitConstDouble, 200 |
| 156 | 175 |
| 157 @ArrayUninitConstInt = internal constant [20 x i8] zeroinitializer, align 4 | 176 @ArrayUninitConstInt = internal constant [20 x i8] zeroinitializer, align 4 |
| 158 ; CHECK: .type ArrayUninitConstInt,@object | 177 ; CHECK: .type ArrayUninitConstInt,%object |
| 159 ; CHECK: .section .rodata,"a",@progbits | 178 ; CHECK: .section .rodata,"a",%progbits |
| 160 ; CHECK-NEXT: .align 4 | 179 ; CHECK-NEXT: .p2align 2 |
| 161 ; CHECK-NEXT: ArrayUninitConstInt: | 180 ; CHECK-NEXT: ArrayUninitConstInt: |
| 162 ; CHECK-NEXT: .zero 20 | 181 ; CHECK-NEXT: .zero 20 |
| 163 ; CHECK-NEXT: .size ArrayUninitConstInt, 20 | 182 ; CHECK-NEXT: .size ArrayUninitConstInt, 20 |
| 164 | 183 |
| 165 @__init_array_start = internal constant [0 x i8] zeroinitializer, align 4 | 184 @__init_array_start = internal constant [0 x i8] zeroinitializer, align 4 |
| 166 @__fini_array_start = internal constant [0 x i8] zeroinitializer, align 4 | 185 @__fini_array_start = internal constant [0 x i8] zeroinitializer, align 4 |
| 167 @__tls_template_start = internal constant [0 x i8] zeroinitializer, align 8 | 186 @__tls_template_start = internal constant [0 x i8] zeroinitializer, align 8 |
| 168 @__tls_template_alignment = internal constant [4 x i8] c"\01\00\00\00", align 4 | 187 @__tls_template_alignment = internal constant [4 x i8] c"\01\00\00\00", align 4 |
| OLD | NEW |