OLD | NEW |
1 ; Tests that we generate an ELF container with fields that make sense, | 1 ; Tests that we generate an ELF container with fields that make sense, |
2 ; cross-validating against llvm-mc. | 2 ; cross-validating against llvm-mc. |
3 | 3 |
4 ; For the integrated ELF writer, we can't pipe the output because we need | 4 ; For the integrated ELF writer, we can't pipe the output because we need |
5 ; to seek backward and patch up the file headers. So, use a temporary file. | 5 ; to seek backward and patch up the file headers. So, use a temporary file. |
6 ; RUN: %p2i -i %s --filetype=obj --args -O2 --verbose none -o %t \ | 6 ; RUN: %p2i -i %s --filetype=obj --output %t --args -O2 --verbose none \ |
7 ; RUN: -allow-externally-defined-symbols \ | 7 ; RUN: -allow-externally-defined-symbols \ |
8 ; RUN: && llvm-readobj -file-headers -sections -section-data \ | 8 ; RUN: && llvm-readobj -file-headers -sections -section-data \ |
9 ; RUN: -relocations -symbols %t | FileCheck %s | 9 ; RUN: -relocations -symbols %t | FileCheck %s |
10 | 10 |
11 ; RUN: %if --need=allow_dump --command %p2i -i %s --args -O2 --verbose none \ | 11 ; RUN: %if --need=allow_dump --command %p2i -i %s --args -O2 --verbose none \ |
12 ; RUN: -allow-externally-defined-symbols \ | 12 ; RUN: -allow-externally-defined-symbols \ |
13 ; RUN: | %if --need=allow_dump --command llvm-mc -triple=i686-nacl \ | 13 ; RUN: | %if --need=allow_dump --command llvm-mc -triple=i686-nacl \ |
14 ; RUN: -filetype=obj -o - \ | 14 ; RUN: -filetype=obj -o - \ |
15 ; RUN: | %if --need=allow_dump --command llvm-readobj -file-headers \ | 15 ; RUN: | %if --need=allow_dump --command llvm-readobj -file-headers \ |
16 ; RUN: -sections -section-data -relocations -symbols - \ | 16 ; RUN: -sections -section-data -relocations -symbols - \ |
17 ; RUN: | %if --need=allow_dump --command FileCheck %s | 17 ; RUN: | %if --need=allow_dump --command FileCheck %s |
18 | 18 |
19 ; Add a run that shows relocations in code inline. | 19 ; Add a run that shows relocations in code inline. |
20 ; RUN: %p2i -i %s --filetype=obj --args -O2 --verbose none -o %t \ | 20 ; RUN: %p2i -i %s --filetype=obj --output %t --args -O2 --verbose none \ |
21 ; RUN: -allow-externally-defined-symbols \ | 21 ; RUN: -allow-externally-defined-symbols \ |
22 ; RUN: && le32-nacl-objdump -w -d -r -Mintel %t \ | 22 ; RUN: && le32-nacl-objdump -w -d -r -Mintel %t \ |
23 ; RUN: | FileCheck --check-prefix=TEXT-RELOCS %s | 23 ; RUN: | FileCheck --check-prefix=TEXT-RELOCS %s |
24 | 24 |
25 ; Use intrinsics to test external calls. | 25 ; Use intrinsics to test external calls. |
26 declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) | 26 declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) |
27 declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i32, i1) | 27 declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i32, i1) |
28 | 28 |
29 ; Try other external functions (for cross tests). | 29 ; Try other external functions (for cross tests). |
30 ; Not testing external global variables since the NaCl bitcode writer | 30 ; Not testing external global variables since the NaCl bitcode writer |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 ; Test intrinsics that call out to external functions. | 75 ; Test intrinsics that call out to external functions. |
76 define internal void @test_memcpy(i32 %iptr_dst, i32 %len) { | 76 define internal void @test_memcpy(i32 %iptr_dst, i32 %len) { |
77 entry: | 77 entry: |
78 %dst = inttoptr i32 %iptr_dst to i8* | 78 %dst = inttoptr i32 %iptr_dst to i8* |
79 %src = bitcast [7 x i8]* @bytes to i8* | 79 %src = bitcast [7 x i8]* @bytes to i8* |
80 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, | 80 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, |
81 i32 %len, i32 1, i1 false) | 81 i32 %len, i32 1, i1 false) |
82 ret void | 82 ret void |
83 } | 83 } |
84 ; TEXT-RELOCS-LABEL: test_memcpy | 84 ; TEXT-RELOCS-LABEL: test_memcpy |
85 ; TEXT-RELOCS: mov {{.*}} R_386_32 bytes | 85 ; TEXT-RELOCS: mov {{.*}} R_386_32 {{bytes|.data}} |
86 | 86 |
87 define internal void @test_memset(i32 %iptr_dst, i32 %wide_val, i32 %len) { | 87 define internal void @test_memset(i32 %iptr_dst, i32 %wide_val, i32 %len) { |
88 entry: | 88 entry: |
89 %val = trunc i32 %wide_val to i8 | 89 %val = trunc i32 %wide_val to i8 |
90 %dst = inttoptr i32 %iptr_dst to i8* | 90 %dst = inttoptr i32 %iptr_dst to i8* |
91 call void @llvm.memset.p0i8.i32(i8* %dst, i8 %val, | 91 call void @llvm.memset.p0i8.i32(i8* %dst, i8 %val, |
92 i32 %len, i32 1, i1 false) | 92 i32 %len, i32 1, i1 false) |
93 ret void | 93 ret void |
94 } | 94 } |
95 ; TEXT-RELOCS-LABEL: test_memset | 95 ; TEXT-RELOCS-LABEL: test_memset |
(...skipping 10 matching lines...) Expand all Loading... |
106 call void @external_foo(i32 42) | 106 call void @external_foo(i32 42) |
107 ret void | 107 ret void |
108 } | 108 } |
109 | 109 |
110 ; Test copying a function pointer, or a global data pointer. | 110 ; Test copying a function pointer, or a global data pointer. |
111 define internal i32 @test_ret_fp() { | 111 define internal i32 @test_ret_fp() { |
112 %r = ptrtoint float ()* @returnFloatConst to i32 | 112 %r = ptrtoint float ()* @returnFloatConst to i32 |
113 ret i32 %r | 113 ret i32 %r |
114 } | 114 } |
115 ; TEXT-RELOCS-LABEL: test_ret_fp | 115 ; TEXT-RELOCS-LABEL: test_ret_fp |
116 ; TEXT-RELOCS-NEXT: mov {{.*}} R_386_32 returnFloatConst | 116 ; TEXT-RELOCS-NEXT: mov {{.*}} R_386_32 {{returnFloatConst|.text}} |
117 | 117 |
118 define internal i32 @test_ret_global_pointer() { | 118 define internal i32 @test_ret_global_pointer() { |
119 %r = ptrtoint [7 x i8]* @bytes to i32 | 119 %r = ptrtoint [7 x i8]* @bytes to i32 |
120 ret i32 %r | 120 ret i32 %r |
121 } | 121 } |
122 ; TEXT-RELOCS-LABEL: test_ret_global_pointer | 122 ; TEXT-RELOCS-LABEL: test_ret_global_pointer |
123 ; TEXT-RELOCS-NEXT: mov {{.*}} R_386_32 bytes | 123 ; TEXT-RELOCS-NEXT: mov {{.*}} R_386_32 {{bytes|.data}} |
124 | 124 |
125 ; Test defining a non-internal function. | 125 ; Test defining a non-internal function. |
126 define void @_start(i32) { | 126 define void @_start(i32) { |
127 %f = call float @returnFloatConst() | 127 %f = call float @returnFloatConst() |
128 %d = call double @returnDoubleConst() | 128 %d = call double @returnDoubleConst() |
129 call void @test_memcpy(i32 0, i32 99) | 129 call void @test_memcpy(i32 0, i32 99) |
130 call void @test_memset(i32 0, i32 0, i32 99) | 130 call void @test_memset(i32 0, i32 0, i32 99) |
131 %f2 = call float @test_call_internal() | 131 %f2 = call float @test_call_internal() |
132 %p1 = call i32 @test_ret_fp() | 132 %p1 = call i32 @test_ret_fp() |
133 %p2 = call i32 @test_ret_global_pointer() | 133 %p2 = call i32 @test_ret_global_pointer() |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 ; CHECK: Symbol { | 641 ; CHECK: Symbol { |
642 ; CHECK: Name: memset | 642 ; CHECK: Name: memset |
643 ; CHECK-NEXT: Value: 0x0 | 643 ; CHECK-NEXT: Value: 0x0 |
644 ; CHECK-NEXT: Size: 0 | 644 ; CHECK-NEXT: Size: 0 |
645 ; CHECK-NEXT: Binding: Global | 645 ; CHECK-NEXT: Binding: Global |
646 ; CHECK-NEXT: Type: None | 646 ; CHECK-NEXT: Type: None |
647 ; CHECK-NEXT: Other: 0 | 647 ; CHECK-NEXT: Other: 0 |
648 ; CHECK-NEXT: Section: Undefined | 648 ; CHECK-NEXT: Section: Undefined |
649 ; CHECK-NEXT: } | 649 ; CHECK-NEXT: } |
650 ; CHECK: ] | 650 ; CHECK: ] |
OLD | NEW |