diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/MC/ELF/many-sections-2.s | 2 | ||||
-rw-r--r-- | test/Object/readobj-elf-versioning.test | 49 | ||||
-rw-r--r-- | test/Object/readobj-shared-object.test | 387 | ||||
-rw-r--r-- | test/tools/llvm-readobj/Inputs/trivial.ll | 19 | ||||
-rw-r--r-- | test/tools/llvm-readobj/Inputs/trivial.obj.coff-i386 | bin | 0 -> 314 bytes | |||
-rw-r--r-- | test/tools/llvm-readobj/Inputs/trivial.obj.coff-x86-64 | bin | 0 -> 319 bytes | |||
-rw-r--r-- | test/tools/llvm-readobj/Inputs/trivial.obj.elf-i386 | bin | 0 -> 896 bytes | |||
-rw-r--r-- | test/tools/llvm-readobj/Inputs/trivial.obj.elf-x86-64 | bin | 0 -> 1256 bytes | |||
-rw-r--r-- | test/tools/llvm-readobj/Inputs/trivial.obj.macho-i386 | bin | 0 -> 472 bytes | |||
-rw-r--r-- | test/tools/llvm-readobj/Inputs/trivial.obj.macho-x86-64 | bin | 0 -> 532 bytes | |||
-rw-r--r-- | test/tools/llvm-readobj/file-headers.test | 100 | ||||
-rw-r--r-- | test/tools/llvm-readobj/lit.local.cfg | 1 | ||||
-rw-r--r-- | test/tools/llvm-readobj/relocations.test | 32 | ||||
-rw-r--r-- | test/tools/llvm-readobj/sections-ext.test | 175 | ||||
-rw-r--r-- | test/tools/llvm-readobj/sections.test | 113 | ||||
-rw-r--r-- | test/tools/llvm-readobj/symbols.test | 44 |
16 files changed, 832 insertions, 90 deletions
diff --git a/test/MC/ELF/many-sections-2.s b/test/MC/ELF/many-sections-2.s index f5a1a0e437..789ebf378d 100644 --- a/test/MC/ELF/many-sections-2.s +++ b/test/MC/ELF/many-sections-2.s @@ -1,5 +1,5 @@ // RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t -// RUN: llvm-readobj %t | FileCheck %s +// RUN: llvm-readobj -s %t | FileCheck %s // CHECK: symtab_shndx diff --git a/test/Object/readobj-elf-versioning.test b/test/Object/readobj-elf-versioning.test index be1a39d9c4..1f09ef32a1 100644 --- a/test/Object/readobj-elf-versioning.test +++ b/test/Object/readobj-elf-versioning.test @@ -1,15 +1,46 @@ -RUN: llvm-readobj %p/Inputs/elf-versioning-test.i386 \ +RUN: llvm-readobj -dt %p/Inputs/elf-versioning-test.i386 \ RUN: | FileCheck %s -check-prefix ELF -RUN: llvm-readobj %p/Inputs/elf-versioning-test.i386 \ +RUN: llvm-readobj -dt %p/Inputs/elf-versioning-test.i386 \ RUN: | FileCheck %s -check-prefix ELF32 -RUN: llvm-readobj %p/Inputs/elf-versioning-test.x86_64 \ +RUN: llvm-readobj -dt %p/Inputs/elf-versioning-test.x86_64 \ RUN: | FileCheck %s -check-prefix ELF -RUN: llvm-readobj %p/Inputs/elf-versioning-test.x86_64 \ +RUN: llvm-readobj -dt %p/Inputs/elf-versioning-test.x86_64 \ RUN: | FileCheck %s -check-prefix ELF64 -ELF: foo@@VER2 FUNC .text {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} global -ELF: foo@VER1 FUNC .text {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} global -ELF: unversioned_define FUNC .text {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} global +ELF: DynamicSymbols [ +ELF: Symbol { +ELF: Name: foo@@VER2 +ELF: Binding: Global +ELF: Type: Function +ELF: Section: .text +ELF: } +ELF: Symbol { +ELF: Name: foo@VER1 +ELF: Binding: Global +ELF: Type: Function +ELF: Section: .text +ELF: } +ELF: Symbol { +ELF: Name: unversioned_define +ELF: Binding: Global +ELF: Type: Function +ELF: Section: .text +ELF: } +ELF: ] -ELF32: puts@GLIBC_2.0 FUNC {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} undef,global -ELF64: puts@GLIBC_2.2.5 FUNC {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} undef,global +ELF32: DynamicSymbols [ +ELF32: Symbol { +ELF32: Name: puts@GLIBC_2.0 +ELF32: Binding: Global +ELF32: Type: Function +ELF32: Section: (0x0) +ELF32: } +ELF32: ] +ELF64: DynamicSymbols [ +ELF64: Symbol { +ELF64: Name: puts@GLIBC_2.2.5 +ELF64: Binding: Global +ELF64: Type: Function +ELF64: Section: (0x0) +ELF64: } +ELF64: ] diff --git a/test/Object/readobj-shared-object.test b/test/Object/readobj-shared-object.test index 548bd3801e..72dbd32ea9 100644 --- a/test/Object/readobj-shared-object.test +++ b/test/Object/readobj-shared-object.test @@ -1,92 +1,319 @@ -RUN: llvm-readobj %p/Inputs/shared-object-test.elf-i386 \ +RUN: llvm-readobj -s -t -dt -dynamic-table -needed-libs \ +RUN: %p/Inputs/shared-object-test.elf-i386 \ RUN: | FileCheck %s -check-prefix ELF -RUN: llvm-readobj %p/Inputs/shared-object-test.elf-i386 \ +RUN: llvm-readobj -s -t -dt -dynamic-table -needed-libs \ +RUN: %p/Inputs/shared-object-test.elf-i386 \ RUN: | FileCheck %s -check-prefix ELF32 -RUN: llvm-readobj %p/Inputs/shared-object-test.elf-x86-64 \ +RUN: llvm-readobj -s -t -dt -dynamic-table -needed-libs \ +RUN: %p/Inputs/shared-object-test.elf-x86-64 \ RUN: | FileCheck %s -check-prefix ELF -RUN: llvm-readobj %p/Inputs/shared-object-test.elf-x86-64 \ +RUN: llvm-readobj -s -t -dt -dynamic-table -needed-libs \ +RUN: %p/Inputs/shared-object-test.elf-x86-64 \ RUN: | FileCheck %s -check-prefix ELF64 -ELF64:File Format : ELF64-x86-64 -ELF64:Arch : x86_64 -ELF64:Address Size: 64 bits -ELF64:Load Name : libfoo.so +ELF64: Format: ELF64-x86-64 +ELF64: Arch: x86_64 +ELF64: AddressSize: 64bit +ELF64: LoadName: libfoo.so -ELF32:File Format : ELF32-i386 -ELF32:Arch : i386 -ELF32:Address Size: 32 bits -ELF32:Load Name : libfoo.so +ELF32: Format: ELF32-i386 +ELF32: Arch: i386 +ELF32: AddressSize: 32bit +ELF32: LoadName: libfoo.so -ELF:Symbols: -ELF: Name Type Section Address Size FileOffset Flags -ELF: .dynsym DBG .dynsym {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} formatspecific -ELF: .dynstr DBG .dynstr {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} formatspecific -ELF: .text DBG .text {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} formatspecific -ELF: .eh_frame DBG .eh_frame {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} formatspecific -ELF: .tdata DBG .tdata {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} formatspecific -ELF: .dynamic DBG .dynamic {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} formatspecific -ELF: .got.plt DBG .got.plt {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} formatspecific -ELF: .data DBG .data {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} formatspecific -ELF: .bss DBG .bss {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} formatspecific -ELF: shared.ll FILE {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} absolute,formatspecific -ELF: local_func FUNC .text {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} -ELF: _GLOBAL_OFFSET_TABLE_ DATA {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} absolute -ELF: _DYNAMIC DATA {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} absolute -ELF: common_sym DATA .bss {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} global -ELF: tls_sym DATA .tdata {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} global,threadlocal -ELF: defined_sym DATA .data {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} global -ELF: __bss_start ? {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} global,absolute -ELF: _end ? {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} global,absolute -ELF: global_func FUNC .text {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} global -ELF: _edata ? {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} global,absolute -ELF: Total: 21 +ELF: Sections [ +ELF: Section { +ELF: Name: (0) +ELF: Type: SHT_NULL +ELF: Flags [ (0x0) +ELF: ] +ELF: } +ELF: Section { +ELF: Name: .hash +ELF: Type: SHT_HASH +ELF: Flags [ (0x2) +ELF: SHF_ALLOC +ELF: ] +ELF: } +ELF: Section { +ELF: Name: .dynsym +ELF: Type: SHT_DYNSYM +ELF: Flags [ (0x2) +ELF: SHF_ALLOC +ELF: ] +ELF: } +ELF: Section { +ELF: Name: .dynstr +ELF: Type: SHT_STRTAB +ELF: Flags [ (0x2) +ELF: SHF_ALLOC +ELF: ] +ELF: } +ELF: Section { +ELF: Name: .text +ELF: Type: SHT_PROGBITS +ELF: Flags [ (0x6) +ELF: SHF_ALLOC +ELF: SHF_EXECINSTR +ELF: ] +ELF: } +ELF: Section { +ELF: Name: .eh_frame +ELF: Type: SHT_PROGBITS +ELF: Flags [ (0x2) +ELF: SHF_ALLOC +ELF: ] +ELF: } +ELF: Section { +ELF: Name: .tdata +ELF: Type: SHT_PROGBITS +ELF: Flags [ (0x403) +ELF: SHF_ALLOC +ELF: SHF_TLS +ELF: SHF_WRITE +ELF: ] +ELF: } +ELF: Section { +ELF: Name: .dynamic +ELF: Type: SHT_DYNAMIC +ELF: Flags [ (0x3) +ELF: SHF_ALLOC +ELF: SHF_WRITE +ELF: ] +ELF: } +ELF: Section { +ELF: Name: .got.plt +ELF: Type: SHT_PROGBITS +ELF: Flags [ (0x3) +ELF: SHF_ALLOC +ELF: SHF_WRITE +ELF: ] +ELF: } +ELF: Section { +ELF: Name: .data +ELF: Type: SHT_PROGBITS +ELF: Flags [ (0x3) +ELF: SHF_ALLOC +ELF: SHF_WRITE +ELF: ] +ELF: } +ELF: Section { +ELF: Name: .bss +ELF: Type: SHT_NOBITS +ELF: Flags [ (0x3) +ELF: SHF_ALLOC +ELF: SHF_WRITE +ELF: ] +ELF: } +ELF: Section { +ELF: Name: .shstrtab +ELF: Type: SHT_STRTAB +ELF: Flags [ (0x0) +ELF: ] +ELF: } +ELF: Section { +ELF: Name: .symtab +ELF: Type: SHT_SYMTAB +ELF: Flags [ (0x0) +ELF: ] +ELF: } +ELF: Section { +ELF: Name: .strtab +ELF: Type: SHT_STRTAB +ELF: Flags [ (0x0) +ELF: ] +ELF: } +ELF: ] -ELF:Dynamic Symbols: -ELF: Name Type Section Address Size FileOffset Flags -ELF: common_sym DATA .bss {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} global -ELF: tls_sym DATA .tdata {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} global,threadlocal -ELF: defined_sym DATA .data {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} global -ELF: __bss_start ? {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} global,absolute -ELF: _end ? {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} global,absolute -ELF: global_func FUNC .text {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} global -ELF: _edata ? {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} global,absolute -ELF: Total: {{[0-9a-f]+}} +ELF: Symbols [ +ELF: Symbol { +ELF: Name: .hash +ELF: Binding: Local +ELF: Type: Section +ELF: Section: .hash +ELF: } +ELF: Symbol { +ELF: Name: .dynsym +ELF: Binding: Local +ELF: Type: Section +ELF: Section: .dynsym +ELF: } +ELF: Symbol { +ELF: Name: .dynstr +ELF: Binding: Local +ELF: Type: Section +ELF: Section: .dynstr +ELF: } +ELF: Symbol { +ELF: Name: .text +ELF: Binding: Local +ELF: Type: Section +ELF: Section: .text +ELF: } +ELF: Symbol { +ELF: Name: .eh_frame +ELF: Binding: Local +ELF: Type: Section +ELF: Section: .eh_frame +ELF: } +ELF: Symbol { +ELF: Name: .tdata +ELF: Binding: Local +ELF: Type: Section +ELF: Section: .tdata +ELF: } +ELF: Symbol { +ELF: Name: .dynamic +ELF: Binding: Local +ELF: Type: Section +ELF: Section: .dynamic +ELF: } +ELF: Symbol { +ELF: Name: .got.plt +ELF: Binding: Local +ELF: Type: Section +ELF: Section: .got.plt +ELF: } +ELF: Symbol { +ELF: Name: .data +ELF: Binding: Local +ELF: Type: Section +ELF: Section: .data +ELF: } +ELF: Symbol { +ELF: Name: .bss +ELF: Binding: Local +ELF: Type: Section +ELF: Section: .bss +ELF: } +ELF: Symbol { +ELF: Name: shared.ll +ELF: Binding: Local +ELF: Type: File +ELF: Section: (0xFFF1) +ELF: } +ELF: Symbol { +ELF: Name: local_func +ELF: Binding: Local +ELF: Type: Function +ELF: Section: .text +ELF: } +ELF: Symbol { +ELF: Name: _GLOBAL_OFFSET_TABLE_ +ELF: Binding: Local +ELF: Type: Object +ELF: Section: (0xFFF1) +ELF: } +ELF: Symbol { +ELF: Name: _DYNAMIC +ELF: Binding: Local +ELF: Type: Object +ELF: Section: (0xFFF1) +ELF: } +ELF: Symbol { +ELF: Name: common_sym +ELF: Binding: Global +ELF: Type: Object +ELF: Section: .bss +ELF: } +ELF: Symbol { +ELF: Name: tls_sym +ELF: Binding: Global +ELF: Type: TLS +ELF: Section: .tdata +ELF: } +ELF: Symbol { +ELF: Name: defined_sym +ELF: Binding: Global +ELF: Type: Object +ELF: Section: .data +ELF: } +ELF: Symbol { +ELF: Name: __bss_start +ELF: Binding: Global +ELF: Type: None +ELF: Section: (0xFFF1) +ELF: } +ELF: Symbol { +ELF: Name: _end +ELF: Binding: Global +ELF: Type: None +ELF: Section: (0xFFF1) +ELF: } +ELF: Symbol { +ELF: Name: global_func +ELF: Binding: Global +ELF: Type: Function +ELF: Section: .text +ELF: } +ELF: Symbol { +ELF: Name: _edata +ELF: Binding: Global +ELF: Type: None +ELF: Section: (0xFFF1) +ELF: } +ELF: ] -ELF:Sections: -ELF: Name Address Size Align Flags -ELF: {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} rodata -ELF: .hash {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} required,rodata -ELF: .dynsym {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} required,rodata -ELF: .dynstr {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} required,rodata -ELF: .text {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} text,{{(data,)?}}required -ELF: .eh_frame {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} data,required,rodata -ELF: .tdata {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} data,required -ELF: .dynamic {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} required -ELF: .got.plt {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} data,required -ELF: .data {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} data,required -ELF: .bss {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} bss,required,virtual,zeroinit -ELF: .shstrtab {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} rodata -ELF: .symtab {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} rodata -ELF: .strtab {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} rodata -ELF: Total: 14 - -ELF:Dynamic section contains 9 entries -ELF: Tag Type Name/Value -ELF: 00000001 (NEEDED) Shared library: [libc.so.6] -ELF: 00000001 (NEEDED) Shared library: [libm.so.6] -ELF: 0000000e (SONAME) Library soname: [libfoo.so] -ELF: 00000004 (HASH) {{[0-9a-f]+}} -ELF: 00000005 (STRTAB) {{[0-9a-f]+}} -ELF: 00000006 (SYMTAB) {{[0-9a-f]+}} -ELF: 0000000a (STRSZ) {{[0-9]+}} (bytes) -ELF: 0000000b (SYMENT) {{[0-9]+}} (bytes) -ELF: 00000000 (NULL) 0x0 -ELF: Total: 9 - -ELF:Libraries needed: -ELF: libc.so.6 -ELF: libm.so.6 -ELF: Total: 2 +ELF: DynamicSymbols [ +ELF: Symbol { +ELF: Name: common_sym +ELF: Binding: Global +ELF: Type: Object +ELF: Section: .bss +ELF: } +ELF: Symbol { +ELF: Name: tls_sym +ELF: Binding: Global +ELF: Type: TLS +ELF: Section: .tdata +ELF: } +ELF: Symbol { +ELF: Name: defined_sym +ELF: Binding: Global +ELF: Type: Object +ELF: Section: .data +ELF: } +ELF: Symbol { +ELF: Name: __bss_start +ELF: Binding: Global +ELF: Type: None +ELF: Section: (0xFFF1) +ELF: } +ELF: Symbol { +ELF: Name: _end +ELF: Binding: Global +ELF: Type: None +ELF: Section: (0xFFF1) +ELF: } +ELF: Symbol { +ELF: Name: global_func +ELF: Binding: Global +ELF: Type: Function +ELF: Section: .text +ELF: } +ELF: Symbol { +ELF: Name: _edata +ELF: Binding: Global +ELF: Type: None +ELF: Section: (0xFFF1) +ELF: } +ELF: ] +ELF: DynamicSection [ (9 entries) +ELF: Tag Type Name/Value +ELF: 00000001 NEEDED SharedLibrary (libc.so.6) +ELF: 00000001 NEEDED SharedLibrary (libm.so.6) +ELF: 0000000E SONAME LibrarySoname (libfoo.so) +ELF: 00000004 HASH {{[0-9a-f]+}} +ELF: 00000005 STRTAB {{[0-9a-f]+}} +ELF: 00000006 SYMTAB {{[0-9a-f]+}} +ELF: 0000000A STRSZ {{[0-9]+}} (bytes) +ELF: 0000000B SYMENT {{[0-9]+}} (bytes) +ELF: 00000000 NULL 0x0 +ELF: ] +ELF: NeededLibraries [ +ELF-NEXT: libc.so.6 +ELF-NEXT: libm.so.6 +ELF-NEXT: ] diff --git a/test/tools/llvm-readobj/Inputs/trivial.ll b/test/tools/llvm-readobj/Inputs/trivial.ll new file mode 100644 index 0000000000..2cd7ec89e2 --- /dev/null +++ b/test/tools/llvm-readobj/Inputs/trivial.ll @@ -0,0 +1,19 @@ +; llc -mtriple=i386-pc-win32 trivial.ll -filetype=obj -o trivial-object-test.coff-i386 +; llc -mtriple=x86_64-pc-win32 trivial.ll -filetype=obj -o trivial-object-test.coff-x86-64 +; llc -mtriple=i386-linux-gnu trivial.ll -filetype=obj -o trivial-object-test.elf-i386 -relocation-model=pic +; llc -mtriple=x86_64-linux-gnu trivial.ll -filetype=obj -o trivial-object-test.elf-x86-64 -relocation-model=pic +; llc -mtriple=i386-apple-darwin10 trivial.ll -filetype=obj -o trivial-object-test.macho-i386 -relocation-model=pic +; llc -mtriple=x86_64-apple-darwin10 trivial.ll -filetype=obj -o trivial-object-test.macho-x86-64 -relocation-model=pic + +@.str = private unnamed_addr constant [13 x i8] c"Hello World\0A\00", align 1 + +define i32 @main() nounwind { +entry: + %call = tail call i32 @puts(i8* getelementptr inbounds ([13 x i8]* @.str, i32 0, i32 0)) nounwind + tail call void bitcast (void (...)* @SomeOtherFunction to void ()*)() nounwind + ret i32 0 +} + +declare i32 @puts(i8* nocapture) nounwind + +declare void @SomeOtherFunction(...) diff --git a/test/tools/llvm-readobj/Inputs/trivial.obj.coff-i386 b/test/tools/llvm-readobj/Inputs/trivial.obj.coff-i386 Binary files differnew file mode 100644 index 0000000000..282e5699a7 --- /dev/null +++ b/test/tools/llvm-readobj/Inputs/trivial.obj.coff-i386 diff --git a/test/tools/llvm-readobj/Inputs/trivial.obj.coff-x86-64 b/test/tools/llvm-readobj/Inputs/trivial.obj.coff-x86-64 Binary files differnew file mode 100644 index 0000000000..8a7060e610 --- /dev/null +++ b/test/tools/llvm-readobj/Inputs/trivial.obj.coff-x86-64 diff --git a/test/tools/llvm-readobj/Inputs/trivial.obj.elf-i386 b/test/tools/llvm-readobj/Inputs/trivial.obj.elf-i386 Binary files differnew file mode 100644 index 0000000000..f85e40d626 --- /dev/null +++ b/test/tools/llvm-readobj/Inputs/trivial.obj.elf-i386 diff --git a/test/tools/llvm-readobj/Inputs/trivial.obj.elf-x86-64 b/test/tools/llvm-readobj/Inputs/trivial.obj.elf-x86-64 Binary files differnew file mode 100644 index 0000000000..95285c1f23 --- /dev/null +++ b/test/tools/llvm-readobj/Inputs/trivial.obj.elf-x86-64 diff --git a/test/tools/llvm-readobj/Inputs/trivial.obj.macho-i386 b/test/tools/llvm-readobj/Inputs/trivial.obj.macho-i386 Binary files differnew file mode 100644 index 0000000000..5048171ccb --- /dev/null +++ b/test/tools/llvm-readobj/Inputs/trivial.obj.macho-i386 diff --git a/test/tools/llvm-readobj/Inputs/trivial.obj.macho-x86-64 b/test/tools/llvm-readobj/Inputs/trivial.obj.macho-x86-64 Binary files differnew file mode 100644 index 0000000000..bcdfc8aa69 --- /dev/null +++ b/test/tools/llvm-readobj/Inputs/trivial.obj.macho-x86-64 diff --git a/test/tools/llvm-readobj/file-headers.test b/test/tools/llvm-readobj/file-headers.test new file mode 100644 index 0000000000..226eb93423 --- /dev/null +++ b/test/tools/llvm-readobj/file-headers.test @@ -0,0 +1,100 @@ +RUN: llvm-readobj -h %p/Inputs/trivial.obj.coff-i386 \ +RUN: | FileCheck %s -check-prefix COFF32 +RUN: llvm-readobj -h %p/Inputs/trivial.obj.coff-x86-64 \ +RUN: | FileCheck %s -check-prefix COFF64 +RUN: llvm-readobj -h %p/Inputs/trivial.obj.elf-i386 \ +RUN: | FileCheck %s -check-prefix ELF32 +RUN: llvm-readobj -h %p/Inputs/trivial.obj.elf-x86-64 \ +RUN: | FileCheck %s -check-prefix ELF64 + +COFF32: File: {{(.*[/\\])?}}trivial.obj.coff-i386 +COFF32-NEXT: Format: COFF-i386 +COFF32-NEXT: Arch: i386 +COFF32-NEXT: AddressSize: 32bit +COFF32-NEXT: ImageFileHeader { +COFF32-NEXT: Machine: IMAGE_FILE_MACHINE_I386 (0x14C) +COFF32-NEXT: SectionCount: 2 +COFF32-NEXT: TimeDateStamp: 2013-03-20 17:56:46 (0x5149F85E) +COFF32-NEXT: PointerToSymbolTable: 0xA5 +COFF32-NEXT: SymbolCount: 7 +COFF32-NEXT: OptionalHeaderSize: 0 +COFF32-NEXT: Characteristics [ (0x0) +COFF32-NEXT: ] +COFF32-NEXT: } + +COFF64: File: {{(.*[/\\])?}}trivial.obj.coff-x86-64 +COFF64-NEXT: Format: COFF-x86-64 +COFF64-NEXT: Arch: x86_64 +COFF64-NEXT: AddressSize: 64bit +COFF64-NEXT: ImageFileHeader { +COFF64-NEXT: Machine: IMAGE_FILE_MACHINE_AMD64 (0x8664) +COFF64-NEXT: SectionCount: 2 +COFF64-NEXT: TimeDateStamp: 2013-03-20 17:56:46 (0x5149F85E) +COFF64-NEXT: PointerToSymbolTable: 0xAB +COFF64-NEXT: SymbolCount: 7 +COFF64-NEXT: OptionalHeaderSize: 0 +COFF64-NEXT: Characteristics [ (0x0) +COFF64-NEXT: ] +COFF64-NEXT: } + +ELF32: File: {{(.*[/\\])?}}trivial.obj.elf-i386 +ELF32-NEXT: Format: ELF32-i386 +ELF32-NEXT: Arch: i386 +ELF32-NEXT: AddressSize: 32bit +ELF32-NEXT: LoadName: +ELF32-NEXT: ElfHeader { +ELF32-NEXT: Ident { +ELF32-NEXT: Magic: (7F 45 4C 46) +ELF32-NEXT: Class: 32-bit (0x1) +ELF32-NEXT: DataEncoding: LittleEndian (0x1) +ELF32-NEXT: FileVersion: 1 +ELF32-NEXT: OS/ABI: GNU/Linux (0x3) +ELF32-NEXT: ABIVersion: 0 +ELF32-NEXT: Unused: (00 00 00 00 00 00 00) +ELF32-NEXT: } +ELF32-NEXT: Type: Relocatable (0x1) +ELF32-NEXT: Machine: EM_386 (0x3) +ELF32-NEXT: Version: 1 +ELF32-NEXT: Entry: 0x0 +ELF32-NEXT: ProgramHeaderOffset: 0x0 +ELF32-NEXT: SectionHeaderOffset: 0xC8 +ELF32-NEXT: Flags [ (0x0) +ELF32-NEXT: ] +ELF32-NEXT: HeaderSize: 52 +ELF32-NEXT: ProgramHeaderEntrySize: 0 +ELF32-NEXT: ProgramHeaderCount: 0 +ELF32-NEXT: SectionHeaderEntrySize: 40 +ELF32-NEXT: SectionHeaderCount: 10 +ELF32-NEXT: StringTableSectionIndex: 7 +ELF32-NEXT: } + +ELF64: File: {{(.*[/\\])?}}trivial.obj.elf-x86-64 +ELF64-NEXT: Format: ELF64-x86-64 +ELF64-NEXT: Arch: x86_64 +ELF64-NEXT: AddressSize: 64bit +ELF64-NEXT: LoadName: +ELF64-NEXT: ElfHeader { +ELF64-NEXT: Ident { +ELF64-NEXT: Magic: (7F 45 4C 46) +ELF64-NEXT: Class: 64-bit (0x2) +ELF64-NEXT: DataEncoding: LittleEndian (0x1) +ELF64-NEXT: FileVersion: 1 +ELF64-NEXT: OS/ABI: GNU/Linux (0x3) +ELF64-NEXT: ABIVersion: 0 +ELF64-NEXT: Unused: (00 00 00 00 00 00 00) +ELF64-NEXT: } +ELF64-NEXT: Type: Relocatable (0x1) +ELF64-NEXT: Machine: EM_X86_64 (0x3E) +ELF64-NEXT: Version: 1 +ELF64-NEXT: Entry: 0x0 +ELF64-NEXT: ProgramHeaderOffset: 0x0 +ELF64-NEXT: SectionHeaderOffset: 0xB8 +ELF64-NEXT: Flags [ (0x0) +ELF64-NEXT: ] +ELF64-NEXT: HeaderSize: 64 +ELF64-NEXT: ProgramHeaderEntrySize: 0 +ELF64-NEXT: ProgramHeaderCount: 0 +ELF64-NEXT: SectionHeaderEntrySize: 64 +ELF64-NEXT: SectionHeaderCount: 10 +ELF64-NEXT: StringTableSectionIndex: 7 +ELF64-NEXT: } diff --git a/test/tools/llvm-readobj/lit.local.cfg b/test/tools/llvm-readobj/lit.local.cfg new file mode 100644 index 0000000000..df9b335dd1 --- /dev/null +++ b/test/tools/llvm-readobj/lit.local.cfg @@ -0,0 +1 @@ +config.suffixes = ['.test'] diff --git a/test/tools/llvm-readobj/relocations.test b/test/tools/llvm-readobj/relocations.test new file mode 100644 index 0000000000..0608565373 --- /dev/null +++ b/test/tools/llvm-readobj/relocations.test @@ -0,0 +1,32 @@ +RUN: llvm-readobj -r %p/Inputs/trivial.obj.coff-i386 \ +RUN: | FileCheck %s -check-prefix COFF +RUN: llvm-readobj -r %p/Inputs/trivial.obj.elf-i386 \ +RUN: | FileCheck %s -check-prefix ELF +RUN: llvm-readobj -r %p/Inputs/trivial.obj.macho-i386 \ +RUN: | FileCheck %s -check-prefix MACHO + +COFF: Relocations [ +COFF-NEXT: Section (1) .text { +COFF-NEXT: 0x4 IMAGE_REL_I386_DIR32 .data +COFF-NEXT: 0x9 IMAGE_REL_I386_REL32 _puts +COFF-NEXT: 0xE IMAGE_REL_I386_REL32 _SomeOtherFunction +COFF-NEXT: } +COFF-NEXT: ] + +ELF: Relocations [ +ELF-NEXT: Section (1) .text { +ELF-NEXT: 0xC R_386_GOTPC _GLOBAL_OFFSET_TABLE_ 0x0 +ELF-NEXT: 0x12 R_386_GOTOFF .L.str 0x0 +ELF-NEXT: 0x1A R_386_PLT32 puts 0x0 +ELF-NEXT: 0x1F R_386_PLT32 SomeOtherFunction 0x0 +ELF-NEXT: } +ELF-NEXT: ] + +MACHO: Relocations [ +MACHO-NEXT: Section __text { +MACHO-NEXT: 0x18 GENERIC_RELOC_VANILLA _SomeOtherFunction 0x0 +MACHO-NEXT: 0x13 GENERIC_RELOC_VANILLA _puts 0x0 +MACHO-NEXT: 0xB GENERIC_RELOC_LOCAL_SECTDIFF _main 0x{{[0-9A-F]+}} +MACHO-NEXT: 0x0 GENERIC_RELOC_PAIR _main 0x{{[0-9A-F]+}} +MACHO-NEXT: } +MACHO-NEXT: ] diff --git a/test/tools/llvm-readobj/sections-ext.test b/test/tools/llvm-readobj/sections-ext.test new file mode 100644 index 0000000000..a972c9ab51 --- /dev/null +++ b/test/tools/llvm-readobj/sections-ext.test @@ -0,0 +1,175 @@ +RUN: llvm-readobj -s -st -sr -sd %p/Inputs/trivial.obj.coff-i386 \ +RUN: | FileCheck %s -check-prefix COFF +RUN: llvm-readobj -s -st -sr -sd %p/Inputs/trivial.obj.elf-i386 \ +RUN: | FileCheck %s -check-prefix ELF +RUN: llvm-readobj -s -st -sr -sd %p/Inputs/trivial.obj.macho-i386 \ +RUN: | FileCheck %s -check-prefix MACHO + +COFF: Sections [ +COFF-NEXT: Section { +COFF-NEXT: Number: 1 +COFF-NEXT: Name: .text (2E 74 65 78 74 00 00 00) +COFF-NEXT: VirtualSize: 0x0 +COFF-NEXT: VirtualAddress: 0x0 +COFF-NEXT: RawDataSize: 22 +COFF-NEXT: PointerToRawData: 0x64 +COFF-NEXT: PointerToRelocations: 0x7A +COFF-NEXT: PointerToLineNumbers: 0x0 +COFF-NEXT: RelocationCount: 3 +COFF-NEXT: LineNumberCount: 0 +COFF-NEXT: Characteristics [ (0x60500020) +COFF-NEXT: IMAGE_SCN_ALIGN_16BYTES (0x500000) +COFF-NEXT: IMAGE_SCN_CNT_CODE (0x20) +COFF-NEXT: IMAGE_SCN_MEM_EXECUTE (0x20000000) +COFF-NEXT: IMAGE_SCN_MEM_READ (0x40000000) +COFF-NEXT: ] +COFF-NEXT: Relocations [ +COFF-NEXT: 0x4 IMAGE_REL_I386_DIR32 .data +COFF-NEXT: 0x9 IMAGE_REL_I386_REL32 _puts +COFF-NEXT: 0xE IMAGE_REL_I386_REL32 _SomeOtherFunction +COFF-NEXT: ] +COFF-NEXT: Symbols [ +COFF-NEXT: Symbol { +COFF-NEXT: Name: .text +COFF-NEXT: Value: 0 +COFF-NEXT: Section: .text (1) +COFF-NEXT: BaseType: Null (0x0) +COFF-NEXT: ComplexType: Null (0x0) +COFF-NEXT: StorageClass: Static (0x3) +COFF-NEXT: AuxSymbolCount: 1 +COFF-NEXT: AuxSectionDef { +COFF-NEXT: Length: 22 +COFF-NEXT: RelocationCount: 3 +COFF-NEXT: LineNumberCount: 0 +COFF-NEXT: Checksum: 0x0 +COFF-NEXT: Number: 1 +COFF-NEXT: Selection: 0x0 +COFF-NEXT: Unused: (00 00 00) +COFF-NEXT: } +COFF-NEXT: } +COFF-NEXT: Symbol { +COFF-NEXT: Name: _main +COFF-NEXT: Value: 0 +COFF-NEXT: Section: .text (1) +COFF-NEXT: BaseType: Null (0x0) +COFF-NEXT: ComplexType: Function (0x2) +COFF-NEXT: StorageClass: External (0x2) +COFF-NEXT: AuxSymbolCount: 0 +COFF-NEXT: } +COFF-NEXT: ] +COFF-NEXT: SectionData ( +COFF-NEXT: 0000: 50C70424 00000000 E8000000 00E80000 |P..$............| +COFF-NEXT: 0010: 000031C0 5AC3 |..1.Z.| +COFF-NEXT: ) +COFF-NEXT: } + +ELF: Sections [ +ELF-NEXT: Section { +ELF-NEXT: Index: 0 +ELF-NEXT: Name: (0) +ELF-NEXT: Type: SHT_NULL (0x0) +ELF-NEXT: Flags [ (0x0) +ELF-NEXT: ] +ELF-NEXT: Address: 0x0 +ELF-NEXT: Offset: 0x0 +ELF-NEXT: Size: 0 +ELF-NEXT: Link: 0 +ELF-NEXT: Info: 0 +ELF-NEXT: AddressAlignment: 0 +ELF-NEXT: EntrySize: 0 +ELF-NEXT: Relocations [ +ELF-NEXT: ] +ELF-NEXT: Symbols [ +ELF-NEXT: ] +ELF-NEXT: SectionData ( +ELF-NEXT: ) +ELF-NEXT: } +ELF-NEXT: Section { +ELF-NEXT: Index: 1 +ELF-NEXT: Name: .text (5) +ELF-NEXT: Type: SHT_PROGBITS (0x1) +ELF-NEXT: Flags [ (0x6) +ELF-NEXT: SHF_ALLOC (0x2) +ELF-NEXT: SHF_EXECINSTR (0x4) +ELF-NEXT: ] +ELF-NEXT: Address: 0x0 +ELF-NEXT: Offset: 0x40 +ELF-NEXT: Size: 42 +ELF-NEXT: Link: 0 +ELF-NEXT: Info: 0 +ELF-NEXT: AddressAlignment: 16 +ELF-NEXT: EntrySize: 0 +ELF-NEXT: Relocations [ +ELF-NEXT: 0xC R_386_GOTPC _GLOBAL_OFFSET_TABLE_ 0x0 +ELF-NEXT: 0x12 R_386_GOTOFF .L.str 0x0 +ELF-NEXT: 0x1A R_386_PLT32 puts 0x0 +ELF-NEXT: 0x1F R_386_PLT32 SomeOtherFunction 0x0 +ELF-NEXT: ] +ELF-NEXT: Symbols [ +ELF-NEXT: Symbol { +ELF-NEXT: Name: .text (0) +ELF-NEXT: Value: 0x0 +ELF-NEXT: Size: 0 +ELF-NEXT: Binding: Local (0x0) +ELF-NEXT: Type: Section (0x3) +ELF-NEXT: Other: 0 +ELF-NEXT: Section: .text (0x1) +ELF-NEXT: } +ELF-NEXT: Symbol { +ELF-NEXT: Name: main (12) +ELF-NEXT: Value: 0x0 +ELF-NEXT: Size: 42 +ELF-NEXT: Binding: Global (0x1) +ELF-NEXT: Type: Function (0x2) +ELF-NEXT: Other: 0 +ELF-NEXT: Section: .text (0x1) +ELF-NEXT: } +ELF-NEXT: ] +ELF-NEXT: SectionData ( +ELF-NEXT: 0000: 5383EC08 E8000000 005B81C3 03000000 |S........[......| +ELF-NEXT: 0010: 8D830000 00008904 24E8FCFF FFFFE8FC |........$.......| +ELF-NEXT: 0020: FFFFFF31 C083C408 5BC3 |...1....[.| +ELF-NEXT: ) +ELF-NEXT: } + +MACHO: Sections [ +MACHO-NEXT: Section { +MACHO-NEXT: Index: 0 +MACHO-NEXT: Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00) +MACHO-NEXT: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00) +MACHO-NEXT: Address: 0x0 +MACHO-NEXT: Size: 0x22 +MACHO-NEXT: Offset: 324 +MACHO-NEXT: Alignment: 4 +MACHO-NEXT: RelocationOffset: 0x174 +MACHO-NEXT: RelocationCount: 4 +MACHO-NEXT: Type: 0x0 +MACHO-NEXT: Attributes [ (0x800004) +MACHO-NEXT: PureInstructions (0x800000) +MACHO-NEXT: SomeInstructions (0x4) +MACHO-NEXT: ] +MACHO-NEXT: Reserved1: 0x0 +MACHO-NEXT: Reserved2: 0x0 +MACHO-NEXT: Relocations [ +MACHO-NEXT: 0x18 GENERIC_RELOC_VANILLA _SomeOtherFunction 0x0 +MACHO-NEXT: 0x13 GENERIC_RELOC_VANILLA _puts 0x0 +MACHO-NEXT: 0xB GENERIC_RELOC_LOCAL_SECTDIFF _main 0x{{[0-9A-F]+}} +MACHO-NEXT: 0x0 GENERIC_RELOC_PAIR _main 0x{{[0-9A-F]+}} +MACHO-NEXT: ] +MACHO-NEXT: Symbols [ +MACHO-NEXT: Symbol { +MACHO-NEXT: Name: _main (1) +MACHO-NEXT: Type: 0xF +MACHO-NEXT: Section: __text (0x1) +MACHO-NEXT: RefType: UndefinedNonLazy (0x0) +MACHO-NEXT: Flags [ (0x0) +MACHO-NEXT: ] +MACHO-NEXT: Value: 0x0 +MACHO-NEXT: } +MACHO-NEXT: ] +MACHO-NEXT: SectionData ( +MACHO-NEXT: 0000: 83EC0CE8 00000000 588D801A 00000089 |........X.......| +MACHO-NEXT: 0010: 0424E8E9 FFFFFFE8 E4FFFFFF 31C083C4 |.$..........1...| +MACHO-NEXT: 0020: 0CC3 |..| +MACHO-NEXT: ) +MACHO-NEXT: } diff --git a/test/tools/llvm-readobj/sections.test b/test/tools/llvm-readobj/sections.test new file mode 100644 index 0000000000..84154d759c --- /dev/null +++ b/test/tools/llvm-readobj/sections.test @@ -0,0 +1,113 @@ +RUN: llvm-readobj -s %p/Inputs/trivial.obj.coff-i386 \ +RUN: | FileCheck %s -check-prefix COFF +RUN: llvm-readobj -s %p/Inputs/trivial.obj.elf-i386 \ +RUN: | FileCheck %s -check-prefix ELF +RUN: llvm-readobj -s %p/Inputs/trivial.obj.macho-i386 \ +RUN: | FileCheck %s -check-prefix MACHO + +COFF: Sections [ +COFF-NEXT: Section { +COFF-NEXT: Number: 1 +COFF-NEXT: Name: .text (2E 74 65 78 74 00 00 00) +COFF-NEXT: VirtualSize: 0x0 +COFF-NEXT: VirtualAddress: 0x0 +COFF-NEXT: RawDataSize: 22 +COFF-NEXT: PointerToRawData: 0x64 +COFF-NEXT: PointerToRelocations: 0x7A +COFF-NEXT: PointerToLineNumbers: 0x0 +COFF-NEXT: RelocationCount: 3 +COFF-NEXT: LineNumberCount: 0 +COFF-NEXT: Characteristics [ (0x60500020) +COFF-NEXT: IMAGE_SCN_ALIGN_16BYTES (0x500000) +COFF-NEXT: IMAGE_SCN_CNT_CODE (0x20) +COFF-NEXT: IMAGE_SCN_MEM_EXECUTE (0x20000000) +COFF-NEXT: IMAGE_SCN_MEM_READ (0x40000000) +COFF-NEXT: ] +COFF-NEXT: } +COFF-NEXT: Section { +COFF-NEXT: Number: 2 +COFF-NEXT: Name: .data (2E 64 61 74 61 00 00 00) +COFF-NEXT: VirtualSize: 0x0 +COFF-NEXT: VirtualAddress: 0x0 +COFF-NEXT: RawDataSize: 13 +COFF-NEXT: PointerToRawData: 0x98 +COFF-NEXT: PointerToRelocations: 0x0 +COFF-NEXT: PointerToLineNumbers: 0x0 +COFF-NEXT: RelocationCount: 0 +COFF-NEXT: LineNumberCount: 0 +COFF-NEXT: Characteristics [ (0xC0300040) +COFF-NEXT: IMAGE_SCN_ALIGN_4BYTES (0x300000) +COFF-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40) +COFF-NEXT: IMAGE_SCN_MEM_READ (0x40000000) +COFF-NEXT: IMAGE_SCN_MEM_WRITE (0x80000000) +COFF-NEXT: ] +COFF-NEXT: } +COFF-NEXT: ] + +ELF: Sections [ +ELF-NEXT: Section { +ELF-NEXT: Index: 0 +ELF-NEXT: Name: (0) +ELF-NEXT: Type: SHT_NULL (0x0) +ELF-NEXT: Flags [ (0x0) +ELF-NEXT: ] +ELF-NEXT: Address: 0x0 +ELF-NEXT: Offset: 0x0 +ELF-NEXT: Size: 0 +ELF-NEXT: Link: 0 +ELF-NEXT: Info: 0 +ELF-NEXT: AddressAlignment: 0 +ELF-NEXT: EntrySize: 0 +ELF-NEXT: } +ELF-NEXT: Section { +ELF-NEXT: Index: 1 +ELF-NEXT: Name: .text (5) +ELF-NEXT: Type: SHT_PROGBITS (0x1) +ELF-NEXT: Flags [ (0x6) +ELF-NEXT: SHF_ALLOC (0x2) +ELF-NEXT: SHF_EXECINSTR (0x4) +ELF-NEXT: ] +ELF-NEXT: Address: 0x0 +ELF-NEXT: Offset: 0x40 +ELF-NEXT: Size: 42 +ELF-NEXT: Link: 0 +ELF-NEXT: Info: 0 +ELF-NEXT: AddressAlignment: 16 +ELF-NEXT: EntrySize: 0 +ELF-NEXT: } + +MACHO: Sections [ +MACHO-NEXT: Section { +MACHO-NEXT: Index: 0 +MACHO-NEXT: Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00) +MACHO-NEXT: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00) +MACHO-NEXT: Address: 0x0 +MACHO-NEXT: Size: 0x22 +MACHO-NEXT: Offset: 324 +MACHO-NEXT: Alignment: 4 +MACHO-NEXT: RelocationOffset: 0x174 +MACHO-NEXT: RelocationCount: 4 +MACHO-NEXT: Type: 0x0 +MACHO-NEXT: Attributes [ (0x800004) +MACHO-NEXT: PureInstructions (0x800000) +MACHO-NEXT: SomeInstructions (0x4) +MACHO-NEXT: ] +MACHO-NEXT: Reserved1: 0x0 +MACHO-NEXT: Reserved2: 0x0 +MACHO-NEXT: } +MACHO-NEXT: Section { +MACHO-NEXT: Index: 1 +MACHO-NEXT: Name: __cstring (5F 5F 63 73 74 72 69 6E 67 00 00 00 00 00 00 00) +MACHO-NEXT: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00) +MACHO-NEXT: Address: 0x22 +MACHO-NEXT: Size: 0xD +MACHO-NEXT: Offset: 358 +MACHO-NEXT: Alignment: 0 +MACHO-NEXT: RelocationOffset: 0x0 +MACHO-NEXT: RelocationCount: 0 +MACHO-NEXT: Type: ExtReloc (0x2) +MACHO-NEXT: Attributes [ (0x0) +MACHO-NEXT: ] +MACHO-NEXT: Reserved1: 0x0 +MACHO-NEXT: Reserved2: 0x0 +MACHO-NEXT: } diff --git a/test/tools/llvm-readobj/symbols.test b/test/tools/llvm-readobj/symbols.test new file mode 100644 index 0000000000..d33bd8ed2c --- /dev/null +++ b/test/tools/llvm-readobj/symbols.test @@ -0,0 +1,44 @@ +RUN: llvm-readobj -t %p/Inputs/trivial.obj.coff-i386 \ +RUN: | FileCheck %s -check-prefix COFF +RUN: llvm-readobj -t %p/Inputs/trivial.obj.elf-i386 \ +RUN: | FileCheck %s -check-prefix ELF + +COFF: Symbols [ +COFF-NEXT: Symbol { +COFF-NEXT: Name: .text +COFF-NEXT: Value: 0 +COFF-NEXT: Section: .text (1) +COFF-NEXT: BaseType: Null (0x0) +COFF-NEXT: ComplexType: Null (0x0) +COFF-NEXT: StorageClass: Static (0x3) +COFF-NEXT: AuxSymbolCount: 1 +COFF-NEXT: AuxSectionDef { +COFF-NEXT: Length: 22 +COFF-NEXT: RelocationCount: 3 +COFF-NEXT: LineNumberCount: 0 +COFF-NEXT: Checksum: 0x0 +COFF-NEXT: Number: 1 +COFF-NEXT: Selection: 0x0 +COFF-NEXT: Unused: (00 00 00) +COFF-NEXT: } +COFF-NEXT: } + +ELF: Symbols [ +ELF-NEXT: Symbol { +ELF-NEXT: Name: trivial.ll (1) +ELF-NEXT: Value: 0x0 +ELF-NEXT: Size: 0 +ELF-NEXT: Binding: Local (0x0) +ELF-NEXT: Type: File (0x4) +ELF-NEXT: Other: 0 +ELF-NEXT: Section: (0xFFF1) +ELF-NEXT: } +ELF-NEXT: Symbol { +ELF-NEXT: Name: .L.str (39) +ELF-NEXT: Value: 0x0 +ELF-NEXT: Size: 13 +ELF-NEXT: Binding: Local (0x0) +ELF-NEXT: Type: Object (0x1) +ELF-NEXT: Other: 0 +ELF-NEXT: Section: .rodata.str1.1 (0x5) +ELF-NEXT: } |