diff options
Diffstat (limited to 'test/Object')
-rw-r--r-- | test/Object/Inputs/corrupt-version.elf-x86_64 | bin | 0 -> 5200 bytes | |||
-rw-r--r-- | test/Object/Inputs/corrupt.elf-x86-64 | bin | 0 -> 1024 bytes | |||
-rwxr-xr-x | test/Object/Inputs/program-headers.mips | bin | 0 -> 648 bytes | |||
-rwxr-xr-x | test/Object/Inputs/trivial-executable-test.macho-x86-64 | bin | 0 -> 8512 bytes | |||
-rw-r--r-- | test/Object/Inputs/weak-global-symbol.macho-i386 | bin | 0 -> 344 bytes | |||
-rw-r--r-- | test/Object/Mips/lit.local.cfg | 2 | ||||
-rw-r--r-- | test/Object/X86/lit.local.cfg | 2 | ||||
-rw-r--r-- | test/Object/X86/objdump-cfg-invalid-opcode.yaml | 58 | ||||
-rw-r--r-- | test/Object/X86/objdump-cfg-textatomsize.yaml | 39 | ||||
-rw-r--r-- | test/Object/X86/objdump-cfg.yaml | 86 | ||||
-rw-r--r-- | test/Object/X86/objdump-disassembly-symbolic.test | 18 | ||||
-rw-r--r-- | test/Object/archive-symtab.test | 9 | ||||
-rw-r--r-- | test/Object/corrupt.test | 24 | ||||
-rw-r--r-- | test/Object/directory.ll | 3 | ||||
-rw-r--r-- | test/Object/nm-trivial-object.test | 8 | ||||
-rw-r--r-- | test/Object/nm-weak-global-macho.test | 3 |
16 files changed, 241 insertions, 11 deletions
diff --git a/test/Object/Inputs/corrupt-version.elf-x86_64 b/test/Object/Inputs/corrupt-version.elf-x86_64 Binary files differnew file mode 100644 index 0000000..1241a27 --- /dev/null +++ b/test/Object/Inputs/corrupt-version.elf-x86_64 diff --git a/test/Object/Inputs/corrupt.elf-x86-64 b/test/Object/Inputs/corrupt.elf-x86-64 Binary files differnew file mode 100644 index 0000000..8ae5f17 --- /dev/null +++ b/test/Object/Inputs/corrupt.elf-x86-64 diff --git a/test/Object/Inputs/program-headers.mips b/test/Object/Inputs/program-headers.mips Binary files differnew file mode 100755 index 0000000..54ebfea --- /dev/null +++ b/test/Object/Inputs/program-headers.mips diff --git a/test/Object/Inputs/trivial-executable-test.macho-x86-64 b/test/Object/Inputs/trivial-executable-test.macho-x86-64 Binary files differnew file mode 100755 index 0000000..50a6bab --- /dev/null +++ b/test/Object/Inputs/trivial-executable-test.macho-x86-64 diff --git a/test/Object/Inputs/weak-global-symbol.macho-i386 b/test/Object/Inputs/weak-global-symbol.macho-i386 Binary files differnew file mode 100644 index 0000000..a9c8e0c --- /dev/null +++ b/test/Object/Inputs/weak-global-symbol.macho-i386 diff --git a/test/Object/Mips/lit.local.cfg b/test/Object/Mips/lit.local.cfg index 1499317..88262fb 100644 --- a/test/Object/Mips/lit.local.cfg +++ b/test/Object/Mips/lit.local.cfg @@ -1,5 +1,3 @@ -config.suffixes = ['.test'] - targets = set(config.root.targets_to_build.split()) if not 'Mips' in targets: config.unsupported = True diff --git a/test/Object/X86/lit.local.cfg b/test/Object/X86/lit.local.cfg index 6a29e92..ba763cf 100644 --- a/test/Object/X86/lit.local.cfg +++ b/test/Object/X86/lit.local.cfg @@ -1,5 +1,3 @@ -config.suffixes = ['.test'] - targets = set(config.root.targets_to_build.split()) if not 'X86' in targets: config.unsupported = True diff --git a/test/Object/X86/objdump-cfg-invalid-opcode.yaml b/test/Object/X86/objdump-cfg-invalid-opcode.yaml new file mode 100644 index 0000000..56ab1d2 --- /dev/null +++ b/test/Object/X86/objdump-cfg-invalid-opcode.yaml @@ -0,0 +1,58 @@ +# RUN: yaml2obj -format=elf %s | llvm-objdump -d -yaml-cfg=%t - && FileCheck --check-prefix=CFG < %t %s +# REQUIRES: shell +# +# Generated from: +# main: +# .LBL0_1: +# movq 8(%rsi), %rax +# <invalid opcode: 06> +# nop + +!ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Content: "488B46080690" + +## 0000000000000000 <main>: + +#CFG: Atoms: +#CFG: - StartAddress: 0x0000000000000000 +#CFG: Size: 4 +#CFG: Type: Text + +## 0: 48 8b 46 08 mov 0x8(%rsi),%rax +#CFG: - Inst: MOV64rm +#CFG: Size: 4 +#CFG: Ops: [ RRAX, RRSI, I1, R, I8, R ] + + +#CFG: - StartAddress: 0x0000000000000004 +#CFG: Size: 1 +#CFG: Type: Data + +## 4: 06 (bad) +#CFG: Content: 06 + +#CFG: - StartAddress: 0x0000000000000005 +#CFG: Size: 1 +#CFG: Type: Text + +## 5: 90 nop +#CFG: - Inst: NOOP +#CFG: Size: 1 +#CFG: Ops: [ ] + +Symbols: + Global: + - Name: main + Type: STT_FUNC + Section: .text + Value: 0x0 + Size: 6 diff --git a/test/Object/X86/objdump-cfg-textatomsize.yaml b/test/Object/X86/objdump-cfg-textatomsize.yaml new file mode 100644 index 0000000..87cb4e1 --- /dev/null +++ b/test/Object/X86/objdump-cfg-textatomsize.yaml @@ -0,0 +1,39 @@ +# RUN: yaml2obj -format=elf %s | llvm-objdump -d -yaml-cfg=%t - && FileCheck --check-prefix=CFG < %t %s +# REQUIRES: shell +# +# Generated from: +# main: +# .LBL0_1: +# jmp .LBL0_1 +# + +!ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Content: "EBFE" + +## 0000000000000000 <main>: + +#CFG: Atoms: +#CFG: - StartAddress: 0x0000000000000000 +#CFG: Size: 2 + +## 0: eb fe jmp $-2 +#CFG: - Inst: JMP_1 +#CFG: Size: 2 +#CFG: Ops: [ I-2 ] + +Symbols: + Global: + - Name: main + Type: STT_FUNC + Section: .text + Value: 0x0 + Size: 2 diff --git a/test/Object/X86/objdump-cfg.yaml b/test/Object/X86/objdump-cfg.yaml new file mode 100644 index 0000000..c5bff03 --- /dev/null +++ b/test/Object/X86/objdump-cfg.yaml @@ -0,0 +1,86 @@ +# RUN: yaml2obj -format=elf %s | llvm-objdump -d -yaml-cfg=%t - && FileCheck --check-prefix=CFG < %t %s +# REQUIRES: shell +# +# Generated from: +# main: +# movl $48, %eax +# cmpl $3, %edi +# jl .LBB0_2 +# movq 8(%rsi), %rax +# movsbl (%rax), %eax +# .LBB0_2: +# ret +# + +!ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Content: "B83000000083FF037C07488B46080FBE00C3" + +## 0000000000000000 <main>: + +#CFG: Atoms: +#CFG: - StartAddress: 0x0000000000000000 +#CFG: Size: 10 + +## 0: b8 30 00 00 00 mov $0x30,%eax +#CFG: - Inst: MOV32ri +#CFG: Size: 5 +#CFG: Ops: [ REAX, I48 ] + +## 5: 83 ff 03 cmp $0x3,%edi +#CFG: - Inst: CMP32ri8 +#CFG: Size: 3 +#CFG: Ops: [ REDI, I3 ] + +## 8: 7c 07 jl 11 <main+0x11> +#CFG: - Inst: JL_1 +#CFG: Size: 2 +#CFG: Ops: [ I7 ] + +#CFG: - StartAddress: 0x000000000000000A +#CFG: Size: 7 + +## a: 48 8b 46 08 mov 0x8(%rsi),%rax +#CFG: - Inst: MOV64rm +#CFG: Size: 4 +#CFG: Ops: [ RRAX, RRSI, I1, R, I8, R ] + +## e: 0f be 00 movsbl (%rax),%eax +#CFG: - Inst: MOVSX32rm8 +#CFG: Size: 3 +#CFG: Ops: [ REAX, RRAX, I1, R, I0, R ] +#CFG: - StartAddress: 0x0000000000000011 +#CFG: Size: 1 + +## 11: c3 retq +#CFG: - Inst: RET +#CFG: Size: 1 +#CFG: Ops: [ ] + +Symbols: + Global: + - Name: main + Type: STT_FUNC + Section: .text + Value: 0x0 + Size: 18 + +#CFG: Functions: +#CFG: BasicBlocks: +#CFG: - Address: 0x0000000000000000 +#CFG: Preds: [ ] +#CFG: Succs: [ 0x0000000000000011, 0x000000000000000A ] +#CFG: - Address: 0x0000000000000011 +#CFG: Preds: [ 0x0000000000000000, 0x000000000000000A ] +#CFG: Succs: [ ] +#CFG: - Address: 0x000000000000000A +#CFG: Preds: [ 0x0000000000000000 ] +#CFG: Succs: [ 0x0000000000000011 ] diff --git a/test/Object/X86/objdump-disassembly-symbolic.test b/test/Object/X86/objdump-disassembly-symbolic.test index 667bce9..858653e 100644 --- a/test/Object/X86/objdump-disassembly-symbolic.test +++ b/test/Object/X86/objdump-disassembly-symbolic.test @@ -3,6 +3,11 @@ RUN: | FileCheck %s -check-prefix ELF-x86-64 RUN: llvm-objdump -d -symbolize %p/../Inputs/trivial-object-test.macho-x86-64 \ RUN: | FileCheck %s -check-prefix MACHO-x86-64 +# Generate this using: +# ld trivial-object-test.macho-x86-64 -undefined dynamic_lookup +RUN: llvm-objdump -d -symbolize %p/../Inputs/trivial-executable-test.macho-x86-64 \ +RUN: | FileCheck %s -check-prefix MACHO-STUBS-x86-64 + ELF-x86-64: file format ELF64-x86-64 ELF-x86-64: Disassembly of section .text: ELF-x86-64: main: @@ -28,3 +33,16 @@ MACHO-x86-64: 1a: e8 00 00 00 00 callq _Som MACHO-x86-64: 1f: 8b 44 24 04 movl 4(%rsp), %eax MACHO-x86-64: 23: 48 83 c4 08 addq $8, %rsp MACHO-x86-64: 27: c3 ret + +MACHO-STUBS-x86-64: file format Mach-O 64-bit x86-64 +MACHO-STUBS-x86-64: Disassembly of section __TEXT,__text: +MACHO-STUBS-x86-64: _main: +MACHO-STUBS-x86-64: 1f90: 48 83 ec 08 subq $8, %rsp +MACHO-STUBS-x86-64: 1f94: c7 44 24 04 00 00 00 00 movl $0, 4(%rsp) +MACHO-STUBS-x86-64: 1f9c: 48 8d 3d 45 00 00 00 leaq 69(%rip), %rdi ## literal pool for: Hello World! +MACHO-STUBS-x86-64: 1fa3: e8 16 00 00 00 callq puts +MACHO-STUBS-x86-64: 1fa8: 30 c0 xorb %al, %al +MACHO-STUBS-x86-64: 1faa: e8 09 00 00 00 callq SomeOtherFunction +MACHO-STUBS-x86-64: 1faf: 8b 44 24 04 movl 4(%rsp), %eax +MACHO-STUBS-x86-64: 1fb3: 48 83 c4 08 addq $8, %rsp +MACHO-STUBS-x86-64: 1fb7: c3 ret diff --git a/test/Object/archive-symtab.test b/test/Object/archive-symtab.test index 0d2504d..6379504 100644 --- a/test/Object/archive-symtab.test +++ b/test/Object/archive-symtab.test @@ -48,3 +48,12 @@ CORRUPT-NEXT: 00000016 T main check that the we *don't* update the symbol table. RUN: llvm-ar s %t.a RUN: llvm-nm -s %t.a | FileCheck %s --check-prefix=CORRUPT + +repeate the test with llvm-ranlib + +RUN: rm -f %t.a +RUN: llvm-ar rcS %t.a %p/Inputs/trivial-object-test.elf-x86-64 %p/Inputs/trivial-object-test2.elf-x86-64 +RUN: llvm-nm -s %t.a | FileCheck %s --check-prefix=NOMAP + +RUN: llvm-ranlib %t.a +RUN: llvm-nm -s %t.a | FileCheck %s diff --git a/test/Object/corrupt.test b/test/Object/corrupt.test new file mode 100644 index 0000000..ef72a09 --- /dev/null +++ b/test/Object/corrupt.test @@ -0,0 +1,24 @@ +// Section name offset overflows section name string table. +RUN: not llvm-readobj %p/Inputs/corrupt.elf-x86-64 -sections \ +RUN: 2>&1 | FileCheck --check-prefix=SECNAME %s + +// Section data offset past end of file. +RUN: not llvm-readobj %p/Inputs/corrupt.elf-x86-64 -sections -section-data \ +RUN: 2>&1 | FileCheck --check-prefix=SECDATA %s + +// Symbol name offset overflows string table. +RUN: not llvm-readobj %p/Inputs/corrupt.elf-x86-64 -symbols \ +RUN: 2>&1 | FileCheck --check-prefix=SYMNAME %s + +// Version index in .gnu.version overflows the version map. +RUN: not llvm-readobj %p/Inputs/corrupt-version.elf-x86_64 -dt \ +RUN: 2>&1 | FileCheck --check-prefix=VER %s + +SECNAME: Error reading file: Invalid data was encountered while parsing the file. + +SECDATA: Error reading file: Invalid data was encountered while parsing the file. +SECDATA: Error reading file: Invalid data was encountered while parsing the file. + +SYMNAME: Error reading file: Invalid data was encountered while parsing the file. + +VER: Error reading file: Invalid data was encountered while parsing the file. diff --git a/test/Object/directory.ll b/test/Object/directory.ll index bf8ff32..48eefcb 100644 --- a/test/Object/directory.ll +++ b/test/Object/directory.ll @@ -2,9 +2,6 @@ ;RUN: not llvm-ar r %T/test.a . 2>&1 | FileCheck %s ;CHECK: .: Is a directory -; Opening a directory works on cygwin and freebsd. -;XFAIL: freebsd, cygwin - ;RUN: rm -f %T/test.a ;RUN: touch %T/a-very-long-file-name ;RUN: llvm-ar r %T/test.a %s %T/a-very-long-file-name diff --git a/test/Object/nm-trivial-object.test b/test/Object/nm-trivial-object.test index d517745..748d6f2 100644 --- a/test/Object/nm-trivial-object.test +++ b/test/Object/nm-trivial-object.test @@ -25,10 +25,10 @@ ELF: U puts macho: 00000000 U _SomeOtherFunction -macho: 00000000 s _main +macho: 00000000 T _main macho: 00000000 U _puts macho64: 00000028 s L_.str -macho64: 00000000 u _SomeOtherFunction -macho64: 00000000 s _main -macho64: 00000000 u _puts +macho64: 00000000 U _SomeOtherFunction +macho64: 00000000 T _main +macho64: 00000000 U _puts diff --git a/test/Object/nm-weak-global-macho.test b/test/Object/nm-weak-global-macho.test new file mode 100644 index 0000000..ede2609 --- /dev/null +++ b/test/Object/nm-weak-global-macho.test @@ -0,0 +1,3 @@ +RUN: llvm-nm %p/Inputs/weak-global-symbol.macho-i386 | FileCheck %s + +CHECK: 00000000 S _a |