From d955cf2366c262075b4c16f9eb1ae558ea98a932 Mon Sep 17 00:00:00 2001 From: "Michael J. Spencer" Date: Mon, 17 Oct 2011 17:13:05 +0000 Subject: [PATCH] llvm-objdump: Add tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142198 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Object/objdump-file-header.test | 18 ++++++++++++++++ test/Object/objdump-section-content.test | 22 +++++++++++++++++++ test/Object/objdump-symbol-table.test | 27 ++++++++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 test/Object/objdump-file-header.test create mode 100644 test/Object/objdump-section-content.test create mode 100644 test/Object/objdump-symbol-table.test diff --git a/test/Object/objdump-file-header.test b/test/Object/objdump-file-header.test new file mode 100644 index 00000000000..aa92a6bfab2 --- /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-section-content.test b/test/Object/objdump-section-content.test new file mode 100644 index 00000000000..413f74be579 --- /dev/null +++ b/test/Object/objdump-section-content.test @@ -0,0 +1,22 @@ +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 + +XFAIL: * + +COFF-i386: trivial-object-test.coff-i386: file format pe-i386 +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 elf32-i386 +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-symbol-table.test b/test/Object/objdump-symbol-table.test new file mode 100644 index 00000000000..f3b9c88dde9 --- /dev/null +++ b/test/Object/objdump-symbol-table.test @@ -0,0 +1,27 @@ +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 + +XFAIL: * + +COFF-i386: trivial-object-test.coff-i386: file format pe-i386 +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 elf32-i386 +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 -- 2.34.1