summaryrefslogtreecommitdiffstats
path: root/test/tools/llvm-objdump
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2014-04-23 16:57:46 -0700
committerStephen Hines <srhines@google.com>2014-04-24 15:53:16 -0700
commit36b56886974eae4f9c5ebc96befd3e7bfe5de338 (patch)
treee6cfb69fbbd937f450eeb83bfb83b9da3b01275a /test/tools/llvm-objdump
parent69a8640022b04415ae9fac62f8ab090601d8f889 (diff)
downloadexternal_llvm-36b56886974eae4f9c5ebc96befd3e7bfe5de338.zip
external_llvm-36b56886974eae4f9c5ebc96befd3e7bfe5de338.tar.gz
external_llvm-36b56886974eae4f9c5ebc96befd3e7bfe5de338.tar.bz2
Update to LLVM 3.5a.
Change-Id: Ifadecab779f128e62e430c2b4f6ddd84953ed617
Diffstat (limited to 'test/tools/llvm-objdump')
-rw-r--r--test/tools/llvm-objdump/Inputs/export.dll.coff-i386bin0 -> 1052 bytes
-rw-r--r--test/tools/llvm-objdump/Inputs/many-relocs.obj-i386bin0 -> 305 bytes
-rw-r--r--test/tools/llvm-objdump/Inputs/nop.exe.coff-i386bin7680 -> 6144 bytes
-rw-r--r--test/tools/llvm-objdump/Inputs/out-of-section-sym.elf-i386bin0 -> 4450 bytes
-rw-r--r--test/tools/llvm-objdump/Inputs/out-of-section-sym.s15
-rw-r--r--test/tools/llvm-objdump/Inputs/win64-unwind.exe.coff-x86_64.exebin0 -> 2560 bytes
-rw-r--r--test/tools/llvm-objdump/Inputs/win64-unwind.exe.coff-x86_64.obj (renamed from test/tools/llvm-objdump/Inputs/win64-unwind.exe.coff-x86_64)bin698 -> 698 bytes
-rw-r--r--test/tools/llvm-objdump/coff-many-relocs.test14
-rw-r--r--test/tools/llvm-objdump/coff-private-headers.test70
-rw-r--r--test/tools/llvm-objdump/hex-relocation-addr.test17
-rw-r--r--test/tools/llvm-objdump/out-of-section-sym.test13
-rw-r--r--test/tools/llvm-objdump/win64-unwind-data.test155
12 files changed, 228 insertions, 56 deletions
diff --git a/test/tools/llvm-objdump/Inputs/export.dll.coff-i386 b/test/tools/llvm-objdump/Inputs/export.dll.coff-i386
new file mode 100644
index 0000000..7b93716
--- /dev/null
+++ b/test/tools/llvm-objdump/Inputs/export.dll.coff-i386
Binary files differ
diff --git a/test/tools/llvm-objdump/Inputs/many-relocs.obj-i386 b/test/tools/llvm-objdump/Inputs/many-relocs.obj-i386
new file mode 100644
index 0000000..c13e235
--- /dev/null
+++ b/test/tools/llvm-objdump/Inputs/many-relocs.obj-i386
Binary files differ
diff --git a/test/tools/llvm-objdump/Inputs/nop.exe.coff-i386 b/test/tools/llvm-objdump/Inputs/nop.exe.coff-i386
index 68c9d3d..2cda30f 100644
--- a/test/tools/llvm-objdump/Inputs/nop.exe.coff-i386
+++ b/test/tools/llvm-objdump/Inputs/nop.exe.coff-i386
Binary files differ
diff --git a/test/tools/llvm-objdump/Inputs/out-of-section-sym.elf-i386 b/test/tools/llvm-objdump/Inputs/out-of-section-sym.elf-i386
new file mode 100644
index 0000000..4c71584
--- /dev/null
+++ b/test/tools/llvm-objdump/Inputs/out-of-section-sym.elf-i386
Binary files differ
diff --git a/test/tools/llvm-objdump/Inputs/out-of-section-sym.s b/test/tools/llvm-objdump/Inputs/out-of-section-sym.s
new file mode 100644
index 0000000..9a1349c
--- /dev/null
+++ b/test/tools/llvm-objdump/Inputs/out-of-section-sym.s
@@ -0,0 +1,15 @@
+// $ cat out-of-section-sym.ld
+// SECTIONS
+// {
+// . = 0x10;
+// .text : { _ftext = . ; *(.text) }
+// . = 0x20;
+// .data : { _fdata = . ; *(.data) }
+// }
+// as --32 out-of-section-sym.s -o out-of-section-sym.o
+// ld -m elf_i386 -Tout-of-section-sym.ld -o out-of-section-sym.elf-i386 \
+// out-of-section-sym.o
+
+.text
+_start:
+ ret
diff --git a/test/tools/llvm-objdump/Inputs/win64-unwind.exe.coff-x86_64.exe b/test/tools/llvm-objdump/Inputs/win64-unwind.exe.coff-x86_64.exe
new file mode 100644
index 0000000..c701c24
--- /dev/null
+++ b/test/tools/llvm-objdump/Inputs/win64-unwind.exe.coff-x86_64.exe
Binary files differ
diff --git a/test/tools/llvm-objdump/Inputs/win64-unwind.exe.coff-x86_64 b/test/tools/llvm-objdump/Inputs/win64-unwind.exe.coff-x86_64.obj
index 63460e7..63460e7 100644
--- a/test/tools/llvm-objdump/Inputs/win64-unwind.exe.coff-x86_64
+++ b/test/tools/llvm-objdump/Inputs/win64-unwind.exe.coff-x86_64.obj
Binary files differ
diff --git a/test/tools/llvm-objdump/coff-many-relocs.test b/test/tools/llvm-objdump/coff-many-relocs.test
new file mode 100644
index 0000000..d6d0d60
--- /dev/null
+++ b/test/tools/llvm-objdump/coff-many-relocs.test
@@ -0,0 +1,14 @@
+// Test that llvm-objdump can handle IMAGE_SCN_LNK_NRELOC_OVFL.
+// RUN: llvm-objdump -r %p/Inputs/many-relocs.obj-i386 | FileCheck %s
+
+CHECK: RELOCATION RECORDS FOR [.text]:
+CHECK-NEXT: IMAGE_REL_I386_DIR16 foo
+CHECK-NEXT: IMAGE_REL_I386_REL16 foo
+CHECK-NEXT: IMAGE_REL_I386_DIR32 foo
+CHECK-NEXT: IMAGE_REL_I386_DIR32NB foo
+CHECK-NEXT: IMAGE_REL_I386_SEG12 foo
+CHECK-NEXT: IMAGE_REL_I386_SECTION foo
+CHECK-NEXT: IMAGE_REL_I386_SECREL foo
+CHECK-NEXT: IMAGE_REL_I386_TOKEN foo
+CHECK-NEXT: IMAGE_REL_I386_SECREL7 foo
+CHECK-NEXT: IMAGE_REL_I386_REL32 foo
diff --git a/test/tools/llvm-objdump/coff-private-headers.test b/test/tools/llvm-objdump/coff-private-headers.test
index d36c148..51bf443 100644
--- a/test/tools/llvm-objdump/coff-private-headers.test
+++ b/test/tools/llvm-objdump/coff-private-headers.test
@@ -1,9 +1,67 @@
-// RUN: llvm-objdump -p %p/Inputs/nop.exe.coff-i386 | FileCheck %s
+// RUN: llvm-objdump -p %p/Inputs/nop.exe.coff-i386 | \
+// RUN: FileCheck -check-prefix=IMPORT %s
-CHECK: The Import Tables:
-CHECK-NEXT: lookup 00005028 time 00000000 fwd 00000000 name 00005096 addr 00005058
-CHECK: DLL Name: KERNEL32.dll
-CHECK-NEXT: Hint/Ord Name
-CHECK-NEXT: 365 ExitProcess
+IMPORT: The Import Tables:
+IMPORT: lookup 000021e4 time 00000000 fwd 00000000 name 0000234a addr 00002024
+IMPORT: DLL Name: MSVCR110.dll
+IMPORT-NEXT: Hint/Ord Name
+IMPORT-NEXT: 767 _initterm_e
+IMPORT-NEXT: 766 _initterm
+IMPORT-NEXT: 437 __initenv
+IMPORT-NEXT: 660 _fmode
+IMPORT-NEXT: 571 _commode
+IMPORT-NEXT: 315 ?terminate@@YAXXZ
+IMPORT-NEXT: 424 __crtSetUnhandledExceptionFilter
+IMPORT-NEXT: 892 _lock
+IMPORT-NEXT: 1254 _unlock
+IMPORT-NEXT: 498 __setusermatherr
+IMPORT-NEXT: 428 __dllonexit
+IMPORT-NEXT: 1058 _onexit
+IMPORT-NEXT: 774 _invoke_watson
+IMPORT-NEXT: 575 _controlfp_s
+IMPORT-NEXT: 624 _except_handler4_common
+IMPORT-NEXT: 587 _crt_debugger_hook
+IMPORT-NEXT: 426 __crtUnhandledException
+IMPORT-NEXT: 425 __crtTerminateProcess
+IMPORT-NEXT: 572 _configthreadlocale
+IMPORT-NEXT: 556 _cexit
+IMPORT-NEXT: 633 _exit
+IMPORT-NEXT: 1484 exit
+IMPORT-NEXT: 496 __set_app_type
+IMPORT-NEXT: 436 __getmainargs
+IMPORT-NEXT: 533 _amsg_exit
+IMPORT-NEXT: 555 _calloc_crt
+IMPORT-NEXT: 367 _XcptFilter
+// RUN: llvm-objdump -p %p/Inputs/export.dll.coff-i386 | \
+// RUN: FileCheck -check-prefix=EXPORT %s
+EXPORT: Export Table:
+EXPORT-NEXT: DLL name: export.test.tmp3.dll
+EXPORT-NEXT: Ordinal base: 5
+EXPORT-NEXT: Ordinal RVA Name
+EXPORT-NEXT: 5 0x2008
+EXPORT-NEXT: 6 0x2010 exportfn2
+
+// RUN: llvm-objdump -p %p/Inputs/nop.exe.coff-i386 | \
+// RUN: FileCheck -check-prefix=LOADCFG %s
+
+LOADCFG: Load configuration:
+LOADCFG-NEXT: Timestamp: 0
+LOADCFG-NEXT: Major Version: 0
+LOADCFG-NEXT: Minor Version: 0
+LOADCFG-NEXT: GlobalFlags Clear: 0
+LOADCFG-NEXT: GlobalFlags Set: 0
+LOADCFG-NEXT: Critical Section Default Timeout: 0
+LOADCFG-NEXT: Decommit Free Block Threshold: 0
+LOADCFG-NEXT: Decommit Total Free Threshold: 0
+LOADCFG-NEXT: Lock Prefix Table: 0
+LOADCFG-NEXT: Maximum Allocation Size: 0
+LOADCFG-NEXT: Virtual Memory Threshold: 0
+LOADCFG-NEXT: Process Affinity Mask: 0
+LOADCFG-NEXT: Process Heap Flags: 0
+LOADCFG-NEXT: CSD Version: 0
+LOADCFG-NEXT: Security Cookie: 4206616
+LOADCFG-NEXT: SEH Table: 4202768
+LOADCFG-NEXT: SEH Count: 1
+LOADCFG: SEH Table: 0x401689
diff --git a/test/tools/llvm-objdump/hex-relocation-addr.test b/test/tools/llvm-objdump/hex-relocation-addr.test
new file mode 100644
index 0000000..7e7e97b
--- /dev/null
+++ b/test/tools/llvm-objdump/hex-relocation-addr.test
@@ -0,0 +1,17 @@
+// This test checks that relocation addresses are printed in hex
+// RUN: llvm-objdump -r %p/Inputs/win64-unwind.exe.coff-x86_64.obj | FileCheck %s
+
+CHECK: RELOCATION RECORDS FOR [.pdata]:
+CHECK-NEXT: 0 IMAGE_REL_AMD64_ADDR32NB func
+CHECK-NEXT: 4 IMAGE_REL_AMD64_ADDR32NB func
+CHECK-NEXT: 8 IMAGE_REL_AMD64_ADDR32NB .xdata
+CHECK-NEXT: c IMAGE_REL_AMD64_ADDR32NB func
+CHECK-NEXT: 10 IMAGE_REL_AMD64_ADDR32NB func
+CHECK-NEXT: 14 IMAGE_REL_AMD64_ADDR32NB .xdata
+CHECK-NEXT: 18 IMAGE_REL_AMD64_ADDR32NB smallFunc
+CHECK-NEXT: 1c IMAGE_REL_AMD64_ADDR32NB smallFunc
+CHECK-NEXT: 20 IMAGE_REL_AMD64_ADDR32NB .xdata
+CHECK-NEXT: 24 IMAGE_REL_AMD64_ADDR32NB allocFunc
+CHECK-NEXT: 28 IMAGE_REL_AMD64_ADDR32NB allocFunc
+CHECK-NEXT: 2c IMAGE_REL_AMD64_ADDR32NB .xdata
+
diff --git a/test/tools/llvm-objdump/out-of-section-sym.test b/test/tools/llvm-objdump/out-of-section-sym.test
new file mode 100644
index 0000000..f70dce6
--- /dev/null
+++ b/test/tools/llvm-objdump/out-of-section-sym.test
@@ -0,0 +1,13 @@
+// Check that llvm-objdump does not attempt to disassemble symbols outside
+// of section boundaries.
+// RUN: llvm-objdump -d -t %p/Inputs/out-of-section-sym.elf-i386 | FileCheck %s
+
+CHECK: Disassembly of section .text:
+CHECK-NEXT: _start:
+CHECK-NEXT: 10: c3 retl
+CHECK-NEXT: SYMBOL TABLE:
+CHECK-NEXT: 00000000 *UND* 00000000
+CHECK-NEXT: 00000010 l d .text 00000000 .text
+CHECK-NEXT: 00000010 .text 00000000 _start
+CHECK-NEXT: 00000020 .text 00000000 _fdata
+CHECK-NEXT: 00000010 .text 00000000 _ftext
diff --git a/test/tools/llvm-objdump/win64-unwind-data.test b/test/tools/llvm-objdump/win64-unwind-data.test
index a723ffe..d39d08f 100644
--- a/test/tools/llvm-objdump/win64-unwind-data.test
+++ b/test/tools/llvm-objdump/win64-unwind-data.test
@@ -1,52 +1,107 @@
// This test checks that the unwind data is dumped by llvm-objdump.
-// RUN: llvm-objdump -u %p/Inputs/win64-unwind.exe.coff-x86_64 | FileCheck %s
+// RUN: llvm-objdump -u %p/Inputs/win64-unwind.exe.coff-x86_64.obj \
+// RUN: | FileCheck -check-prefix=OBJ %s
+// RUN: llvm-objdump -u %p/Inputs/win64-unwind.exe.coff-x86_64.exe \
+// RUN: | FileCheck -check-prefix=EXE %s
-CHECK: Unwind info:
-CHECK: Function Table:
-CHECK-NEXT: Start Address: func
-CHECK-NEXT: End Address: func + 0x001b
-CHECK-NEXT: Unwind Info Address: .xdata
-CHECK-NEXT: Version: 1
-CHECK-NEXT: Flags: 1 UNW_ExceptionHandler
-CHECK-NEXT: Size of prolog: 18
-CHECK-NEXT: Number of Codes: 8
-CHECK-NEXT: Frame register: RBX
-CHECK-NEXT: Frame offset: 0
-CHECK-NEXT: Unwind Codes:
-CHECK-NEXT: 0x12: UOP_SetFPReg
-CHECK-NEXT: 0x0f: UOP_PushNonVol RBX
-CHECK-NEXT: 0x0e: UOP_SaveXMM128 XMM8 [0x0000]
-CHECK-NEXT: 0x09: UOP_SaveNonVol RSI [0x0010]
-CHECK-NEXT: 0x04: UOP_AllocSmall 24
-CHECK-NEXT: 0x00: UOP_PushMachFrame w/o error code
-CHECK: Function Table:
-CHECK-NEXT: Start Address: func + 0x0012
-CHECK-NEXT: End Address: func + 0x0012
-CHECK-NEXT: Unwind Info Address: .xdata + 0x001c
-CHECK-NEXT: Version: 1
-CHECK-NEXT: Flags: 4 UNW_ChainInfo
-CHECK-NEXT: Size of prolog: 0
-CHECK-NEXT: Number of Codes: 0
-CHECK-NEXT: No frame pointer used
-CHECK: Function Table:
-CHECK-NEXT: Start Address: smallFunc
-CHECK-NEXT: End Address: smallFunc + 0x0001
-CHECK-NEXT: Unwind Info Address: .xdata + 0x002c
-CHECK-NEXT: Version: 1
-CHECK-NEXT: Flags: 0
-CHECK-NEXT: Size of prolog: 0
-CHECK-NEXT: Number of Codes: 0
-CHECK-NEXT: No frame pointer used
-CHECK: Function Table:
-CHECK-NEXT: Start Address: allocFunc
-CHECK-NEXT: End Address: allocFunc + 0x001d
-CHECK-NEXT: Unwind Info Address: .xdata + 0x0034
-CHECK-NEXT: Version: 1
-CHECK-NEXT: Flags: 0
-CHECK-NEXT: Size of prolog: 14
-CHECK-NEXT: Number of Codes: 6
-CHECK-NEXT: No frame pointer used
-CHECK-NEXT: Unwind Codes:
-CHECK-NEXT: 0x0e: UOP_AllocLarge 8454128
-CHECK-NEXT: 0x07: UOP_AllocLarge 8190
-CHECK-NEXT: 0x00: UOP_PushMachFrame w/o error code
+OBJ: Unwind info:
+OBJ: Function Table:
+OBJ-NEXT: Start Address: func
+OBJ-NEXT: End Address: func + 0x001b
+OBJ-NEXT: Unwind Info Address: .xdata
+OBJ-NEXT: Version: 1
+OBJ-NEXT: Flags: 1 UNW_ExceptionHandler
+OBJ-NEXT: Size of prolog: 18
+OBJ-NEXT: Number of Codes: 8
+OBJ-NEXT: Frame register: RBX
+OBJ-NEXT: Frame offset: 0
+OBJ-NEXT: Unwind Codes:
+OBJ-NEXT: 0x12: UOP_SetFPReg
+OBJ-NEXT: 0x0f: UOP_PushNonVol RBX
+OBJ-NEXT: 0x0e: UOP_SaveXMM128 XMM8 [0x0000]
+OBJ-NEXT: 0x09: UOP_SaveNonVol RSI [0x0010]
+OBJ-NEXT: 0x04: UOP_AllocSmall 24
+OBJ-NEXT: 0x00: UOP_PushMachFrame w/o error code
+OBJ: Function Table:
+OBJ-NEXT: Start Address: func + 0x0012
+OBJ-NEXT: End Address: func + 0x0012
+OBJ-NEXT: Unwind Info Address: .xdata + 0x001c
+OBJ-NEXT: Version: 1
+OBJ-NEXT: Flags: 4 UNW_ChainInfo
+OBJ-NEXT: Size of prolog: 0
+OBJ-NEXT: Number of Codes: 0
+OBJ-NEXT: No frame pointer used
+OBJ: Function Table:
+OBJ-NEXT: Start Address: smallFunc
+OBJ-NEXT: End Address: smallFunc + 0x0001
+OBJ-NEXT: Unwind Info Address: .xdata + 0x002c
+OBJ-NEXT: Version: 1
+OBJ-NEXT: Flags: 0
+OBJ-NEXT: Size of prolog: 0
+OBJ-NEXT: Number of Codes: 0
+OBJ-NEXT: No frame pointer used
+OBJ: Function Table:
+OBJ-NEXT: Start Address: allocFunc
+OBJ-NEXT: End Address: allocFunc + 0x001d
+OBJ-NEXT: Unwind Info Address: .xdata + 0x0034
+OBJ-NEXT: Version: 1
+OBJ-NEXT: Flags: 0
+OBJ-NEXT: Size of prolog: 14
+OBJ-NEXT: Number of Codes: 6
+OBJ-NEXT: No frame pointer used
+OBJ-NEXT: Unwind Codes:
+OBJ-NEXT: 0x0e: UOP_AllocLarge 8454128
+OBJ-NEXT: 0x07: UOP_AllocLarge 8190
+OBJ-NEXT: 0x00: UOP_PushMachFrame w/o error code
+
+EXE: Function Table:
+EXE-NEXT: Start Address: 0x1000
+EXE-NEXT: End Address: 0x101b
+EXE-NEXT: Unwind Info Address: 0x2000
+EXE-NEXT: Version: 1
+EXE-NEXT: Flags: 1 UNW_ExceptionHandler
+EXE-NEXT: Size of prolog: 18
+EXE-NEXT: Number of Codes: 8
+EXE-NEXT: Frame register: RBX
+EXE-NEXT: Frame offset: 0
+EXE-NEXT: Unwind Codes:
+EXE-NEXT: 0x12: UOP_SetFPReg
+EXE-NEXT: 0x0f: UOP_PushNonVol RBX
+EXE-NEXT: 0x0e: UOP_SaveXMM128 XMM8 [0x0000]
+EXE-NEXT: 0x09: UOP_SaveNonVol RSI [0x0010]
+EXE-NEXT: 0x04: UOP_AllocSmall 24
+EXE-NEXT: 0x00: UOP_PushMachFrame w/o error code
+
+EXE: Function Table:
+EXE-NEXT: Start Address: 0x1012
+EXE-NEXT: End Address: 0x1012
+EXE-NEXT: Unwind Info Address: 0x201c
+EXE-NEXT: Version: 1
+EXE-NEXT: Flags: 4 UNW_ChainInfo
+EXE-NEXT: Size of prolog: 0
+EXE-NEXT: Number of Codes: 0
+EXE-NEXT: No frame pointer used
+
+EXE: Function Table:
+EXE-NEXT: Start Address: 0x101b
+EXE-NEXT: End Address: 0x101c
+EXE-NEXT: Unwind Info Address: 0x202c
+EXE-NEXT: Version: 1
+EXE-NEXT: Flags: 0
+EXE-NEXT: Size of prolog: 0
+EXE-NEXT: Number of Codes: 0
+EXE-NEXT: No frame pointer used
+
+EXE: Function Table:
+EXE-NEXT: Start Address: 0x101c
+EXE-NEXT: End Address: 0x1039
+EXE-NEXT: Unwind Info Address: 0x2034
+EXE-NEXT: Version: 1
+EXE-NEXT: Flags: 0
+EXE-NEXT: Size of prolog: 14
+EXE-NEXT: Number of Codes: 6
+EXE-NEXT: No frame pointer used
+EXE-NEXT: Unwind Codes:
+EXE-NEXT: 0x0e: UOP_AllocLarge 8454128
+EXE-NEXT: 0x07: UOP_AllocLarge 8190
+EXE-NEXT: 0x00: UOP_PushMachFrame w/o error code