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

Unified Diff: tests_lit/llvm2ice_tests/elf_nodata.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, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests_lit/llvm2ice_tests/elf_container.ll ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests_lit/llvm2ice_tests/elf_nodata.ll
diff --git a/tests_lit/llvm2ice_tests/elf_nodata.ll b/tests_lit/llvm2ice_tests/elf_nodata.ll
new file mode 100644
index 0000000000000000000000000000000000000000..8170676f0588f76bdf1251f74db075e2ed764a53
--- /dev/null
+++ b/tests_lit/llvm2ice_tests/elf_nodata.ll
@@ -0,0 +1,127 @@
+; Tests that we generate an ELF container correctly when there
+; is no data section.
+
+; For the integrated ELF writer, we can't pipe the output because we need
+; to seek backward and patch up the file headers. So, use a temporary file.
+; RUN: %p2i -i %s --args -O2 --verbose none -elf-writer -o %t \
+; RUN: && llvm-readobj -file-headers -sections -section-data \
+; RUN: -relocations -symbols %t | FileCheck %s
+
+; RUN: %p2i -i %s --args -O2 --verbose none \
+; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj -o - \
+; RUN: | llvm-readobj -file-headers -sections -section-data \
+; RUN: -relocations -symbols - | FileCheck %s
+
+declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
+
+define internal i32 @foo(i32 %x, i32 %len) {
+ %y = add i32 %x, %x
+ %dst = inttoptr i32 %y to i8*
+ %src = inttoptr i32 %x to i8*
+ call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src,
+ i32 %len, i32 1, i1 false)
+
+ ret i32 %y
+}
+
+; Test defining a non-internal function.
+define void @_start(i32 %x) {
+ %ignored = call i32 @foo(i32 %x, i32 4)
+ ret void
+}
+
+; CHECK: Section {
+; CHECK: Index: {{[1-9][0-9]*}}
+; CHECK: Name: .text
+; CHECK: Type: SHT_PROGBITS
+; CHECK: Flags [ (0x6)
+; CHECK: SHF_ALLOC
+; CHECK: SHF_EXECINSTR
+; CHECK: ]
+; CHECK: Address: 0x0
+; CHECK: Offset: 0x{{[1-9A-F][0-9A-F]*}}
+; CHECK: Size: {{[1-9][0-9]*}}
+; CHECK: Link: 0
+; CHECK: Info: 0
+; CHECK: AddressAlignment: 32
+; CHECK: EntrySize: 0
+; CHECK: SectionData (
+; CHECK: )
+; CHECK: }
+; CHECK: Section {
+; CHECK: Index: {{[1-9][0-9]*}}
+; CHECK: Name: .rel.text
+; CHECK: Type: SHT_REL
+; CHECK: Flags [ (0x0)
+; CHECK: ]
+; CHECK: Address: 0x0
+; CHECK: Offset: 0x{{[1-9A-F][0-9A-F]*}}
+; CHECK: Size: {{[1-9][0-9]*}}
+; CHECK: Link: [[SYMTAB_INDEX:[1-9][0-9]*]]
+; CHECK: Info: {{[1-9][0-9]*}}
+; CHECK: AddressAlignment: 4
+; CHECK: EntrySize: 8
+; CHECK: SectionData (
+; CHECK: )
+; CHECK: }
+; CHECK: Section {
+; CHECK: Index: [[SYMTAB_INDEX]]
+; CHECK-NEXT: Name: .symtab
+; CHECK: Type: SHT_SYMTAB
+; CHECK: Flags [ (0x0)
+; CHECK: ]
+; CHECK: Address: 0x0
+; CHECK: Offset: 0x{{[1-9A-F][0-9A-F]*}}
+; CHECK: Size: {{[1-9][0-9]*}}
+; CHECK: Link: {{[1-9][0-9]*}}
+; CHECK: Info: {{[1-9][0-9]*}}
+; CHECK: AddressAlignment: 4
+; CHECK: EntrySize: 16
+; CHECK: }
+
+
+; CHECK: Relocations [
+; CHECK: Section ({{[0-9]+}}) .rel.text {
+; CHECK: 0x21 R_386_PC32 memcpy 0x0
+; CHECK: }
+; CHECK: ]
+
+
+; CHECK: Symbols [
+; CHECK-NEXT: Symbol {
+; CHECK-NEXT: Name: (0)
+; CHECK-NEXT: Value: 0x0
+; CHECK-NEXT: Size: 0
+; CHECK-NEXT: Binding: Local
+; CHECK-NEXT: Type: None
+; CHECK-NEXT: Other: 0
+; CHECK-NEXT: Section: Undefined (0x0)
+; CHECK-NEXT: }
+; CHECK: Symbol {
+; CHECK: Name: foo
+; CHECK-NEXT: Value: 0x0
+; CHECK-NEXT: Size: 0
+; CHECK-NEXT: Binding: Local
+; CHECK-NEXT: Type: None
+; CHECK-NEXT: Other: 0
+; CHECK-NEXT: Section: .text
+; CHECK-NEXT: }
+; CHECK: Symbol {
+; CHECK: Name: _start
+; CHECK-NEXT: Value: 0x{{[1-9A-F][0-9A-F]*}}
+; CHECK-NEXT: Size: 0
+; CHECK-NEXT: Binding: Global
+; CHECK-NEXT: Type: Function
+; CHECK-NEXT: Other: 0
+; CHECK-NEXT: Section: .text
+; CHECK-NEXT: }
+; CHECK: Symbol {
+; CHECK: Name: memcpy
+; CHECK-NEXT: Value: 0x0
+; CHECK-NEXT: Size: 0
+; CHECK-NEXT: Binding: Global
+; CHECK-NEXT: Type: None
+; CHECK-NEXT: Other: 0
+; CHECK-NEXT: Section: Undefined
+; CHECK-NEXT: }
+; CHECK: ]
« no previous file with comments | « tests_lit/llvm2ice_tests/elf_container.ll ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698