diff options
Diffstat (limited to 'test/Object')
-rw-r--r-- | test/Object/TestObjectFiles/archive-test.a-bitcode | bin | 0 -> 790 bytes | |||
-rw-r--r-- | test/Object/TestObjectFiles/archive-test.a-coff-i386 | bin | 0 -> 658 bytes | |||
-rw-r--r-- | test/Object/nm-archive.test | 17 | ||||
-rw-r--r-- | test/Object/nm-trivial-object.test (renamed from test/Object/nm-trivial-object.test-broken) | 0 | ||||
-rw-r--r-- | test/Object/objdump-disassembly-inline-relocations.test | 32 | ||||
-rw-r--r-- | test/Object/objdump-file-header.test | 18 | ||||
-rw-r--r-- | test/Object/objdump-relocations.test | 28 | ||||
-rw-r--r-- | test/Object/objdump-section-content.test | 20 | ||||
-rw-r--r-- | test/Object/objdump-sectionheaders.test | 16 | ||||
-rw-r--r-- | test/Object/objdump-symbol-table.test | 25 | ||||
-rw-r--r-- | test/Object/objdump-trivial-object.test (renamed from test/Object/objdump-trivial-object.test-broken) | 0 |
11 files changed, 156 insertions, 0 deletions
diff --git a/test/Object/TestObjectFiles/archive-test.a-bitcode b/test/Object/TestObjectFiles/archive-test.a-bitcode Binary files differnew file mode 100644 index 0000000..3aeb34f --- /dev/null +++ b/test/Object/TestObjectFiles/archive-test.a-bitcode diff --git a/test/Object/TestObjectFiles/archive-test.a-coff-i386 b/test/Object/TestObjectFiles/archive-test.a-coff-i386 Binary files differnew file mode 100644 index 0000000..846cd63 --- /dev/null +++ b/test/Object/TestObjectFiles/archive-test.a-coff-i386 diff --git a/test/Object/nm-archive.test b/test/Object/nm-archive.test new file mode 100644 index 0000000..da6144e --- /dev/null +++ b/test/Object/nm-archive.test @@ -0,0 +1,17 @@ +RUN: llvm-nm %p/TestObjectFiles/archive-test.a-coff-i386 \ +RUN: | FileCheck %s -check-prefix COFF +RUN: llvm-nm %p/TestObjectFiles/archive-test.a-bitcode \ +RUN: | FileCheck %s -check-prefix BITCODE + + +COFF: trivial-object-test.coff-i386: +COFF-NEXT: 00000000 d .data +COFF-NEXT: 00000000 t .text +COFF-NEXT: 00000000 d L_.str +COFF-NEXT: U _SomeOtherFunction +COFF-NEXT: 00000000 T _main +COFF-NEXT: U _puts + +BITCODE: U SomeOtherFunction +BITCODE-NEXT: T main +BITCODE-NEXT: U puts diff --git a/test/Object/nm-trivial-object.test-broken b/test/Object/nm-trivial-object.test index 6de1780..6de1780 100644 --- a/test/Object/nm-trivial-object.test-broken +++ b/test/Object/nm-trivial-object.test diff --git a/test/Object/objdump-disassembly-inline-relocations.test b/test/Object/objdump-disassembly-inline-relocations.test new file mode 100644 index 0000000..91f2e48 --- /dev/null +++ b/test/Object/objdump-disassembly-inline-relocations.test @@ -0,0 +1,32 @@ +RUN: llvm-objdump -d -r %p/TestObjectFiles/trivial-object-test.coff-i386 \ +RUN: | FileCheck %s -check-prefix COFF-i386 +RUN: llvm-objdump -d -r %p/TestObjectFiles/trivial-object-test.coff-x86-64 \ +RUN: | FileCheck %s -check-prefix COFF-x86-64 + +COFF-i386: file format COFF-i386 +COFF-i386: Disassembly of section .text: +COFF-i386: 0: 83 ec 0c subl $12, %esp +COFF-i386: 3: c7 44 24 08 00 00 00 00 movl $0, 8(%esp) +COFF-i386: b: c7 04 24 00 00 00 00 movl $0, (%esp) +COFF-i386: e: IMAGE_REL_I386_DIR32 L_.str +COFF-i386: 12: e8 00 00 00 00 calll 0 +COFF-i386: 13: IMAGE_REL_I386_REL32 _puts +COFF-i386: 17: e8 00 00 00 00 calll 0 +COFF-i386: 18: IMAGE_REL_I386_REL32 _SomeOtherFunction +COFF-i386: 1c: 8b 44 24 08 movl 8(%esp), %eax +COFF-i386: 20: 83 c4 0c addl $12, %esp +COFF-i386: 23: c3 ret + +COFF-x86-64: file format COFF-x86-64 +COFF-x86-64: Disassembly of section .text: +COFF-x86-64: 0: 48 83 ec 28 subq $40, %rsp +COFF-x86-64: 4: c7 44 24 24 00 00 00 00 movl $0, 36(%rsp) +COFF-x86-64: c: 48 8d 0d 00 00 00 00 leaq (%rip), %rcx +COFF-x86-64: f: IMAGE_REL_AMD64_REL32 L.str +COFF-x86-64: 13: e8 00 00 00 00 callq 0 +COFF-x86-64: 14: IMAGE_REL_AMD64_REL32 puts +COFF-x86-64: 18: e8 00 00 00 00 callq 0 +COFF-x86-64: 19: IMAGE_REL_AMD64_REL32 SomeOtherFunction +COFF-x86-64: 1d: 8b 44 24 24 movl 36(%rsp), %eax +COFF-x86-64: 21: 48 83 c4 28 addq $40, %rsp +COFF-x86-64: 25: c3 ret diff --git a/test/Object/objdump-file-header.test b/test/Object/objdump-file-header.test new file mode 100644 index 0000000..aa92a6b --- /dev/null +++ b/test/Object/objdump-file-header.test @@ -0,0 +1,18 @@ +RUN: llvm-objdump -f %p/TestObjectFiles/trivial-object-test.coff-i386 \ +RUN: | FileCheck %s -check-prefix COFF-i386 +RUN: llvm-objdump -f %p/TestObjectFiles/trivial-object-test.elf-i386 \ +RUN: | FileCheck %s -check-prefix ELF-i386 + +XFAIL: * + +COFF-i386: : file format +COFF-i386: architecture: i386 +COFF-i386: HAS_RELOC +COFF-i386: HAS_SYMS +COFF-i386: start address 0x + +ELF-i386: : file format elf +ELF-i386: architecture: i386 +ELF-i386: HAS_RELOC +ELF-i386: HAS_SYMS +ELF-i386: start address 0x diff --git a/test/Object/objdump-relocations.test b/test/Object/objdump-relocations.test new file mode 100644 index 0000000..2dcdb43 --- /dev/null +++ b/test/Object/objdump-relocations.test @@ -0,0 +1,28 @@ +RUN: llvm-objdump -r %p/TestObjectFiles/trivial-object-test.coff-i386 \ +RUN: | FileCheck %s -check-prefix COFF-i386 +RUN: llvm-objdump -r %p/TestObjectFiles/trivial-object-test.coff-x86-64 \ +RUN: | FileCheck %s -check-prefix COFF-x86-64 +RUN: llvm-objdump -r %p/TestObjectFiles/trivial-object-test.elf-i386 \ +RUN: | FileCheck %s -check-prefix ELF-i386 +RUN: llvm-objdump -r %p/TestObjectFiles/trivial-object-test.elf-x86-64 \ +RUN: | FileCheck %s -check-prefix ELF-x86-64 + +COFF-i386: .text +COFF-i386: IMAGE_REL_I386_DIR32 L_.str +COFF-i386: IMAGE_REL_I386_REL32 _puts +COFF-i386: IMAGE_REL_I386_REL32 _SomeOtherFunction + +COFF-x86-64: .text +COFF-x86-64: IMAGE_REL_AMD64_REL32 L.str +COFF-x86-64: IMAGE_REL_AMD64_REL32 puts +COFF-x86-64: IMAGE_REL_AMD64_REL32 SomeOtherFunction + +ELF-i386: .text +ELF-i386: R_386_32 +ELF-i386: R_386_PC32 +ELF-i386: R_386_PC32 + +ELF-x86-64: .text +ELF-x86-64: R_X86_64_32S .rodata.str1.1 +ELF-x86-64: R_X86_64_PC32 puts +ELF-x86-64: R_X86_64_PC32 SomeOtherFunction diff --git a/test/Object/objdump-section-content.test b/test/Object/objdump-section-content.test new file mode 100644 index 0000000..37f5330 --- /dev/null +++ b/test/Object/objdump-section-content.test @@ -0,0 +1,20 @@ +RUN: llvm-objdump -s %p/TestObjectFiles/trivial-object-test.coff-i386 \ +RUN: | FileCheck %s -check-prefix COFF-i386 +RUN: llvm-objdump -s %p/TestObjectFiles/trivial-object-test.elf-i386 \ +RUN: | FileCheck %s -check-prefix ELF-i386 + +COFF-i386: trivial-object-test.coff-i386: file format +COFF-i386: Contents of section .text: +COFF-i386: 0000 83ec0cc7 44240800 000000c7 04240000 ....D$.......$.. +COFF-i386: 0010 0000e800 000000e8 00000000 8b442408 .............D$. +COFF-i386: 0020 83c40cc3 .... +COFF-i386: Contents of section .data: +COFF-i386: 0000 48656c6c 6f20576f 726c6421 00 Hello World!. + +ELF-i386: trivial-object-test.elf-i386: file format +ELF-i386: Contents of section .text: +ELF-i386: 0000 83ec0cc7 44240800 000000c7 04240000 ....D$.......$.. +ELF-i386: 0010 0000e8fc ffffffe8 fcffffff 8b442408 .............D$. +ELF-i386: 0020 83c40cc3 .... +ELF-i386: Contents of section .rodata.str1.1: +ELF-i386: 0024 48656c6c 6f20576f 726c6421 00 Hello World!. diff --git a/test/Object/objdump-sectionheaders.test b/test/Object/objdump-sectionheaders.test new file mode 100644 index 0000000..4515d00 --- /dev/null +++ b/test/Object/objdump-sectionheaders.test @@ -0,0 +1,16 @@ +; RUN: llvm-objdump -h %p/TestObjectFiles/trivial-object-test.elf-x86-64 \ +; RUN: | FileCheck %s + +; To verify this, use readelf -S, not objdump -h. Binutils objdump filters the +; results in a way that we don't emulate. + +; CHECK: Sections: +; CHECK: Idx Name Size Address Type +; CHECK: 0 000000000 00000000000000000 +; CHECK: 1 .text 000000026 00000000000000000 TEXT DATA +; CHECK: 2 .rodata.str1.1 00000000d 00000000000000026 DATA +; CHECK: 3 .note.GNU-stack 000000000 00000000000000033 +; CHECK: 4 .rela.text 000000048 00000000000000038 +; CHECK: 5 .symtab 0000000c0 00000000000000080 +; CHECK: 6 .strtab 000000033 00000000000000140 +; CHECK: 7 .shstrtab 00000004b 00000000000000173 diff --git a/test/Object/objdump-symbol-table.test b/test/Object/objdump-symbol-table.test new file mode 100644 index 0000000..16b0d77 --- /dev/null +++ b/test/Object/objdump-symbol-table.test @@ -0,0 +1,25 @@ +RUN: llvm-objdump -t %p/TestObjectFiles/trivial-object-test.coff-i386 \ +RUN: | FileCheck %s -check-prefix COFF-i386 +RUN: llvm-objdump -t %p/TestObjectFiles/trivial-object-test.elf-i386 \ +RUN: | FileCheck %s -check-prefix ELF-i386 + +COFF-i386: trivial-object-test.coff-i386: file format +COFF-i386: SYMBOL TABLE: +COFF-i386: [ 0](sec 1)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .text +COFF-i386: AUX scnlen 0x24 nreloc 3 nlnno 0 checksum 0x0 assoc 1 comdat 0 +COFF-i386: [ 2](sec 2)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .data +COFF-i386: AUX scnlen 0xd nreloc 0 nlnno 0 checksum 0x0 assoc 2 comdat 0 +COFF-i386: [ 4](sec 1)(fl 0x00)(ty 200)(scl 2) (nx 0) 0x00000000 _main +COFF-i386: [ 5](sec 2)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 L_.str +COFF-i386: [ 6](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 _puts +COFF-i386: [ 7](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 _SomeOtherFunction + +ELF-i386: trivial-object-test.elf-i386: file format +ELF-i386: SYMBOL TABLE: +ELF-i386: 00000000 l df *ABS* 00000000 trivial-object-test.s +ELF-i386: 00000000 l d .text 00000000 .text +ELF-i386: 00000024 l d .rodata.str1.1 00000000 .rodata.str1.1 +ELF-i386: 00000031 l d .note.GNU-stack 00000000 .note.GNU-stack +ELF-i386: 00000000 g F .text 00000024 main +ELF-i386: 00000000 *UND* 00000000 SomeOtherFunction +ELF-i386: 00000000 *UND* 00000000 puts diff --git a/test/Object/objdump-trivial-object.test-broken b/test/Object/objdump-trivial-object.test index c4855fd..c4855fd 100644 --- a/test/Object/objdump-trivial-object.test-broken +++ b/test/Object/objdump-trivial-object.test |