diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2015-01-18 16:17:27 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2015-01-18 16:17:27 +0000 |
| commit | 67c32a98315f785a9ec9d531c1f571a0196c7463 (patch) | |
| tree | 4abb9cbeecc7901726dd0b4a37369596c852e9ef /test/Object | |
| parent | 9f61947910e6ab40de38e6b4034751ef1513200f (diff) | |
Notes
Diffstat (limited to 'test/Object')
45 files changed, 549 insertions, 281 deletions
diff --git a/test/Object/AArch64/yaml2obj-elf-aarch64-rel.yaml b/test/Object/AArch64/yaml2obj-elf-aarch64-rel.yaml new file mode 100644 index 000000000000..b8fb68113c76 --- /dev/null +++ b/test/Object/AArch64/yaml2obj-elf-aarch64-rel.yaml @@ -0,0 +1,55 @@ +# RUN: yaml2obj -format=elf %s > %t +# RUN: obj2yaml %t | FileCheck %s + +# CHECK: - Name: .rela.text +# CHECK-NEXT: Type: SHT_RELA +# CHECK-NEXT: Link: .symtab +# CHECK-NEXT: AddressAlign: 0x0000000000000008 +# CHECK-NEXT: Info: .text +# CHECK-NEXT: Relocations: +# CHECK-NEXT: - Offset: 0x0000000000000000 +# CHECK-NEXT: Symbol: main +# CHECK-NEXT: Type: R_AARCH64_ABS64 +# CHECK-NEXT: Addend: 0 +# CHECK-NEXT: - Offset: 0x0000000000000008 +# CHECK-NEXT: Symbol: main +# CHECK-NEXT: Type: R_AARCH64_TLSGD_ADR_PREL21 +# CHECK-NEXT: Addend: 0 + +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_AARCH64 +Sections: + - Type: SHT_PROGBITS + Name: .text + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + AddressAlign: 0x04 + Content: 00000000000000000000000000000000 + - Type: SHT_RELA + Name: .rela.text + Link: .symtab + Info: .text + AddressAlign: 0x08 + Relocations: + - Offset: 0 + Symbol: main + Type: R_AARCH64_ABS64 + Addend: 0 + - Offset: 8 + Symbol: main + Type: R_AARCH64_TLSGD_ADR_PREL21 + Addend: 0 + +Symbols: + Local: + - Name: .text + Type: STT_SECTION + Section: .text + + Global: + - Name: main + Type: STT_FUNC + Section: .text + Size: 0x08 diff --git a/test/Object/ARM/macho-data-in-code.test b/test/Object/ARM/macho-data-in-code.test index dca084c2caba..2bfb6c118644 100644 --- a/test/Object/ARM/macho-data-in-code.test +++ b/test/Object/ARM/macho-data-in-code.test @@ -3,5 +3,5 @@ RUN: llvm-objdump -triple thumbv7-apple-iOS -disassemble %p/../Inputs/macho-data CHECK: 12: 80 bd pop {r7, pc} CHECK: 14: 38 00 00 00 .long 56 @ KIND_DATA -CHECK: 16: 00 00 movs r0, r0 +CHECK: 18: 70 47 bx lr diff --git a/test/Object/Inputs/COFF/long-section-name.yaml b/test/Object/Inputs/COFF/long-section-name.yaml new file mode 100644 index 000000000000..a86f9019cd5c --- /dev/null +++ b/test/Object/Inputs/COFF/long-section-name.yaml @@ -0,0 +1,11 @@ +--- +header: + Machine: IMAGE_FILE_MACHINE_I386 + Characteristics: [ IMAGE_FILE_RELOCS_STRIPPED, IMAGE_FILE_LINE_NUMS_STRIPPED, IMAGE_FILE_LOCAL_SYMS_STRIPPED, IMAGE_FILE_32BIT_MACHINE ] +sections: + - Name: .long_section_name + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ] + Alignment: 1 + SectionData: '' +symbols: +... diff --git a/test/Object/Inputs/COFF/section-aux-symbol.yaml b/test/Object/Inputs/COFF/section-aux-symbol.yaml new file mode 100644 index 000000000000..623af5589595 --- /dev/null +++ b/test/Object/Inputs/COFF/section-aux-symbol.yaml @@ -0,0 +1,167 @@ +--- +header: + Machine: IMAGE_FILE_MACHINE_I386 + Characteristics: [ IMAGE_FILE_RELOCS_STRIPPED, IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LINE_NUMS_STRIPPED, IMAGE_FILE_32BIT_MACHINE, IMAGE_FILE_DEBUG_STRIPPED ] +sections: + - Name: .CRT + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ] + Alignment: 4 + SectionData: 0000000030114000000000000000000010104000401640000000000000000000B015400060154000000000000000000000000000 +symbols: + - Name: '.CRT$XCAA' + Value: 4 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 4 + NumberOfRelocations: 1 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: '.CRT$XIAA' + Value: 16 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 4 + NumberOfRelocations: 1 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: '.CRT$XLD' + Value: 36 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 4 + NumberOfRelocations: 1 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: '.CRT$XLC' + Value: 32 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 4 + NumberOfRelocations: 1 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: '.CRT$XDZ' + Value: 48 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 4 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: '.CRT$XDA' + Value: 44 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 4 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: '.CRT$XLZ' + Value: 40 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 4 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: '.CRT$XLA' + Value: 28 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 4 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: '.CRT$XIC' + Value: 20 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 4 + NumberOfRelocations: 1 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: '.CRT$XCZ' + Value: 8 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 4 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: '.CRT$XCA' + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 4 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: '.CRT$XIZ' + Value: 24 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 4 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 + - Name: '.CRT$XIA' + Value: 12 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 4 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 0 +... diff --git a/test/Object/Inputs/macho-archive-unsorted-x86_64.a b/test/Object/Inputs/macho-archive-unsorted-x86_64.a Binary files differnew file mode 100644 index 000000000000..6a2b570f1609 --- /dev/null +++ b/test/Object/Inputs/macho-archive-unsorted-x86_64.a diff --git a/test/Object/Inputs/macho-no-exports.dylib b/test/Object/Inputs/macho-no-exports.dylib Binary files differnew file mode 100755 index 000000000000..6e1be6ca97e6 --- /dev/null +++ b/test/Object/Inputs/macho-no-exports.dylib diff --git a/test/Object/Inputs/macho-rpath-x86_64 b/test/Object/Inputs/macho-rpath-x86_64 Binary files differnew file mode 100755 index 000000000000..c518fcdb3b59 --- /dev/null +++ b/test/Object/Inputs/macho-rpath-x86_64 diff --git a/test/Object/Inputs/macho-zero-ncmds b/test/Object/Inputs/macho-zero-ncmds Binary files differnew file mode 100644 index 000000000000..0505419195e9 --- /dev/null +++ b/test/Object/Inputs/macho-zero-ncmds diff --git a/test/Object/Inputs/micro-mips.elf-mipsel b/test/Object/Inputs/micro-mips.elf-mipsel Binary files differnew file mode 100755 index 000000000000..80b8472c25bc --- /dev/null +++ b/test/Object/Inputs/micro-mips.elf-mipsel diff --git a/test/Object/Inputs/mri-crlf.mri b/test/Object/Inputs/mri-crlf.mri new file mode 100644 index 000000000000..b8540304f2ee --- /dev/null +++ b/test/Object/Inputs/mri-crlf.mri @@ -0,0 +1,2 @@ +; this file intentionally has crlf line endings
+end
diff --git a/test/Object/Inputs/thin.a b/test/Object/Inputs/thin.a Binary files differnew file mode 100644 index 000000000000..bb9d532a7879 --- /dev/null +++ b/test/Object/Inputs/thin.a diff --git a/test/Object/Inputs/trivial-label-test.elf-x86-64 b/test/Object/Inputs/trivial-label-test.elf-x86-64 Binary files differnew file mode 100644 index 000000000000..76f4499a8344 --- /dev/null +++ b/test/Object/Inputs/trivial-label-test.elf-x86-64 diff --git a/test/Object/Mips/objdump-micro-mips.test b/test/Object/Mips/objdump-micro-mips.test new file mode 100644 index 000000000000..0f28dc1a5f1c --- /dev/null +++ b/test/Object/Mips/objdump-micro-mips.test @@ -0,0 +1,12 @@ +RUN: llvm-objdump -d -mattr=micromips %p/../Inputs/micro-mips.elf-mipsel \ +RUN: | FileCheck %s + +CHECK: foo: +CHECK-NEXT: 330: bd 33 f8 ff addiu $sp, $sp, -8 +CHECK-NEXT: 334: dd fb 04 00 sw $fp, 4($sp) +CHECK-NEXT: 338: 1d 00 50 f1 addu $fp, $sp, $zero + +CHECK: bar: +CHECK-NEXT: 350: a2 41 02 00 lui $2, 2 +CHECK-NEXT: 354: 42 30 8f 80 addiu $2, $2, -32625 +CHECK-NEXT: 358: bd 33 e8 ff addiu $sp, $sp, -24 diff --git a/test/Object/X86/nm-ir.ll b/test/Object/X86/nm-ir.ll index 6bb7e2323a22..881397c00a42 100644 --- a/test/Object/X86/nm-ir.ll +++ b/test/Object/X86/nm-ir.ll @@ -28,7 +28,7 @@ module asm ".long undef_asm_sym" @g4 = private global i32 42 @a1 = alias i32* @g1 -@a2 = alias internal i32* @g1 +@a2 = internal alias i32* @g1 define void @f1() { ret void diff --git a/test/Object/X86/objdump-cfg-invalid-opcode.yaml b/test/Object/X86/objdump-cfg-invalid-opcode.yaml deleted file mode 100644 index d0a29be8697d..000000000000 --- a/test/Object/X86/objdump-cfg-invalid-opcode.yaml +++ /dev/null @@ -1,58 +0,0 @@ -# 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 deleted file mode 100644 index 87cb4e13ec1e..000000000000 --- a/test/Object/X86/objdump-cfg-textatomsize.yaml +++ /dev/null @@ -1,39 +0,0 @@ -# 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 deleted file mode 100644 index c5bff03c1d0c..000000000000 --- a/test/Object/X86/objdump-cfg.yaml +++ /dev/null @@ -1,86 +0,0 @@ -# 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-inline-relocations.test b/test/Object/X86/objdump-disassembly-inline-relocations.test index 78615765046d..3871bcbf0b55 100644 --- a/test/Object/X86/objdump-disassembly-inline-relocations.test +++ b/test/Object/X86/objdump-disassembly-inline-relocations.test @@ -76,11 +76,11 @@ ELF-i386: main: ELF-i386: 0: 83 ec 0c subl $12, %esp ELF-i386: 3: c7 44 24 08 00 00 00 00 movl $0, 8(%esp) ELF-i386: b: c7 04 24 00 00 00 00 movl $0, (%esp) -ELF-i386: e: R_386_32 Unknown +ELF-i386: e: R_386_32 .rodata.str1.1 ELF-i386: 12: e8 fc ff ff ff calll -4 -ELF-i386: 13: R_386_PC32 Unknown +ELF-i386: 13: R_386_PC32 puts ELF-i386: 17: e8 fc ff ff ff calll -4 -ELF-i386: 18: R_386_PC32 Unknown +ELF-i386: 18: R_386_PC32 SomeOtherFunction ELF-i386: 1c: 8b 44 24 08 movl 8(%esp), %eax ELF-i386: 20: 83 c4 0c addl $12, %esp ELF-i386: 23: c3 ret diff --git a/test/Object/X86/objdump-disassembly-symbolic.test b/test/Object/X86/objdump-disassembly-symbolic.test deleted file mode 100644 index 95a5fc8e70ac..000000000000 --- a/test/Object/X86/objdump-disassembly-symbolic.test +++ /dev/null @@ -1,68 +0,0 @@ -RUN: llvm-objdump -d -symbolize %p/../Inputs/trivial-object-test.elf-x86-64 \ -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: -ELF-x86-64: 0: 48 83 ec 08 subq $8, %rsp -ELF-x86-64: 4: c7 44 24 04 00 00 00 00 movl $0, 4(%rsp) -ELF-x86-64: c: bf 00 00 00 00 movl $.rodata.str1.1, %edi -ELF-x86-64: 11: e8 00 00 00 00 callq puts-4 -ELF-x86-64: 16: 30 c0 xorb %al, %al -ELF-x86-64: 18: e8 00 00 00 00 callq SomeOtherFunction-4 -ELF-x86-64: 1d: 8b 44 24 04 movl 4(%rsp), %eax -ELF-x86-64: 21: 48 83 c4 08 addq $8, %rsp -ELF-x86-64: 25: c3 ret - -MACHO-x86-64: file format Mach-O 64-bit x86-64 -MACHO-x86-64: Disassembly of section __TEXT,__text: -MACHO-x86-64: _main: -MACHO-x86-64: 0: 48 83 ec 08 subq $8, %rsp -MACHO-x86-64: 4: c7 44 24 04 00 00 00 00 movl $0, 4(%rsp) -MACHO-x86-64: c: 48 8d 3d 00 00 00 00 leaq L_.str(%rip), %rdi ## literal pool for: Hello World! -MACHO-x86-64: 13: e8 00 00 00 00 callq _puts -MACHO-x86-64: 18: 30 c0 xorb %al, %al -MACHO-x86-64: 1a: e8 00 00 00 00 callq _SomeOtherFunction -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 - - -RUN: llvm-objdump -d -symbolize %p/../Inputs/relocation-relocatable.elf-i386 \ -RUN: | FileCheck %s -check-prefix ELF-i386-REL - -ELF-i386-REL: Disassembly of section .text: -ELF-i386-REL-NEXT: f: -ELF-i386-REL-NEXT: 0: e9 fc ff ff ff jmp h -ELF-i386-REL: g: -ELF-i386-REL-NEXT: 5: e9 fc ff ff ff jmp f - - -RUN: llvm-objdump -d -symbolize %p/../Inputs/relocation-dynamic.elf-i386 \ -RUN: | FileCheck %s -check-prefix ELF-i386-DYN - -ELF-i386-DYN: Disassembly of section .text: -ELF-i386-DYN-NEXT: f: -ELF-i386-DYN-NEXT: 1a4: e9 fc ff ff ff jmp h -ELF-i386-DYN: g: -ELF-i386-DYN-NEXT: 1a9: e9 fc ff ff ff jmp f diff --git a/test/Object/X86/objdump-label.test b/test/Object/X86/objdump-label.test new file mode 100644 index 000000000000..f8b933451e52 --- /dev/null +++ b/test/Object/X86/objdump-label.test @@ -0,0 +1,10 @@ +RUN: llvm-objdump -d %p/../Inputs/trivial-label-test.elf-x86-64 \ +RUN: | FileCheck %s -check-prefix ELF-x86-64 + +ELF-x86-64: file format ELF64-x86-64 +ELF-x86-64: Disassembly of section .text: +ELF-x86-64: foo: +ELF-x86-64: 0: 90 nop +ELF-x86-64: bum: +ELF-x86-64: 1: 90 nop + diff --git a/test/Object/archive-error-tmp.txt b/test/Object/archive-error-tmp.txt index 061898655b6c..ed3b14559ac7 100644 --- a/test/Object/archive-error-tmp.txt +++ b/test/Object/archive-error-tmp.txt @@ -1,5 +1,3 @@ -REQUIRES: shell - Test that no temporary file is left behind on error. RUN: rm -rf %t diff --git a/test/Object/archive-symtab.test b/test/Object/archive-symtab.test index 0899828bdfbe..01f17bcc8b61 100644 --- a/test/Object/archive-symtab.test +++ b/test/Object/archive-symtab.test @@ -61,6 +61,7 @@ RUN: llvm-ranlib %t.a RUN: llvm-nm -M %t.a | FileCheck %s RUN: llvm-nm -M %p/Inputs/macho-archive-x86_64.a | FileCheck %s --check-prefix=BSD-MachO +RUN: llvm-nm -M %p/Inputs/macho-archive-unsorted-x86_64.a | FileCheck %s --check-prefix=BSD-MachO BSD-MachO: Archive map BSD-MachO: _bar in bar.o diff --git a/test/Object/archive-toc.test b/test/Object/archive-toc.test index 4195c4000649..79a6e0e0ba80 100644 --- a/test/Object/archive-toc.test +++ b/test/Object/archive-toc.test @@ -26,3 +26,11 @@ CHECK: rw-r--r-- 1002/102 8 2004-11-19 03:24:02.000000000 evenlen CHECK-NEXT: rw-r--r-- 1002/102 7 2004-11-19 03:24:02.000000000 oddlen CHECK-NEXT: rwxr-xr-x 1002/102 1465 2004-11-19 03:24:02.000000000 very_long_bytecode_file_name.bc CHECK-NEXT: rw-r--r-- 1002/102 2280 2004-11-19 03:24:02.000000000 IsNAN.o + +Test reading a thin archive created by gnu ar +RUN: env TZ=GMT llvm-ar tv %p/Inputs/thin.a | FileCheck %s --check-prefix=THIN -strict-whitespace + +THIN: rw-r--r-- 1000/1000 8 2014-12-16 00:56:27.000000000 evenlen +THIN-NEXT: rw-r--r-- 1000/1000 7 2014-12-16 00:56:27.000000000 oddlen +THIN-NEXT: rwxr-xr-x 1000/1000 1465 2014-12-16 00:56:27.000000000 very_long_bytecode_file_name.bc +THIN-NEXT: rw-r--r-- 1000/1000 2280 2014-12-16 00:56:27.000000000 IsNAN.o diff --git a/test/Object/coff-archive-short.test b/test/Object/coff-archive-short.test index 2aee95699b50..9f7165b80f56 100644 --- a/test/Object/coff-archive-short.test +++ b/test/Object/coff-archive-short.test @@ -5,7 +5,7 @@ # than 15 characters, thus, unlike coff_archive.lib, it has no string # table as the third member. # -RUN: llvm-nm --numeric-sort -M %p/Inputs/coff_archive_short.lib | FileCheck -check-prefix=CHECKIDX %s +RUN: llvm-nm -a --numeric-sort -M %p/Inputs/coff_archive_short.lib | FileCheck -check-prefix=CHECKIDX %s CHECKIDX: Archive map CHECKIDX: _shortfn1 in short1.obj diff --git a/test/Object/coff-archive.test b/test/Object/coff-archive.test index 3b0aa0ca0634..239a96b4c351 100644 --- a/test/Object/coff-archive.test +++ b/test/Object/coff-archive.test @@ -1,7 +1,7 @@ # # Check if the index is appearing properly in the output file # -RUN: llvm-nm --numeric-sort -M %p/Inputs/coff_archive.lib | FileCheck -check-prefix=CHECKIDX %s +RUN: llvm-nm -a --numeric-sort -M %p/Inputs/coff_archive.lib | FileCheck -check-prefix=CHECKIDX %s CHECKIDX: Archive map CHECKIDX: ??0invalid_argument@std@@QAE@PBD@Z in Debug\mymath.obj diff --git a/test/Object/mri-addlib.test b/test/Object/mri-addlib.test new file mode 100644 index 000000000000..745bcf65e7f4 --- /dev/null +++ b/test/Object/mri-addlib.test @@ -0,0 +1,14 @@ +; RUN: echo create %t.a > %t.mri +; RUN: echo addlib %p/Inputs/GNU.a >> %t.mri +; RUN: echo addlib %p/Inputs/archive-test.a-gnu-minimal >> %t.mri +; RUN: echo save >> %t.mri +; RUN: echo end >> %t.mri + +; RUN: llvm-ar -M < %t.mri +; RUN: llvm-ar t %t.a | FileCheck %s + +; CHECK: evenlen +; CHECK-NEXT: oddlen +; CHECK-NEXT: very_long_bytecode_file_name.bc +; CHECK-NEXT: IsNAN.o +; CHECK-NEXT: test diff --git a/test/Object/mri-addmod.test b/test/Object/mri-addmod.test new file mode 100644 index 000000000000..f1048489e95e --- /dev/null +++ b/test/Object/mri-addmod.test @@ -0,0 +1,33 @@ +; RUN: echo create %t.a > %t.mri +; RUN: echo "addmod \"%p/Inputs/trivial-object-test.elf-x86-64\" " >> %t.mri +; RUN: echo save >> %t.mri +; RUN: echo end >> %t.mri + +; RUN: llvm-ar -M < %t.mri +; RUN: llvm-nm -M %t.a | FileCheck %s + +; CHECK: Archive map +; CHECK-NEXT: main in trivial-object-test.elf-x86-64 + +; CHECK: trivial-object-test.elf-x86-64: +; CHECK-NEXT: U SomeOtherFunction +; CHECK-NEXT: 0000000000000000 T main +; CHECK-NEXT: U puts + +; Now test that CREATE overwrites an existing file. +; RUN: echo create %t.a > %t2.mri +; RUN: echo addmod %p/Inputs/trivial-object-test2.elf-x86-64 >> %t2.mri +; RUN: echo save >> %t2.mri +; RUN: echo end >> %t2.mri + +; RUN: llvm-ar -M < %t2.mri +; RUN: llvm-nm -M %t.a | FileCheck --check-prefix=NEW %s + +; NEW: Archive map +; NEW-NEXT: foo in trivial-object-test2.elf-x86-64 +; NEW-NEXT: main in trivial-object-test2.elf-x86-64 + +; NEW: trivial-object-test2.elf-x86-64: +; NEW-NEXT: 0000000000000000 t bar +; NEW-NEXT: 0000000000000006 T foo +; NEW-NEXT: 0000000000000016 T main diff --git a/test/Object/mri-crlf.test b/test/Object/mri-crlf.test new file mode 100644 index 000000000000..3411b55095e1 --- /dev/null +++ b/test/Object/mri-crlf.test @@ -0,0 +1 @@ +; RUN: llvm-ar -M < %S/Inputs/mri-crlf.mri diff --git a/test/Object/mri1.test b/test/Object/mri1.test new file mode 100644 index 000000000000..3d27db7996a2 --- /dev/null +++ b/test/Object/mri1.test @@ -0,0 +1,6 @@ +; RUN: echo create %t.a > %t.mri +; RUN: echo save >> %t.mri +; RUN: echo end >> %t.mri + +; RUN: llvm-ar -M < %t.mri +; RUN: llvm-ar t %t.a diff --git a/test/Object/mri2.test b/test/Object/mri2.test new file mode 100644 index 000000000000..0c2417934177 --- /dev/null +++ b/test/Object/mri2.test @@ -0,0 +1,7 @@ +; RUN: echo create %t.a > %t.mri +; RUN: echo create %t.a >> %t.mri +; RUN: echo save >> %t.mri +; RUN: echo end >> %t.mri + +; RUN: not llvm-ar -M < %t.mri 2>&1 | FileCheck %s +; CHECK: Editing multiple archives not supported diff --git a/test/Object/mri3.test b/test/Object/mri3.test new file mode 100644 index 000000000000..bdc53991510e --- /dev/null +++ b/test/Object/mri3.test @@ -0,0 +1,6 @@ +; RUN: echo save > %t.mri +; RUN: echo create %t.a >> %t.mri +; RUN: echo end >> %t.mri + +; RUN: not llvm-ar -M < %t.mri 2>&1 | FileCheck %s +; CHECK: File already saved. diff --git a/test/Object/mri4.test b/test/Object/mri4.test new file mode 100644 index 000000000000..a24c14d7d289 --- /dev/null +++ b/test/Object/mri4.test @@ -0,0 +1,4 @@ +; RUN: echo abc > %t.mri + +; RUN: not llvm-ar -M < %t.mri 2>&1 | FileCheck %s +; CHECK: Unknown command: abc. diff --git a/test/Object/mri5.test b/test/Object/mri5.test new file mode 100644 index 000000000000..98114248b69c --- /dev/null +++ b/test/Object/mri5.test @@ -0,0 +1,2 @@ +; RUN: not llvm-ar -M t < %s 2>&1 | FileCheck %s +; CHECK: Cannot mix -M and other options. diff --git a/test/Object/nm-archive.test b/test/Object/nm-archive.test index 7dbc22a1e8cf..a9ae9cbbfbd6 100644 --- a/test/Object/nm-archive.test +++ b/test/Object/nm-archive.test @@ -1,4 +1,4 @@ -RUN: llvm-nm %p/Inputs/archive-test.a-coff-i386 \ +RUN: llvm-nm -a %p/Inputs/archive-test.a-coff-i386 \ RUN: | FileCheck %s -check-prefix COFF COFF: trivial-object-test.coff-i386: @@ -9,6 +9,15 @@ COFF-NEXT: U _SomeOtherFunction COFF-NEXT: 00000000 T _main COFF-NEXT: U _puts +RUN: llvm-nm -a -o %p/Inputs/archive-test.a-coff-i386 \ +RUN: | FileCheck %s -check-prefix COFF-o + +COFF-o: {{.*}}/archive-test.a-coff-i386:trivial-object-test.coff-i386: 00000000 d .data +COFF-o: {{.*}}/archive-test.a-coff-i386:trivial-object-test.coff-i386: 00000000 t .text +COFF-o: {{.*}}/archive-test.a-coff-i386:trivial-object-test.coff-i386: 00000000 d L_.str +COFF-o: {{.*}}/archive-test.a-coff-i386:trivial-object-test.coff-i386: U _SomeOtherFunction +COFF-o: {{.*}}/archive-test.a-coff-i386:trivial-object-test.coff-i386: 00000000 T _main +COFF-o: {{.*}}/archive-test.a-coff-i386:trivial-object-test.coff-i386: U _puts RUN: llvm-as %p/Inputs/trivial.ll -o=%t1 RUN: rm -f %t2 diff --git a/test/Object/nm-trivial-object.test b/test/Object/nm-trivial-object.test index 49c7683c80d4..0135f2df3cb0 100644 --- a/test/Object/nm-trivial-object.test +++ b/test/Object/nm-trivial-object.test @@ -1,9 +1,13 @@ -RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-nm - \ +RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-nm -a -S - \ RUN: | FileCheck %s -check-prefix COFF -RUN: yaml2obj %p/Inputs/COFF/x86-64.yaml | llvm-nm - \ +RUN: yaml2obj %p/Inputs/COFF/x86-64.yaml | llvm-nm -a -S - \ RUN: | FileCheck %s -check-prefix COFF RUN: llvm-nm %p/Inputs/trivial-object-test.elf-i386 \ RUN: | FileCheck %s -check-prefix ELF +RUN: llvm-nm -o %p/Inputs/trivial-object-test.elf-i386 \ +RUN: | FileCheck %s -check-prefix ELF-o +RUN: llvm-nm -u %p/Inputs/trivial-object-test.elf-i386 \ +RUN: | FileCheck %s -check-prefix ELF-u RUN: llvm-nm %p/Inputs/trivial-object-test.elf-x86-64 \ RUN: | FileCheck %s -check-prefix ELF64 RUN: llvm-nm %p/Inputs/weak.elf-x86-64 \ @@ -26,9 +30,13 @@ RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 -s __DATA __data \ RUN: | FileCheck %s -check-prefix macho-s RUN: llvm-nm -x %p/Inputs/macho-text-data-bss.macho-x86_64 \ RUN: | FileCheck %s -check-prefix macho-x +RUN: llvm-nm -o %p/Inputs/macho-text-data-bss.macho-x86_64 \ +RUN: | FileCheck %s -check-prefix macho-o RUN: llvm-nm -p -a %p/Inputs/macho-hello-g.macho-x86_64 \ RUN: | FileCheck %s -check-prefix macho-pa -RUN: llvm-nm %p/Inputs/common.coff-i386 \ +RUN: llvm-nm -u %p/Inputs/macho-hello-g.macho-x86_64 \ +RUN: | FileCheck %s -check-prefix macho-u +RUN: llvm-nm -S -a %p/Inputs/common.coff-i386 \ RUN: | FileCheck %s -check-prefix COFF-COMMON RUN: llvm-nm %p/Inputs/relocatable-with-section-address.elf-x86-64 \ RUN: | FileCheck %s -check-prefix ELF-SEC-ADDR64 @@ -41,20 +49,20 @@ RUN: llvm-nm | FileCheck %s -check-prefix A-OUT REQUIRES: shell -COFF: 00000000 d .data -COFF: 00000000 t .text -COFF: 00000000 d L{{_?}}.str +COFF: 00000000 {{.*}} d .data +COFF: 00000000 {{.*}} t .text +COFF: 00000000 0000000d d L{{_?}}.str COFF: U {{_?}}SomeOtherFunction -COFF: 00000000 T {{_?}}main +COFF: 00000000 {{.*}} T {{_?}}main COFF: U {{_?}}puts -COFF-COMMON: 00000000 b .bss -COFF-COMMON-NEXT: 00000000 d .data -COFF-COMMON-NEXT: 00000000 d .drectve -COFF-COMMON-NEXT: 00000000 n .file -COFF-COMMON-NEXT: 00000000 r .rdata$zzz -COFF-COMMON-NEXT: 00000000 t .text -COFF-COMMON-NEXT: C _a +COFF-COMMON: 00000000 00000000 b .bss +COFF-COMMON-NEXT: 00000000 00000000 d .data +COFF-COMMON-NEXT: 00000000 00000014 d .drectve +COFF-COMMON-NEXT: 00000000 00000000 n .file +COFF-COMMON-NEXT: 00000000 00000014 r .rdata$zzz +COFF-COMMON-NEXT: 00000000 00000000 t .text +COFF-COMMON-NEXT: 00000004 C _a ELF-NOT: U @@ -62,6 +70,13 @@ ELF: U SomeOtherFunction ELF: 00000000 T main ELF: U puts +ELF-o: {{.*}}/trivial-object-test.elf-i386: U SomeOtherFunction +ELF-o: {{.*}}/trivial-object-test.elf-i386: 00000000 T main +ELF-o: {{.*}}/trivial-object-test.elf-i386: U puts + +ELF-u: U SomeOtherFunction +ELF-u: U puts + ELF64: U SomeOtherFunction ELF64: 0000000000000000 T main ELF64: U puts @@ -117,6 +132,13 @@ macho-x: 000000000000000c 0f 02 0000 00000004 _d macho-x: 0000000000000000 0f 01 0000 00000001 _t macho-x: 0000000000000048 0f 05 0000 00000007 _t.eh + +macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000030 s EH_frame0 +macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000070 b _b +macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 000000000000000c D _d +macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000000 T _t +macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000048 S _t.eh + macho-pa: 0000000000000000 - 00 0000 SO /Volumes/SandBox/ macho-pa: 0000000000000000 - 00 0000 SO hello.c macho-pa: 0000000053c8408d - 03 0001 OSO /Volumes/SandBox/hello.o @@ -130,6 +152,9 @@ macho-pa: 0000000100000f30 T _main macho-pa: U _printf macho-pa: U dyld_stub_binder +macho-u: _printf +macho-u: dyld_stub_binder + Test that nm uses addresses even with ELF .o files. ELF-SEC-ADDR64: 0000000000000058 D a ELF-SEC-ADDR64-NEXT: 000000000000005c D b diff --git a/test/Object/nm-universal-binary.test b/test/Object/nm-universal-binary.test index 889377b5b35b..0cced1829c3f 100644 --- a/test/Object/nm-universal-binary.test +++ b/test/Object/nm-universal-binary.test @@ -2,10 +2,16 @@ RUN: llvm-nm -arch all %p/Inputs/macho-universal.x86_64.i386 \ RUN: | FileCheck %s -check-prefix CHECK-OBJ RUN: llvm-nm -arch x86_64 %p/Inputs/macho-universal.x86_64.i386 \ RUN: | FileCheck %s -check-prefix CHECK-OBJ-x86_64 +RUN: not llvm-nm -arch armv7m %p/Inputs/macho-universal.x86_64.i386 2>&1 \ +RUN: | FileCheck %s -check-prefix CHECK-OBJ-armv7m +RUN: not llvm-nm -arch foobar %p/Inputs/macho-universal.x86_64.i386 2>&1 \ +RUN: | FileCheck %s -check-prefix CHECK-OBJ-foobar RUN: llvm-nm -arch all %p/Inputs/macho-universal-archive.x86_64.i386 \ RUN: | FileCheck %s -check-prefix CHECK-AR RUN: llvm-nm -arch i386 %p/Inputs/macho-universal-archive.x86_64.i386 \ RUN: | FileCheck %s -check-prefix CHECK-AR-i386 +RUN: llvm-nm -o -arch all %p/Inputs/macho-universal-archive.x86_64.i386 \ +RUN: | FileCheck %s -check-prefix CHECK-AR-o CHECK-OBJ: macho-universal.x86_64.i386 (for architecture x86_64): CHECK-OBJ: 0000000100000f60 T _main @@ -16,6 +22,12 @@ CHECK-OBJ-x86_64: 0000000100000000 T __mh_execute_header CHECK-OBJ-x86_64: 0000000100000f60 T _main CHECK-OBJ-x86_64: U dyld_stub_binder +CHECK-OBJ-armv7m-NOT: Unknown architecture named +CHECK-OBJ-armv7m: does not contain architecture + +CHECK-OBJ-foobar: Unknown architecture named +CHECK-OBJ-foobar: does not contain architecture + CHECK-AR: macho-universal-archive.x86_64.i386(hello.o) (for architecture x86_64): CHECK-AR: 0000000000000068 s EH_frame0 CHECK-AR: 000000000000003b s L_.str @@ -29,3 +41,11 @@ CHECK-AR: 00000000 T _foo CHECK-AR-i386: macho-universal-archive.x86_64.i386(foo.o): CHECK-AR-i386: 00000008 D _bar CHECK-AR-i386: 00000000 T _foo + +CHECK-AR-o: (for architecture x86_64):{{.*}}/macho-universal-archive.x86_64.i386:hello.o: 0000000000000068 s EH_frame0 +CHECK-AR-o: (for architecture x86_64):{{.*}}/macho-universal-archive.x86_64.i386:hello.o: 000000000000003b s L_.str +CHECK-AR-o: (for architecture x86_64):{{.*}}/macho-universal-archive.x86_64.i386:hello.o: 0000000000000000 T _main +CHECK-AR-o: (for architecture x86_64):{{.*}}/macho-universal-archive.x86_64.i386:hello.o: 0000000000000080 S _main.eh +CHECK-AR-o: (for architecture x86_64):{{.*}}/macho-universal-archive.x86_64.i386:hello.o: U _printf +CHECK-AR-o: (for architecture i386):{{.*}}/macho-universal-archive.x86_64.i386:foo.o: 00000008 D _bar +CHECK-AR-o: (for architecture i386):{{.*}}/macho-universal-archive.x86_64.i386:foo.o: 00000000 T _foo diff --git a/test/Object/obj2yaml-coff-long-section-name.test b/test/Object/obj2yaml-coff-long-section-name.test new file mode 100644 index 000000000000..5457aef28c5d --- /dev/null +++ b/test/Object/obj2yaml-coff-long-section-name.test @@ -0,0 +1,3 @@ +RUN: yaml2obj %p/Inputs/COFF/long-section-name.yaml | obj2yaml | FileCheck %s --check-prefix COFF-I386 + +COFF-I386: Name: .long_section_name diff --git a/test/Object/obj2yaml-coff-section-aux-symbol.test b/test/Object/obj2yaml-coff-section-aux-symbol.test new file mode 100644 index 000000000000..55ce5f06a31e --- /dev/null +++ b/test/Object/obj2yaml-coff-section-aux-symbol.test @@ -0,0 +1,96 @@ +RUN: yaml2obj %p/Inputs/COFF/section-aux-symbol.yaml | obj2yaml | FileCheck %s --check-prefix COFF-I386 + +COFF-I386: sections: +COFF-I386-NEXT: - Name: .CRT +COFF-I386: symbols: +COFF-I386: - Name: '.CRT$XCAA' +COFF-I386-NEXT: Value: 4 +COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC +COFF-I386-NEXT: SectionDefinition: +COFF-I386-NEXT: Length: 4 +COFF-I386-NEXT: NumberOfRelocations: 1 +COFF-I386-NEXT: NumberOfLinenumbers: 0 +COFF-I386: - Name: '.CRT$XIAA' +COFF-I386-NEXT: Value: 16 +COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC +COFF-I386-NEXT: SectionDefinition: +COFF-I386-NEXT: Length: 4 +COFF-I386-NEXT: NumberOfRelocations: 1 +COFF-I386-NEXT: NumberOfLinenumbers: 0 +COFF-I386: - Name: '.CRT$XLD' +COFF-I386-NEXT: Value: 36 +COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC +COFF-I386-NEXT: SectionDefinition: +COFF-I386-NEXT: Length: 4 +COFF-I386-NEXT: NumberOfRelocations: 1 +COFF-I386-NEXT: NumberOfLinenumbers: 0 +COFF-I386: - Name: '.CRT$XLC' +COFF-I386-NEXT: Value: 32 +COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC +COFF-I386-NEXT: SectionDefinition: +COFF-I386-NEXT: Length: 4 +COFF-I386-NEXT: NumberOfRelocations: 1 +COFF-I386-NEXT: NumberOfLinenumbers: 0 +COFF-I386: - Name: '.CRT$XDZ' +COFF-I386-NEXT: Value: 48 +COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC +COFF-I386-NEXT: SectionDefinition: +COFF-I386-NEXT: Length: 4 +COFF-I386-NEXT: NumberOfRelocations: 0 +COFF-I386-NEXT: NumberOfLinenumbers: 0 +COFF-I386: - Name: '.CRT$XDA' +COFF-I386-NEXT: Value: 44 +COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC +COFF-I386-NEXT: SectionDefinition: +COFF-I386-NEXT: Length: 4 +COFF-I386-NEXT: NumberOfRelocations: 0 +COFF-I386-NEXT: NumberOfLinenumbers: 0 +COFF-I386: - Name: '.CRT$XLZ' +COFF-I386-NEXT: Value: 40 +COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC +COFF-I386-NEXT: SectionDefinition: +COFF-I386-NEXT: Length: 4 +COFF-I386-NEXT: NumberOfRelocations: 0 +COFF-I386-NEXT: NumberOfLinenumbers: 0 +COFF-I386: - Name: '.CRT$XLA' +COFF-I386-NEXT: Value: 28 +COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC +COFF-I386-NEXT: SectionDefinition: +COFF-I386-NEXT: Length: 4 +COFF-I386-NEXT: NumberOfRelocations: 0 +COFF-I386-NEXT: NumberOfLinenumbers: 0 +COFF-I386: - Name: '.CRT$XIC' +COFF-I386-NEXT: Value: 20 +COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC +COFF-I386-NEXT: SectionDefinition: +COFF-I386-NEXT: Length: 4 +COFF-I386-NEXT: NumberOfRelocations: 1 +COFF-I386-NEXT: NumberOfLinenumbers: 0 +COFF-I386: - Name: '.CRT$XCZ' +COFF-I386-NEXT: Value: 8 +COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC +COFF-I386-NEXT: SectionDefinition: +COFF-I386-NEXT: Length: 4 +COFF-I386-NEXT: NumberOfRelocations: 0 +COFF-I386-NEXT: NumberOfLinenumbers: 0 +COFF-I386: - Name: '.CRT$XCA' +COFF-I386-NEXT: Value: 0 +COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC +COFF-I386-NEXT: SectionDefinition: +COFF-I386-NEXT: Length: 4 +COFF-I386-NEXT: NumberOfRelocations: 0 +COFF-I386-NEXT: NumberOfLinenumbers: 0 +COFF-I386: - Name: '.CRT$XIZ' +COFF-I386-NEXT: Value: 24 +COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC +COFF-I386-NEXT: SectionDefinition: +COFF-I386-NEXT: Length: 4 +COFF-I386-NEXT: NumberOfRelocations: 0 +COFF-I386-NEXT: NumberOfLinenumbers: 0 +COFF-I386: - Name: '.CRT$XIA' +COFF-I386-NEXT: Value: 12 +COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC +COFF-I386-NEXT: SectionDefinition: +COFF-I386-NEXT: Length: 4 +COFF-I386-NEXT: NumberOfRelocations: 0 +COFF-I386-NEXT: NumberOfLinenumbers: 0 diff --git a/test/Object/objdump-export-list.test b/test/Object/objdump-export-list.test new file mode 100644 index 000000000000..74344c1c2e2e --- /dev/null +++ b/test/Object/objdump-export-list.test @@ -0,0 +1,4 @@ +RUN: llvm-objdump -exports-trie %p/Inputs/macho-no-exports.dylib | FileCheck %s + +; Test that we don't crash with an empty export list. +CHECK: macho-no-exports.dylib: file format Mach-O 64-bit x86-64 diff --git a/test/Object/objdump-macho-quirks.test b/test/Object/objdump-macho-quirks.test new file mode 100644 index 000000000000..eeee1537def7 --- /dev/null +++ b/test/Object/objdump-macho-quirks.test @@ -0,0 +1,9 @@ +RUN: llvm-objdump -private-headers %p/Inputs/macho-zero-ncmds \ +RUN: | FileCheck %s -check-prefix A + +// Check that we don't get an infinite loop if ncmds = 0 +A: file format Mach-O 64-bit unknown +A: Mach header +A: magic cputype cpusubtype caps filetype ncmds sizeofcmds flags +A: MH_MAGIC_64 0x00 OBJECT 0 0 0x00000000 + diff --git a/test/Object/objdump-private-headers.test b/test/Object/objdump-private-headers.test index c562044b3c4e..d311bec58489 100644 --- a/test/Object/objdump-private-headers.test +++ b/test/Object/objdump-private-headers.test @@ -2,6 +2,8 @@ RUN: llvm-objdump -p %p/Inputs/program-headers.elf-i386 \ RUN: | FileCheck %s -check-prefix ELF-i386 RUN: llvm-objdump -p %p/Inputs/program-headers.elf-x86-64 \ RUN: | FileCheck %s -check-prefix ELF-x86-64 +RUN: llvm-objdump -p %p/Inputs/macho-rpath-x86_64 \ +RUN: | FileCheck %s -check-prefix MACHO-x86_64 ELF-i386: Program Header: ELF-i386: LOAD off 0x00000000 vaddr 0x08048000 paddr 0x08048000 align 2**12 @@ -16,3 +18,8 @@ ELF-x86-64: EH_FRAME off 0x00000000000000f4 vaddr 0x00000000004000f4 paddr 0x ELF-x86-64: filesz 0x0000000000000014 memsz 0x0000000000000014 flags r-- ELF-x86-64: STACK off 0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**3 ELF-x86-64: filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw- + +MACHO-x86_64: Load command 12 +MACHO-x86_64: cmd LC_RPATH +MACHO-x86_64: cmdsize 32 +MACHO-x86_64: path @executable_path/. (offset 12) diff --git a/test/Object/objdump-reloc-shared.test b/test/Object/objdump-reloc-shared.test new file mode 100644 index 000000000000..d899ffb60874 --- /dev/null +++ b/test/Object/objdump-reloc-shared.test @@ -0,0 +1,5 @@ +RUN: llvm-objdump -r %p/Inputs/elf-reloc-no-sym.x86_64 \ +RUN: | FileCheck %s + +; CHECK: elf-reloc-no-sym.x86_64: file format ELF64-x86-64 +; CHECK-NOT: {{.}} diff --git a/test/Object/objdump-relocations.test b/test/Object/objdump-relocations.test index 28cac104c7b7..1e41f78ca729 100644 --- a/test/Object/objdump-relocations.test +++ b/test/Object/objdump-relocations.test @@ -27,9 +27,9 @@ 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-i386: R_386_32 .rodata.str1.1 +ELF-i386: R_386_PC32 puts +ELF-i386: R_386_PC32 SomeOtherFunction ELF-x86-64: .text ELF-x86-64: R_X86_64_32S .rodata.str1.1 diff --git a/test/Object/yaml2obj-elf-file-headers-with-e_flags.yaml b/test/Object/yaml2obj-elf-file-headers-with-e_flags.yaml index 7d098077dd5e..dddc7d97f628 100644 --- a/test/Object/yaml2obj-elf-file-headers-with-e_flags.yaml +++ b/test/Object/yaml2obj-elf-file-headers-with-e_flags.yaml @@ -5,13 +5,15 @@ FileHeader: Data: ELFDATA2LSB Type: ET_REL Machine: EM_MIPS - Flags: [ EF_MIPS_NOREORDER, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ] + Flags: [ EF_MIPS_NOREORDER, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, + EF_MIPS_NAN2008 ] # CHECK: Format: ELF32-mips # CHECK: Arch: mipsel # CHECK: Machine: EM_MIPS -# CHECK: Flags [ (0x70001001) +# CHECK: Flags [ (0x70001401) # CHECK-NEXT: EF_MIPS_ABI_O32 (0x1000) # CHECK-NEXT: EF_MIPS_ARCH_32R2 (0x70000000) +# CHECK-NEXT: EF_MIPS_NAN2008 (0x400) # CHECK-NEXT: EF_MIPS_NOREORDER (0x1) # CHECK-NEXT: ] diff --git a/test/Object/yaml2obj-elf-symbol-visibility.yaml b/test/Object/yaml2obj-elf-symbol-visibility.yaml index 113354a05e3a..6c4037c831d1 100644 --- a/test/Object/yaml2obj-elf-symbol-visibility.yaml +++ b/test/Object/yaml2obj-elf-symbol-visibility.yaml @@ -44,7 +44,7 @@ # OBJ-NEXT: Size: 4 # OBJ-NEXT: Binding: Global (0x1) # OBJ-NEXT: Type: Object (0x1) -# OBJ-NEXT: Other: 3 +# OBJ-NEXT: Other: 163 # OBJ-NEXT: Section: .data (0x1) # OBJ-NEXT: } @@ -77,6 +77,7 @@ # YAML-NEXT: Value: 0x0000000000000010 # YAML-NEXT: Size: 0x0000000000000004 # YAML-NEXT: Visibility: STV_PROTECTED +# YAML-NEXT: Other: [ STO_MIPS_PIC, STO_MIPS_MICROMIPS ] --- FileHeader: @@ -121,6 +122,7 @@ Symbols: - Name: protected Type: STT_OBJECT Visibility: STV_PROTECTED + Other: [ STO_MIPS_MICROMIPS, STO_MIPS_PIC ] Section: .data Value: 0x10 Size: 0x04 |
