Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(543)

Side by Side Diff: tests_lit/llvm2ice_tests/elf_container.ll

Issue 899483002: Subzero: Track protos + globals w/out initializers as undef too (not just helper funcs) (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/PNaClTranslator.cpp ('k') | tests_lit/llvm2ice_tests/elf_nodata.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 --args -O2 --verbose none -elf-writer -o %t \ 6 ; RUN: %p2i -i %s --args -O2 --verbose none -elf-writer -o %t \
7 ; RUN: && llvm-readobj -file-headers -sections -section-data \ 7 ; RUN: && llvm-readobj -file-headers -sections -section-data \
8 ; RUN: -relocations -symbols %t | FileCheck %s 8 ; RUN: -relocations -symbols %t | FileCheck %s
9 9
10 ; RUN: %p2i -i %s --args -O2 --verbose none \ 10 ; RUN: %p2i -i %s --args -O2 --verbose none \
11 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj -o - \ 11 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj -o - \
12 ; RUN: | llvm-readobj -file-headers -sections -section-data \ 12 ; RUN: | llvm-readobj -file-headers -sections -section-data \
13 ; RUN: -relocations -symbols - | FileCheck %s 13 ; RUN: -relocations -symbols - | FileCheck %s
14 14
15 ; Add a run that shows relocations in code inline. 15 ; Add a run that shows relocations in code inline.
16 ; RUN: %p2i -i %s --args -O2 --verbose none -elf-writer -o %t \ 16 ; RUN: %p2i -i %s --args -O2 --verbose none -elf-writer -o %t \
17 ; RUN: && llvm-objdump -d -r -x86-asm-syntax=intel %t \ 17 ; RUN: && llvm-objdump -d -r -x86-asm-syntax=intel %t \
18 ; RUN: | FileCheck --check-prefix=TEXT-RELOCS %s 18 ; RUN: | FileCheck --check-prefix=TEXT-RELOCS %s
19 19
20 ; Use intrinsics to test external calls. 20 ; Use intrinsics to test external calls.
21 declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) 21 declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
22 declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i32, i1) 22 declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i32, i1)
23 23
24 ; Try other external functions (for cross tests).
25 ; Not testing external global variables since the NaCl bitcode writer
26 ; refuses to freeze such IR.
27 declare void @external_foo(i32)
28
24 ; Test some global data relocs (data, rodata, bss). 29 ; Test some global data relocs (data, rodata, bss).
25 @bytes = internal global [7 x i8] c"ab\03\FF\F6fg", align 1 30 @bytes = internal global [7 x i8] c"ab\03\FF\F6fg", align 1
26 @bytes_const = internal constant [7 x i8] c"ab\03\FF\F6fg", align 1 31 @bytes_const = internal constant [7 x i8] c"ab\03\FF\F6fg", align 1
27 32
28 @ptr = internal global i32 ptrtoint ([7 x i8]* @bytes to i32), align 16 33 @ptr = internal global i32 ptrtoint ([7 x i8]* @bytes to i32), align 16
29 @ptr_const = internal constant i32 ptrtoint ([7 x i8]* @bytes to i32), align 16 34 @ptr_const = internal constant i32 ptrtoint ([7 x i8]* @bytes to i32), align 16
30 35
31 @ptr_to_func = internal global i32 ptrtoint (double ()* @returnDoubleConst to i3 2), align 4 36 @ptr_to_func = internal global i32 ptrtoint (double ()* @returnDoubleConst to i3 2), align 4
32 @ptr_to_func_const = internal constant i32 ptrtoint (double ()* @returnDoubleCon st to i32), align 4 37 @ptr_to_func_const = internal constant i32 ptrtoint (double ()* @returnDoubleCon st to i32), align 4
33 38
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 95 }
91 ; TEXT-RELOCS-LABEL: test_memset 96 ; TEXT-RELOCS-LABEL: test_memset
92 97
93 ; Test calling internal functions (may be able to do the fixup, 98 ; Test calling internal functions (may be able to do the fixup,
94 ; without emitting a relocation). 99 ; without emitting a relocation).
95 define internal float @test_call_internal() { 100 define internal float @test_call_internal() {
96 %f = call float @returnFloatConst() 101 %f = call float @returnFloatConst()
97 ret float %f 102 ret float %f
98 } 103 }
99 104
105 ; Test calling an external function.
106 define internal void @test_call_external() {
107 call void @external_foo(i32 42)
108 ret void
109 }
110
100 ; Test copying a function pointer, or a global data pointer. 111 ; Test copying a function pointer, or a global data pointer.
101 define internal i32 @test_ret_fp() { 112 define internal i32 @test_ret_fp() {
102 %r = ptrtoint float ()* @returnFloatConst to i32 113 %r = ptrtoint float ()* @returnFloatConst to i32
103 ret i32 %r 114 ret i32 %r
104 } 115 }
105 ; TEXT-RELOCS-LABEL: test_ret_fp 116 ; TEXT-RELOCS-LABEL: test_ret_fp
106 ; TEXT-RELOCS-NEXT: mov 117 ; TEXT-RELOCS-NEXT: mov
107 ; TEXT-RELOCS-NEXT: R_386_32 returnFloatConst 118 ; TEXT-RELOCS-NEXT: R_386_32 returnFloatConst
108 119
109 define internal i32 @test_ret_global_pointer() { 120 define internal i32 @test_ret_global_pointer() {
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 391
381 ; CHECK: Relocations [ 392 ; CHECK: Relocations [
382 ; CHECK: Section ({{[0-9]+}}) .rel.text { 393 ; CHECK: Section ({{[0-9]+}}) .rel.text {
383 ; CHECK: 0x4 R_386_32 .L$float$0 0x0 394 ; CHECK: 0x4 R_386_32 .L$float$0 0x0
384 ; CHECK: 0xC R_386_32 .L$float$1 0x0 395 ; CHECK: 0xC R_386_32 .L$float$1 0x0
385 ; CHECK: 0x24 R_386_32 .L$double$0 0x0 396 ; CHECK: 0x24 R_386_32 .L$double$0 0x0
386 ; CHECK: 0x2C R_386_32 .L$double$1 0x0 397 ; CHECK: 0x2C R_386_32 .L$double$1 0x0
387 ; CHECK: 0x34 R_386_32 .L$double$2 0x0 398 ; CHECK: 0x34 R_386_32 .L$double$2 0x0
388 ; CHECK: 0x{{.*}} R_386_PC32 memcpy 399 ; CHECK: 0x{{.*}} R_386_PC32 memcpy
389 ; CHECK: 0x{{.*}} R_386_PC32 memset 400 ; CHECK: 0x{{.*}} R_386_PC32 memset
401 ; CHECK: 0x{{.*}} R_386_PC32 external_foo
390 ; CHECK: } 402 ; CHECK: }
391 ; CHECK: Section ({{[0-9]+}}) .rel.data { 403 ; CHECK: Section ({{[0-9]+}}) .rel.data {
392 ; The set of relocations between llvm-mc and the integrated elf-writer 404 ; The set of relocations between llvm-mc and the integrated elf-writer
393 ; are different. For local symbols, llvm-mc uses the section + offset within 405 ; are different. For local symbols, llvm-mc uses the section + offset within
394 ; the section, while the integrated elf-writer refers the symbol itself. 406 ; the section, while the integrated elf-writer refers the symbol itself.
395 ; CHECK: 0x10 R_386_32 {{.*}} 0x0 407 ; CHECK: 0x10 R_386_32 {{.*}} 0x0
396 ; CHECK: 0x14 R_386_32 {{.*}} 0x0 408 ; CHECK: 0x14 R_386_32 {{.*}} 0x0
397 ; CHECK: 0x18 R_386_32 {{.*}} 0x0 409 ; CHECK: 0x18 R_386_32 {{.*}} 0x0
398 ; CHECK: } 410 ; CHECK: }
399 ; CHECK: Section ({{[0-9]+}}) .rel.rodata { 411 ; CHECK: Section ({{[0-9]+}}) .rel.rodata {
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 ; CHECK: Symbol { 619 ; CHECK: Symbol {
608 ; CHECK: Name: _start 620 ; CHECK: Name: _start
609 ; CHECK-NEXT: Value: 0x{{[1-9A-F][0-9A-F]*}} 621 ; CHECK-NEXT: Value: 0x{{[1-9A-F][0-9A-F]*}}
610 ; CHECK-NEXT: Size: 0 622 ; CHECK-NEXT: Size: 0
611 ; CHECK-NEXT: Binding: Global 623 ; CHECK-NEXT: Binding: Global
612 ; CHECK-NEXT: Type: Function 624 ; CHECK-NEXT: Type: Function
613 ; CHECK-NEXT: Other: 0 625 ; CHECK-NEXT: Other: 0
614 ; CHECK-NEXT: Section: .text 626 ; CHECK-NEXT: Section: .text
615 ; CHECK-NEXT: } 627 ; CHECK-NEXT: }
616 ; CHECK: Symbol { 628 ; CHECK: Symbol {
629 ; CHECK: Name: external_foo
630 ; CHECK-NEXT: Value: 0x0
631 ; CHECK-NEXT: Size: 0
632 ; CHECK-NEXT: Binding: Global
633 ; CHECK-NEXT: Type: None
634 ; CHECK-NEXT: Other: 0
635 ; CHECK-NEXT: Section: Undefined
636 ; CHECK-NEXT: }
637 ; CHECK: Symbol {
617 ; CHECK: Name: memcpy 638 ; CHECK: Name: memcpy
618 ; CHECK-NEXT: Value: 0x0 639 ; CHECK-NEXT: Value: 0x0
619 ; CHECK-NEXT: Size: 0 640 ; CHECK-NEXT: Size: 0
620 ; CHECK-NEXT: Binding: Global 641 ; CHECK-NEXT: Binding: Global
621 ; CHECK-NEXT: Type: None 642 ; CHECK-NEXT: Type: None
622 ; CHECK-NEXT: Other: 0 643 ; CHECK-NEXT: Other: 0
623 ; CHECK-NEXT: Section: Undefined 644 ; CHECK-NEXT: Section: Undefined
624 ; CHECK-NEXT: } 645 ; CHECK-NEXT: }
625 ; CHECK: Symbol { 646 ; CHECK: Symbol {
626 ; CHECK: Name: memset 647 ; CHECK: Name: memset
627 ; CHECK-NEXT: Value: 0x0 648 ; CHECK-NEXT: Value: 0x0
628 ; CHECK-NEXT: Size: 0 649 ; CHECK-NEXT: Size: 0
629 ; CHECK-NEXT: Binding: Global 650 ; CHECK-NEXT: Binding: Global
630 ; CHECK-NEXT: Type: None 651 ; CHECK-NEXT: Type: None
631 ; CHECK-NEXT: Other: 0 652 ; CHECK-NEXT: Other: 0
632 ; CHECK-NEXT: Section: Undefined 653 ; CHECK-NEXT: Section: Undefined
633 ; CHECK-NEXT: } 654 ; CHECK-NEXT: }
634 ; CHECK: ] 655 ; CHECK: ]
OLDNEW
« no previous file with comments | « src/PNaClTranslator.cpp ('k') | tests_lit/llvm2ice_tests/elf_nodata.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698