[llvm\test\Object] - An initial step to cleanup the test cases.

This patch removes trivial-object-test.elf-i386,
trivial-object-test.elf-x86-64 and trivial-object-test2.elf-x86-64
precompiled objects from test/Object/Inputs folder.

I adjusted the existent test cases to use YAML instead.

Differential revision: https://reviews.llvm.org/D64206

llvm-svn: 365348
This commit is contained in:
George Rimar 2019-07-08 16:53:39 +00:00
parent cef9d42157
commit 6afc666eb8
19 changed files with 1893 additions and 1331 deletions

View File

@ -1,102 +1,187 @@
RUN: llvm-objdump -d -r %p/../Inputs/trivial-object-test.coff-i386 \
RUN: | FileCheck %s -check-prefix COFF-i386
RUN: llvm-objdump -d -r %p/../Inputs/trivial-object-test.coff-x86-64 \
RUN: | FileCheck %s -check-prefix COFF-x86-64
RUN: llvm-objdump -d -r %p/../Inputs/trivial-object-test.macho-i386 \
RUN: | FileCheck %s -check-prefix MACHO-i386
RUN: llvm-objdump -d -r %p/../Inputs/trivial-object-test.macho-x86-64 \
RUN: | FileCheck %s -check-prefix MACHO-x86-64
RUN: llvm-objdump -d -r %p/../Inputs/trivial-object-test.elf-i386 \
RUN: | FileCheck %s -check-prefix ELF-i386
RUN: llvm-objdump -d -r %p/../Inputs/trivial-object-test.elf-x86-64 \
RUN: | FileCheck %s -check-prefix ELF-x86-64
# RUN: llvm-objdump -d -r %p/../Inputs/trivial-object-test.coff-i386 \
# RUN: | FileCheck %s -check-prefix COFF-i386
COFF-i386: file format COFF-i386
COFF-i386: Disassembly of section .text:
COFF-i386: 0: 83 ec 0c subl $12, %esp
COFF-i386: 3: c7 44 24 08 00 00 00 00 movl $0, 8(%esp)
COFF-i386: b: c7 04 24 00 00 00 00 movl $0, (%esp)
COFF-i386: e: IMAGE_REL_I386_DIR32 L_.str
COFF-i386: 12: e8 00 00 00 00 calll 0
COFF-i386: 13: IMAGE_REL_I386_REL32 _puts
COFF-i386: 17: e8 00 00 00 00 calll 0
COFF-i386: 18: IMAGE_REL_I386_REL32 _SomeOtherFunction
COFF-i386: 1c: 8b 44 24 08 movl 8(%esp), %eax
COFF-i386: 20: 83 c4 0c addl $12, %esp
COFF-i386: 23: c3 ret
# COFF-i386: file format COFF-i386
# COFF-i386: Disassembly of section .text:
# COFF-i386: 0: 83 ec 0c subl $12, %esp
# COFF-i386: 3: c7 44 24 08 00 00 00 00 movl $0, 8(%esp)
# COFF-i386: b: c7 04 24 00 00 00 00 movl $0, (%esp)
# COFF-i386: e: IMAGE_REL_I386_DIR32 L_.str
# COFF-i386: 12: e8 00 00 00 00 calll 0
# COFF-i386: 13: IMAGE_REL_I386_REL32 _puts
# COFF-i386: 17: e8 00 00 00 00 calll 0
# COFF-i386: 18: IMAGE_REL_I386_REL32 _SomeOtherFunction
# COFF-i386: 1c: 8b 44 24 08 movl 8(%esp), %eax
# COFF-i386: 20: 83 c4 0c addl $12, %esp
# COFF-i386: 23: c3 ret
COFF-x86-64: file format COFF-x86-64
COFF-x86-64: Disassembly of section .text:
COFF-x86-64: 0: 48 83 ec 28 subq $40, %rsp
COFF-x86-64: 4: c7 44 24 24 00 00 00 00 movl $0, 36(%rsp)
COFF-x86-64: c: 48 8d 0d 00 00 00 00 leaq (%rip), %rcx
COFF-x86-64: f: IMAGE_REL_AMD64_REL32 L.str
COFF-x86-64: 13: e8 00 00 00 00 callq 0
COFF-x86-64: 14: IMAGE_REL_AMD64_REL32 puts
COFF-x86-64: 18: e8 00 00 00 00 callq 0
COFF-x86-64: 19: IMAGE_REL_AMD64_REL32 SomeOtherFunction
COFF-x86-64: 1d: 8b 44 24 24 movl 36(%rsp), %eax
COFF-x86-64: 21: 48 83 c4 28 addq $40, %rsp
COFF-x86-64: 25: c3 ret
# RUN: llvm-objdump -d -r %p/../Inputs/trivial-object-test.coff-x86-64 \
# RUN: | FileCheck %s -check-prefix COFF-x86-64
MACHO-i386: file format Mach-O 32-bit i386
MACHO-i386: Disassembly of section __TEXT,__text:
MACHO-i386: _main:
MACHO-i386: 0: 83 ec 0c subl $12, %esp
MACHO-i386: 3: c7 44 24 08 00 00 00 00 movl $0, 8(%esp)
MACHO-i386: b: c7 04 24 24 00 00 00 movl $36, (%esp)
MACHO-i386: e: GENERIC_RELOC_VANILLA __cstring
MACHO-i386: 12: e8 1f 00 00 00 calll 31
MACHO-i386: 13: GENERIC_RELOC_VANILLA __jump_table
MACHO-i386: 17: e8 15 00 00 00 calll 21
MACHO-i386: 18: GENERIC_RELOC_VANILLA __jump_table
MACHO-i386: 1c: 8b 44 24 08 movl 8(%esp), %eax
MACHO-i386: 20: 83 c4 0c addl $12, %esp
MACHO-i386: 23: c3 ret
# COFF-x86-64: file format COFF-x86-64
# COFF-x86-64: Disassembly of section .text:
# COFF-x86-64: 0: 48 83 ec 28 subq $40, %rsp
# COFF-x86-64: 4: c7 44 24 24 00 00 00 00 movl $0, 36(%rsp)
# COFF-x86-64: c: 48 8d 0d 00 00 00 00 leaq (%rip), %rcx
# COFF-x86-64: f: IMAGE_REL_AMD64_REL32 L.str
# COFF-x86-64: 13: e8 00 00 00 00 callq 0
# COFF-x86-64: 14: IMAGE_REL_AMD64_REL32 puts
# COFF-x86-64: 18: e8 00 00 00 00 callq 0
# COFF-x86-64: 19: IMAGE_REL_AMD64_REL32 SomeOtherFunction
# COFF-x86-64: 1d: 8b 44 24 24 movl 36(%rsp), %eax
# COFF-x86-64: 21: 48 83 c4 28 addq $40, %rsp
# COFF-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 (%rip), %rdi
MACHO-x86-64: f: X86_64_RELOC_SIGNED L_.str
MACHO-x86-64: 13: e8 00 00 00 00 callq 0
MACHO-x86-64: 14: X86_64_RELOC_BRANCH _puts
MACHO-x86-64: 18: 30 c0 xorb %al, %al
MACHO-x86-64: 1a: e8 00 00 00 00 callq 0
MACHO-x86-64: 1b: X86_64_RELOC_BRANCH _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
# RUN: llvm-objdump -d -r %p/../Inputs/trivial-object-test.macho-i386 \
# RUN: | FileCheck %s -check-prefix MACHO-i386
ELF-i386: file format ELF32-i386
ELF-i386: Disassembly of section .text:
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 .rodata.str1.1
ELF-i386: 12: e8 fc ff ff ff calll -4
ELF-i386: 13: R_386_PC32 puts
ELF-i386: 17: e8 fc ff ff ff calll -4
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
# MACHO-i386: file format Mach-O 32-bit i386
# MACHO-i386: Disassembly of section __TEXT,__text:
# MACHO-i386: _main:
# MACHO-i386: 0: 83 ec 0c subl $12, %esp
# MACHO-i386: 3: c7 44 24 08 00 00 00 00 movl $0, 8(%esp)
# MACHO-i386: b: c7 04 24 24 00 00 00 movl $36, (%esp)
# MACHO-i386: e: GENERIC_RELOC_VANILLA __cstring
# MACHO-i386: 12: e8 1f 00 00 00 calll 31
# MACHO-i386: 13: GENERIC_RELOC_VANILLA __jump_table
# MACHO-i386: 17: e8 15 00 00 00 calll 21
# MACHO-i386: 18: GENERIC_RELOC_VANILLA __jump_table
# MACHO-i386: 1c: 8b 44 24 08 movl 8(%esp), %eax
# MACHO-i386: 20: 83 c4 0c addl $12, %esp
# MACHO-i386: 23: c3 ret
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 $0, %edi
ELF-x86-64: d: R_X86_64_32S .rodata.str1.1
ELF-x86-64: 11: e8 00 00 00 00 callq 0
ELF-x86-64: 12: R_X86_64_PC32 puts-4
ELF-x86-64: 16: 30 c0 xorb %al, %al
ELF-x86-64: 18: e8 00 00 00 00 callq 0
ELF-x86-64: 19: R_X86_64_PC32 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
# RUN: llvm-objdump -d -r %p/../Inputs/trivial-object-test.macho-x86-64 \
# RUN: | FileCheck %s -check-prefix MACHO-x86-64
# 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 (%rip), %rdi
# MACHO-x86-64: f: X86_64_RELOC_SIGNED L_.str
# MACHO-x86-64: 13: e8 00 00 00 00 callq 0
# MACHO-x86-64: 14: X86_64_RELOC_BRANCH _puts
# MACHO-x86-64: 18: 30 c0 xorb %al, %al
# MACHO-x86-64: 1a: e8 00 00 00 00 callq 0
# MACHO-x86-64: 1b: X86_64_RELOC_BRANCH _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
# RUN: yaml2obj -docnum=1 %s > %t.elf-i386
# RUN: llvm-objdump -d -r %t.elf-i386 | FileCheck %s -check-prefix ELF-i386
# ELF-i386: file format ELF32-i386
# ELF-i386: Disassembly of section .text:
# 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 .rodata.str1.1
# ELF-i386: 12: e8 fc ff ff ff calll -4
# ELF-i386: 13: R_386_PC32 puts
# ELF-i386: 17: e8 fc ff ff ff calll -4
# 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
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_386
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Content: 83EC0CC744240800000000C7042400000000E8FCFFFFFFE8FCFFFFFF8B44240883C40CC3
- Name: .rodata.str1.1
Type: SHT_PROGBITS
- Name: .rel.text
Type: SHT_REL
Info: .text
Relocations:
- Offset: 0x000000000000000E
Symbol: .rodata.str1.1
Type: R_386_32
- Offset: 0x0000000000000013
Symbol: puts
Type: R_386_PC32
- Offset: 0x0000000000000018
Symbol: SomeOtherFunction
Type: R_386_PC32
Symbols:
- Name: .rodata.str1.1
Type: STT_SECTION
Section: .rodata.str1.1
- Name: main
Type: STT_FUNC
Section: .text
Binding: STB_GLOBAL
- Name: SomeOtherFunction
Binding: STB_GLOBAL
- Name: puts
Binding: STB_GLOBAL
# RUN: yaml2obj -docnum=2 %s > %t.elf-x86-64
# RUN: llvm-objdump -d -r %t.elf-x86-64 | FileCheck %s -check-prefix ELF-x86-64
--- !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: 4883EC08C744240400000000BF00000000E80000000030C0E8000000008B4424044883C408C3
- Name: .rodata.str1.1
Type: SHT_PROGBITS
- Name: .rela.text
Type: SHT_RELA
Info: .text
Relocations:
- Offset: 0x000000000000000D
Symbol: .rodata.str1.1
Type: R_X86_64_32S
- Offset: 0x0000000000000012
Symbol: puts
Type: R_X86_64_PC32
Addend: -4
- Offset: 0x0000000000000019
Symbol: SomeOtherFunction
Type: R_X86_64_PC32
Addend: -4
Symbols:
- Name: .rodata.str1.1
Type: STT_SECTION
Section: .rodata.str1.1
- Name: main
Type: STT_FUNC
Section: .text
Binding: STB_GLOBAL
- Name: SomeOtherFunction
Binding: STB_GLOBAL
- Name: puts
Binding: STB_GLOBAL
# 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 $0, %edi
# ELF-x86-64: d: R_X86_64_32S .rodata.str1.1
# ELF-x86-64: 11: e8 00 00 00 00 callq 0
# ELF-x86-64: 12: R_X86_64_PC32 puts-4
# ELF-x86-64: 16: 30 c0 xorb %al, %al
# ELF-x86-64: 18: e8 00 00 00 00 callq 0
# ELF-x86-64: 19: R_X86_64_PC32 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

View File

@ -1,54 +1,80 @@
RUN: llvm-objdump -d %p/../Inputs/trivial-object-test.coff-i386 \
RUN: | FileCheck %s -check-prefix COFF-i386
RUN: llvm-objdump -d %p/../Inputs/trivial-object-test.coff-x86-64 \
RUN: | FileCheck %s -check-prefix COFF-x86-64
RUN: llvm-objdump -d %p/../Inputs/trivial-object-test.elf-i386 \
RUN: | FileCheck %s -check-prefix ELF-i386
RUN: llvm-objdump -d %p/../Inputs/trivial-object-test.elf-x86-64 \
RUN: | FileCheck %s -check-prefix ELF-x86-64
# RUN: llvm-objdump -d %p/../Inputs/trivial-object-test.coff-i386 \
# RUN: | FileCheck %s -check-prefix COFF-i386
COFF-i386: file format COFF-i386
COFF-i386: Disassembly of section .text:
COFF-i386: 0: 83 ec 0c subl $12, %esp
COFF-i386: 3: c7 44 24 08 00 00 00 00 movl $0, 8(%esp)
COFF-i386: b: c7 04 24 00 00 00 00 movl $0, (%esp)
COFF-i386: 12: e8 00 00 00 00 calll 0
COFF-i386: 17: e8 00 00 00 00 calll 0
COFF-i386: 1c: 8b 44 24 08 movl 8(%esp), %eax
COFF-i386: 20: 83 c4 0c addl $12, %esp
COFF-i386: 23: c3 ret
# COFF-i386: file format COFF-i386
# COFF-i386: Disassembly of section .text:
# COFF-i386: 0: 83 ec 0c subl $12, %esp
# COFF-i386: 3: c7 44 24 08 00 00 00 00 movl $0, 8(%esp)
# COFF-i386: b: c7 04 24 00 00 00 00 movl $0, (%esp)
# COFF-i386: 12: e8 00 00 00 00 calll 0
# COFF-i386: 17: e8 00 00 00 00 calll 0
# COFF-i386: 1c: 8b 44 24 08 movl 8(%esp), %eax
# COFF-i386: 20: 83 c4 0c addl $12, %esp
# COFF-i386: 23: c3 ret
COFF-x86-64: file format COFF-x86-64
COFF-x86-64: Disassembly of section .text:
COFF-x86-64: 0: 48 83 ec 28 subq $40, %rsp
COFF-x86-64: 4: c7 44 24 24 00 00 00 00 movl $0, 36(%rsp)
COFF-x86-64: c: 48 8d 0d 00 00 00 00 leaq (%rip), %rcx
COFF-x86-64: 13: e8 00 00 00 00 callq 0
COFF-x86-64: 18: e8 00 00 00 00 callq 0
COFF-x86-64: 1d: 8b 44 24 24 movl 36(%rsp), %eax
COFF-x86-64: 21: 48 83 c4 28 addq $40, %rsp
COFF-x86-64: 25: c3 ret
# RUN: llvm-objdump -d %p/../Inputs/trivial-object-test.coff-x86-64 \
# RUN: | FileCheck %s -check-prefix COFF-x86-64
# COFF-x86-64: file format COFF-x86-64
# COFF-x86-64: Disassembly of section .text:
# COFF-x86-64: 0: 48 83 ec 28 subq $40, %rsp
# COFF-x86-64: 4: c7 44 24 24 00 00 00 00 movl $0, 36(%rsp)
# COFF-x86-64: c: 48 8d 0d 00 00 00 00 leaq (%rip), %rcx
# COFF-x86-64: 13: e8 00 00 00 00 callq 0
# COFF-x86-64: 18: e8 00 00 00 00 callq 0
# COFF-x86-64: 1d: 8b 44 24 24 movl 36(%rsp), %eax
# COFF-x86-64: 21: 48 83 c4 28 addq $40, %rsp
# COFF-x86-64: 25: c3 ret
ELF-i386: file format ELF32-i386
ELF-i386: Disassembly of section .text:
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: 12: e8 fc ff ff ff calll -4
ELF-i386: 17: e8 fc ff ff ff calll -4
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
# RUN: yaml2obj -docnum=1 %s > %t.elf-i386
# RUN: llvm-objdump -d %t.elf-i386 | FileCheck %s -check-prefix ELF-i386
ELF-x86-64: file format ELF64-x86-64
ELF-x86-64: Disassembly of section .text:
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 $0, %edi
ELF-x86-64: 11: e8 00 00 00 00 callq 0
ELF-x86-64: 16: 30 c0 xorb %al, %al
ELF-x86-64: 18: e8 00 00 00 00 callq 0
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
# ELF-i386: file format ELF32-i386
# ELF-i386: Disassembly of section .text:
# 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: 12: e8 fc ff ff ff calll -4
# ELF-i386: 17: e8 fc ff ff ff calll -4
# 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
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_386
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Content: 83EC0CC744240800000000C7042400000000E8FCFFFFFFE8FCFFFFFF8B44240883C40CC3
# RUN: yaml2obj -docnum=2 %s > %t.elf-x86-64
# RUN: llvm-objdump -d %t.elf-x86-64 | 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: 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 $0, %edi
# ELF-x86-64: 11: e8 00 00 00 00 callq 0
# ELF-x86-64: 16: 30 c0 xorb %al, %al
# ELF-x86-64: 18: e8 00 00 00 00 callq 0
# 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
--- !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: 4883EC08C744240400000000BF00000000E80000000030C0E8000000008B4424044883C408C3

View File

@ -1,168 +1,216 @@
RUN: rm -f %t.a
RUN: llvm-ar rcsU %t.a %p/Inputs/trivial-object-test.elf-x86-64 %p/Inputs/trivial-object-test2.elf-x86-64
RUN: llvm-nm -M %t.a | FileCheck %s
# RUN: yaml2obj -docnum=1 %s > %t.elf-x86-64
# RUN: yaml2obj -docnum=2 %s > %t2.elf-x86-64
RUN: rm -f %t.a
RUN: env SYM64_THRESHOLD=1 llvm-ar rcsU %t.a %p/Inputs/trivial-object-test.elf-x86-64 %p/Inputs/trivial-object-test2.elf-x86-64
RUN: llvm-nm -M %t.a | FileCheck %s
RUXX: grep SYM64 %t.a
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Symbols:
- Name: main
Type: STT_FUNC
Section: .text
Binding: STB_GLOBAL
- Name: SomeOtherFunction
Binding: STB_GLOBAL
- Name: puts
Binding: STB_GLOBAL
CHECK: Archive map
CHECK-NEXT: main in trivial-object-test.elf-x86-64
CHECK-NEXT: foo in trivial-object-test2.elf-x86-64
CHECK-NEXT: main in trivial-object-test2.elf-x86-64
CHECK-NOT: bar
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Symbols:
- Name: bar
Type: STT_FUNC
Section: .text
- Name: foo
Type: STT_FUNC
Section: .text
Binding: STB_GLOBAL
Value: 0x0000000000000006
- Name: main
Type: STT_FUNC
Section: .text
Binding: STB_GLOBAL
Value: 0x0000000000000016
# RUN: rm -f %t.a
# RUN: llvm-ar rcsU %t.a %t.elf-x86-64 %t2.elf-x86-64
# RUN: llvm-nm -M %t.a | FileCheck %s
# RUN: rm -f %t.a
# RUN: env SYM64_THRESHOLD=1 llvm-ar rcsU %t.a %t.elf-x86-64 %t2.elf-x86-64
# RUN: llvm-nm -M %t.a | FileCheck %s
# RUXX: grep SYM64 %t.a
# CHECK: Archive map
# CHECK-NEXT: main in {{.*}}.elf-x86-64
# CHECK-NEXT: foo in {{.*}}2.elf-x86-64
# CHECK-NEXT: main in {{.*}}2.elf-x86-64
# CHECK-NOT: bar
RUN: rm -f %t.a
RUN: llvm-ar --format=gnu rcT %t.a %p/Inputs/trivial-object-test.elf-x86-64 %p/Inputs/trivial-object-test2.elf-x86-64
RUN: llvm-nm -M %t.a | FileCheck --check-prefix=THIN %s
# RUN: rm -f %t.a
# RUN: llvm-ar --format=gnu rcT %t.a %t.elf-x86-64 %t2.elf-x86-64
# RUN: llvm-nm -M %t.a | FileCheck -DFILE=%/t.elf-x86-64 -DFILE2=%/t2.elf-x86-64 --check-prefix=THIN %s
THIN: Archive map
THIN-NEXT: main in {{.*}}/Inputs/trivial-object-test.elf-x86-64
THIN-NEXT: foo in {{.*}}/Inputs/trivial-object-test2.elf-x86-64
THIN-NEXT: main in {{.*}}/Inputs/trivial-object-test2.elf-x86-64
# THIN: Archive map
# THIN-NEXT: main in [[FILE]]
# THIN-NEXT: foo in [[FILE2]]
# THIN-NEXT: main in [[FILE2]]
CHECK: trivial-object-test.elf-x86-64:
CHECK-NEXT: U SomeOtherFunction
CHECK-NEXT: 0000000000000000 T main
CHECK-NEXT: U puts
# CHECK: {{.*}}.elf-x86-64:
# CHECK-NEXT: U SomeOtherFunction
# CHECK-NEXT: 0000000000000000 T main
# CHECK-NEXT: U puts
CHECK: trivial-object-test2.elf-x86-64:
CHECK-NEXT: 0000000000000000 t bar
CHECK-NEXT: 0000000000000006 T foo
CHECK-NEXT: 0000000000000016 T main
# CHECK: {{.*}}2.elf-x86-64:
# CHECK-NEXT: 0000000000000000 t bar
# CHECK-NEXT: 0000000000000006 T foo
# CHECK-NEXT: 0000000000000016 T main
RUN: rm -f %t.a
RUN: llvm-ar rcSU %t.a %p/Inputs/trivial-object-test.elf-x86-64 %p/Inputs/trivial-object-test2.elf-x86-64
RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=NOMAP
# RUN: rm -f %t.a
# RUN: llvm-ar rcSU %t.a %t.elf-x86-64 %t2.elf-x86-64
# RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=NOMAP
NOMAP-NOT: Archive map
# NOMAP-NOT: Archive map
RUN: llvm-ar s %t.a
RUN: llvm-nm -M %t.a | FileCheck %s
# RUN: llvm-ar s %t.a
# RUN: llvm-nm -M %t.a | FileCheck %s
check that the archive does have a corrupt symbol table.
RUN: rm -f %t.a
RUN: cp %p/Inputs/archive-test.a-corrupt-symbol-table %t.a
RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=CORRUPT
## Check that the archive does have a corrupt symbol table.
# RUN: rm -f %t.a
# RUN: cp %p/Inputs/archive-test.a-corrupt-symbol-table %t.a
# RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=CORRUPT
CORRUPT: Archive map
CORRUPT-NEXT: mbin in trivial-object-test.elf-x86-64
CORRUPT-NEXT: foo in trivial-object-test2.elf-x86-64
CORRUPT-NEXT: main in trivial-object-test2.elf-x86-64
# CORRUPT: Archive map
# CORRUPT-NEXT: mbin in trivial-object-test.elf-x86-64
# CORRUPT-NEXT: foo in trivial-object-test2.elf-x86-64
# CORRUPT-NEXT: main in trivial-object-test2.elf-x86-64
CORRUPT: trivial-object-test.elf-x86-64:
CORRUPT-NEXT: U SomeOtherFunction
CORRUPT-NEXT: 0000000000000000 T main
CORRUPT-NEXT: U puts
# CORRUPT: {{.*}}.elf-x86-64:
# CORRUPT-NEXT: U SomeOtherFunction
# CORRUPT-NEXT: 0000000000000000 T main
# CORRUPT-NEXT: U puts
CORRUPT: trivial-object-test2.elf-x86-64:
CORRUPT-NEXT: 0000000000000000 t bar
CORRUPT-NEXT: 0000000000000006 T foo
CORRUPT-NEXT: 0000000000000016 T main
# CORRUPT: {{.*}}2.elf-x86-64:
# CORRUPT-NEXT: 0000000000000000 t bar
# CORRUPT-NEXT: 0000000000000006 T foo
# CORRUPT-NEXT: 0000000000000016 T main
check that the we *don't* update the symbol table.
RUN: llvm-ar s %t.a
RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=CORRUPT
## Check that the we *don't* update the symbol table.
# RUN: llvm-ar s %t.a
# RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=CORRUPT
repeate the test with llvm-ranlib
## Repeat the test with llvm-ranlib.
RUN: rm -f %t.a
RUN: llvm-ar rcSU %t.a %p/Inputs/trivial-object-test.elf-x86-64 %p/Inputs/trivial-object-test2.elf-x86-64
RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=NOMAP
# RUN: rm -f %t.a
# RUN: llvm-ar rcSU %t.a %t.elf-x86-64 %t2.elf-x86-64
# RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=NOMAP
RUN: llvm-ranlib %t.a
RUN: llvm-nm -M %t.a | FileCheck %s
# 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
# 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
BSD-MachO: _foo in foo.o
# BSD-MachO: Archive map
# BSD-MachO: _bar in bar.o
# BSD-MachO: _foo in foo.o
RUN: rm -f %t.a
RUN: llvm-ar --format=bsd rcsU %t.a %p/Inputs/trivial-object-test.macho-x86-64 %p/Inputs/trivial-object-test2.macho-x86-64
RUN: llvm-nm -M %t.a | FileCheck --check-prefix=MACHO %s
# RUN: rm -f %t.a
# RUN: llvm-ar --format=bsd rcsU %t.a %p/Inputs/trivial-object-test.macho-x86-64 %p/Inputs/trivial-object-test2.macho-x86-64
# RUN: llvm-nm -M %t.a | FileCheck --check-prefix=MACHO %s
RUN: rm -f %t.a
RUN: env SYM64_THRESHOLD=1 llvm-ar --format=darwin rcsU %t.a %p/Inputs/trivial-object-test.macho-x86-64 %p/Inputs/trivial-object-test2.macho-x86-64
RUN: llvm-nm -M %t.a | FileCheck --check-prefix=MACHO %s
RUN: grep '__\.SYMDEF_64' %t.a
# RUN: rm -f %t.a
# RUN: env SYM64_THRESHOLD=1 llvm-ar --format=darwin rcsU %t.a %p/Inputs/trivial-object-test.macho-x86-64 %p/Inputs/trivial-object-test2.macho-x86-64
# RUN: llvm-nm -M %t.a | FileCheck --check-prefix=MACHO %s
# RUN: grep '__\.SYMDEF_64' %t.a
MACHO: Archive map
MACHO-NEXT: _main in trivial-object-test.macho-x86-64
MACHO-NEXT: _foo in trivial-object-test2.macho-x86-64
MACHO-NEXT: _main in trivial-object-test2.macho-x86-64
MACHO-NOT: {{^}}bar
# MACHO: Archive map
# MACHO-NEXT: _main in trivial-object-test.macho-x86-64
# MACHO-NEXT: _foo in trivial-object-test2.macho-x86-64
# MACHO-NEXT: _main in trivial-object-test2.macho-x86-64
# MACHO-NOT: {{^}}bar
MACHO: trivial-object-test.macho-x86-64
MACHO-NEXT: 0000000000000028 s L_.str
MACHO-NEXT: U _SomeOtherFunction
MACHO-NEXT: 0000000000000000 T _main
MACHO-NEXT: U _puts
# MACHO: trivial-object-test.macho-x86-64
# MACHO-NEXT: 0000000000000028 s L_.str
# MACHO-NEXT: U _SomeOtherFunction
# MACHO-NEXT: 0000000000000000 T _main
# MACHO-NEXT: U _puts
MACHO: trivial-object-test2.macho-x86-64
MACHO-NEXT: 0000000000000000 t _bar
MACHO-NEXT: 0000000000000001 T _foo
MACHO-NEXT: 0000000000000002 T _main
# MACHO: trivial-object-test2.macho-x86-64
# MACHO-NEXT: 0000000000000000 t _bar
# MACHO-NEXT: 0000000000000001 T _foo
# MACHO-NEXT: 0000000000000002 T _main
RUN: llvm-nm -M %p/Inputs/macho-toc64-archive-x86_64.a | FileCheck --check-prefix=MACHO-TOC64 %s
# RUN: llvm-nm -M %p/Inputs/macho-toc64-archive-x86_64.a | FileCheck --check-prefix=MACHO-TOC64 %s
MACHO-TOC64: Archive map
MACHO-TOC64-NEXT: _test in test.o
MACHO-TOC64-NEXT: _test in xtest.o
# MACHO-TOC64: Archive map
# MACHO-TOC64-NEXT: _test in test.o
# MACHO-TOC64-NEXT: _test in xtest.o
RUN: rm -f %t.a
RUN: llvm-ar --format=gnu rcsU %t.a %p/Inputs/coff-short-import-code %p/Inputs/coff-short-import-data
RUN: llvm-nm -M %t.a | FileCheck --check-prefix=COFF-SHORT-IMPORT %s
# RUN: rm -f %t.a
# RUN: llvm-ar --format=gnu rcsU %t.a %p/Inputs/coff-short-import-code %p/Inputs/coff-short-import-data
# RUN: llvm-nm -M %t.a | FileCheck --check-prefix=COFF-SHORT-IMPORT %s
COFF-SHORT-IMPORT: Archive map
COFF-SHORT-IMPORT-NEXT: __imp__foo in coff-short-import-code
COFF-SHORT-IMPORT-NEXT: _foo in coff-short-import-code
COFF-SHORT-IMPORT-NEXT: __imp__bar in coff-short-import-data
COFF-SHORT-IMPORT-NOT: _bar in coff-short-import-data
# COFF-SHORT-IMPORT: Archive map
# COFF-SHORT-IMPORT-NEXT: __imp__foo in coff-short-import-code
# COFF-SHORT-IMPORT-NEXT: _foo in coff-short-import-code
# COFF-SHORT-IMPORT-NEXT: __imp__bar in coff-short-import-data
# COFF-SHORT-IMPORT-NOT: _bar in coff-short-import-data
Test that we pad the symbol table so that it ends in a multiple of 8 bytes:
8 + 60 + 36 == 104
RUN: rm -f %t.a
RUN: llvm-ar --format=bsd rcsU %t.a %p/Inputs/trivial-object-test.macho-x86-64
RUN: FileCheck --check-prefix=MACHO-SYMTAB-ALIGN %s < %t.a
MACHO-SYMTAB-ALIGN: !<arch>
MACHO-SYMTAB-ALIGN-NEXT: #1/12 {{..........}} 0 0 0 36 `
## Test that we pad the symbol table so that it ends in a multiple of 8 bytes:
## 8 + 60 + 36 == 104
# RUN: rm -f %t.a
# RUN: llvm-ar --format=bsd rcsU %t.a %p/Inputs/trivial-object-test.macho-x86-64
# RUN: FileCheck --check-prefix=MACHO-SYMTAB-ALIGN %s < %t.a
# MACHO-SYMTAB-ALIGN: !<arch>
# MACHO-SYMTAB-ALIGN-NEXT: #1/12 {{..........}} 0 0 0 36 `
Test that we pad the symbol table so that it ends in a multiple of 8 bytes:
8 + 60 + 52 == 120
RUN: rm -f %t.a
RUN: llvm-ar --format=bsd rcsD %t.a %p/Inputs/trivial-object-test.macho-x86-64 %p/Inputs/trivial-object-test.macho-x86-64
RUN: FileCheck --check-prefix=MACHO-SYMTAB-ALIGN2 %s < %t.a
MACHO-SYMTAB-ALIGN2: !<arch>
MACHO-SYMTAB-ALIGN2-NEXT: #1/12 0 0 0 0 52 `
## Test that we pad the symbol table so that it ends in a multiple of 8 bytes:
## 8 + 60 + 52 == 120
# RUN: rm -f %t.a
# RUN: llvm-ar --format=bsd rcsD %t.a %p/Inputs/trivial-object-test.macho-x86-64 %p/Inputs/trivial-object-test.macho-x86-64
# RUN: FileCheck --check-prefix=MACHO-SYMTAB-ALIGN2 %s < %t.a
# MACHO-SYMTAB-ALIGN2: !<arch>
# MACHO-SYMTAB-ALIGN2-NEXT: #1/12 0 0 0 0 52 `
With a gnu symbol table we only align to two
8 + 60 + 14 = 82
RUN: rm -f %t.a
RUN: llvm-ar --format=gnu rcsD %t.a %p/Inputs/trivial-object-test.macho-x86-64
RUN: FileCheck --check-prefix=GNU-SYMTAB-ALIGN %s < %t.a
GNU-SYMTAB-ALIGN: !<arch>
GNU-SYMTAB-ALIGN-NEXT: / 0 0 0 0 14 `
## With a gnu symbol table we only align to two
# 8 + 60 + 14 = 82
# RUN: rm -f %t.a
# RUN: llvm-ar --format=gnu rcsD %t.a %p/Inputs/trivial-object-test.macho-x86-64
# RUN: FileCheck --check-prefix=GNU-SYMTAB-ALIGN %s < %t.a
# GNU-SYMTAB-ALIGN: !<arch>
# GNU-SYMTAB-ALIGN-NEXT: / 0 0 0 0 14 `
** Test the behavior of an empty archive:
## ** Test the behavior of an empty archive:
No symbol table emitted for GNU archives
RUN: rm -f %t.a
RUN: llvm-ar rcs --format=gnu %t.a
RUN: not grep -q '/ ' %t.a
## No symbol table emitted for GNU archives
# RUN: rm -f %t.a
# RUN: llvm-ar rcs --format=gnu %t.a
# RUN: not grep -q '/ ' %t.a
No symbol table for BSD archives
RUN: rm -f %t.a
RUN: llvm-ar rcs --format=bsd %t.a
RUN: not grep -q '__\.SYMDEF' %t.a
## No symbol table for BSD archives
# RUN: rm -f %t.a
# RUN: llvm-ar rcs --format=bsd %t.a
# RUN: not grep -q '__\.SYMDEF' %t.a
And we do emit a symbol table for DARWIN archives
RUN: rm -f %t.a
RUN: llvm-ar rcs --format=darwin %t.a
RUN: grep -q '__\.SYMDEF' %t.a
## And we do emit a symbol table for DARWIN archives
# RUN: rm -f %t.a
# RUN: llvm-ar rcs --format=darwin %t.a
# RUN: grep -q '__\.SYMDEF' %t.a

View File

@ -1,33 +1,82 @@
; 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: yaml2obj -docnum=1 %s > %t.elf-x86-64
# RUN: echo create %t.a > %t.mri
# RUN: echo 'addmod "%t.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
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Symbols:
- Name: main
Type: STT_FUNC
Section: .text
Binding: STB_GLOBAL
Size: 0x0000000000000024
- Name: SomeOtherFunction
Binding: STB_GLOBAL
- Name: puts
Binding: STB_GLOBAL
; CHECK: Archive map
; CHECK-NEXT: main in trivial-object-test.elf-x86-64
# RUN: llvm-ar -M < %t.mri
# RUN: llvm-nm -M %t.a | FileCheck %s
; CHECK: trivial-object-test.elf-x86-64:
; CHECK-NEXT: U SomeOtherFunction
; CHECK-NEXT: 0000000000000000 T main
; CHECK-NEXT: U puts
# CHECK: Archive map
# CHECK-NEXT: main in {{.*}}elf-x86-64
; 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
# CHECK: {{.*}}elf-x86-64:
# CHECK-NEXT: U SomeOtherFunction
# CHECK-NEXT: 0000000000000000 T main
# CHECK-NEXT: U puts
; RUN: llvm-ar -M < %t2.mri
; RUN: llvm-nm -M %t.a | FileCheck --check-prefix=NEW %s
## Now test that CREATE overwrites an existing file.
# RUN: yaml2obj -docnum=2 %s > %t2.elf-x86-64
; NEW: Archive map
; NEW-NEXT: foo in trivial-object-test2.elf-x86-64
; NEW-NEXT: main in trivial-object-test2.elf-x86-64
# RUN: echo create %t.a > %t2.mri
# RUN: echo addmod %t2.elf-x86-64 >> %t2.mri
# RUN: echo save >> %t2.mri
# RUN: echo end >> %t2.mri
; NEW: trivial-object-test2.elf-x86-64:
; NEW-NEXT: 0000000000000000 t bar
; NEW-NEXT: 0000000000000006 T foo
; NEW-NEXT: 0000000000000016 T main
# RUN: llvm-ar -M < %t2.mri
# RUN: llvm-nm -M %t.a | FileCheck --check-prefix=NEW %s
# NEW: Archive map
# NEW-NEXT: foo in {{.*}}2.elf-x86-64
# NEW-NEXT: main in {{.*}}2.elf-x86-64
# NEW: {{.*}}2.elf-x86-64:
# NEW-NEXT: 0000000000000000 t bar
# NEW-NEXT: 0000000000000006 T foo
# NEW-NEXT: 0000000000000016 T main
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Symbols:
- Name: bar
Type: STT_FUNC
Section: .text
- Name: foo
Type: STT_FUNC
Section: .text
Binding: STB_GLOBAL
Value: 0x0000000000000006
- Name: main
Type: STT_FUNC
Section: .text
Binding: STB_GLOBAL
Value: 0x0000000000000016

View File

@ -1,15 +1,19 @@
Test that llvm-nm returns an error because of the unknown file type, but
keeps processing subsequent files.
## Test that llvm-nm returns an error because of the unknown file type, but
## keeps processing subsequent files.
RUN: touch %t
RUN: not llvm-nm %p/Inputs/trivial-object-test.elf-i386 %t \
RUN: %p/Inputs/trivial-object-test.elf-i386 | \
RUN: FileCheck %s
# RUN: yaml2obj %s > %t-i386
# RUN: touch %t
# RUN: not llvm-nm %t-i386 %t %t-i386 | FileCheck %s
CHECK: U SomeOtherFunction
CHECK: 00000000 T main
CHECK: U puts
# CHECK: U foo
# CHECK: U foo
CHECK: U SomeOtherFunction
CHECK: 00000000 T main
CHECK: U puts
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_386
Symbols:
- Name: foo
Binding: STB_GLOBAL

View File

@ -1,35 +1,46 @@
RUN: llvm-nm -D %p/Inputs/shared-object-test.elf-i386 \
RUN: | FileCheck %s -check-prefix ELF-32
# RUN: llvm-nm -D %p/Inputs/shared-object-test.elf-i386 \
# RUN: | FileCheck %s -check-prefix ELF-32
ELF-32-NOT: U
ELF-32: 000012c8 A __bss_start
ELF-32: 000012c8 A _edata
ELF-32: 000012cc A _end
ELF-32: 000012c8 B common_sym
ELF-32: 000012c4 D defined_sym
ELF-32: 000001f0 T global_func
ELF-32: 00000000 D tls_sym
# ELF-32-NOT: U
# ELF-32: 000012c8 A __bss_start
# ELF-32: 000012c8 A _edata
# ELF-32: 000012cc A _end
# ELF-32: 000012c8 B common_sym
# ELF-32: 000012c4 D defined_sym
# ELF-32: 000001f0 T global_func
# ELF-32: 00000000 D tls_sym
RUN: llvm-nm -D %p/Inputs/shared-object-test.elf-x86-64 \
RUN: | FileCheck %s -check-prefix ELF-64
# RUN: llvm-nm -D %p/Inputs/shared-object-test.elf-x86-64 \
# RUN: | FileCheck %s -check-prefix ELF-64
ELF-64-NOT: U
ELF-64: 0000000000200454 A __bss_start
ELF-64: 0000000000200454 A _edata
ELF-64: 0000000000200458 A _end
ELF-64: 0000000000200454 B common_sym
ELF-64: 0000000000200450 D defined_sym
ELF-64: 00000000000002f0 T global_func
ELF-64: 0000000000000000 D tls_sym
# ELF-64-NOT: U
# ELF-64: 0000000000200454 A __bss_start
# ELF-64: 0000000000200454 A _edata
# ELF-64: 0000000000200458 A _end
# ELF-64: 0000000000200454 B common_sym
# ELF-64: 0000000000200450 D defined_sym
# ELF-64: 00000000000002f0 T global_func
# ELF-64: 0000000000000000 D tls_sym
RUN: not llvm-nm -D %p/Inputs/weak-global-symbol.macho-i386 2>&1 \
RUN: | FileCheck %s -check-prefix ERROR
# RUN: not llvm-nm -D %p/Inputs/weak-global-symbol.macho-i386 2>&1 \
# RUN: | FileCheck %s -check-prefix ERROR
RUN: not llvm-nm -D %p/Inputs/trivial-object-test.coff-i386 2>&1 \
RUN: | FileCheck %s -check-prefix ERROR
# RUN: not llvm-nm -D %p/Inputs/trivial-object-test.coff-i386 2>&1 \
# RUN: | FileCheck %s -check-prefix ERROR
ERROR: File format has no dynamic symbol table.
# ERROR: File format has no dynamic symbol table.
RUN: llvm-nm -D %p/Inputs/trivial-object-test.elf-i386 2>&1 \
RUN: | FileCheck %s -check-prefix=NO-SYMBOLS
NO-SYMBOLS: no symbols
# RUN: yaml2obj %s > %t.elf-i386
# RUN: llvm-nm -D %t.elf-i386 2>&1 | FileCheck %s -check-prefix=NO-SYMBOLS
# NO-SYMBOLS: no symbols
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_386
Symbols:
- Name: foo
Binding: STB_GLOBAL

View File

@ -1,215 +1,275 @@
RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-nm -a -S - \
RUN: | FileCheck %s -check-prefix COFF32
RUN: yaml2obj %p/Inputs/COFF/x86-64.yaml | llvm-nm -a -S - \
RUN: | FileCheck %s -check-prefix COFF64
RUN: llvm-nm %p/Inputs/trivial-object-test.wasm \
RUN: | FileCheck %s -check-prefix WASM
RUN: llvm-nm %p/Inputs/trivial-object-test.elf-i386 \
RUN: | FileCheck %s -check-prefix ELF
RUN: llvm-nm %p/Inputs/trivial-object-test.elf-i386 -S \
RUN: | FileCheck %s -check-prefix ELF-SIZE
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 \
RUN: | FileCheck %s -check-prefix WEAK-ELF64
RUN: llvm-nm %p/Inputs/absolute.elf-x86-64 \
RUN: | FileCheck %s -check-prefix ABSOLUTE-ELF64
RUN: llvm-nm -a %p/Inputs/IsNAN.o \
RUN: | FileCheck %s -check-prefix ELF64-DEBUG-SYMS
RUN: llvm-nm %p/Inputs/trivial-object-test.macho-i386 \
RUN: | FileCheck %s -check-prefix macho
RUN: llvm-nm -U %p/Inputs/trivial-object-test.macho-i386 \
RUN: | FileCheck %s -check-prefix macho-U
RUN: llvm-nm %p/Inputs/trivial-object-test.macho-x86-64 \
RUN: | FileCheck %s -check-prefix macho64
RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 \
RUN: | FileCheck %s -check-prefix macho-tdb
RUN: llvm-nm -j %p/Inputs/macho-text-data-bss.macho-x86_64 \
RUN: | FileCheck %s -check-prefix macho-j
RUN: llvm-nm -r %p/Inputs/macho-text-data-bss.macho-x86_64 \
RUN: | FileCheck %s -check-prefix macho-r
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 -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
RUN: llvm-nm %p/Inputs/thumb-symbols.elf.arm \
RUN: | FileCheck %s -check-prefix ELF-THUMB
RUN: mkdir -p %t
RUN: cd %t
RUN: cp %p/Inputs/trivial-object-test.macho-i386 a.out
RUN: llvm-nm | FileCheck %s -check-prefix A-OUT
# RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-nm -a -S - \
# RUN: | FileCheck %s -check-prefix COFF32
# COFF32: 00000000 d .data
# COFF32-NEXT: 00000000 t .text
# COFF32-NEXT: 00000000 d L_.str
# COFF32-NEXT: U _SomeOtherFunction
# COFF32-NEXT: 00000000 T _main
# COFF32-NEXT: U _puts
COFF32: 00000000 d .data
COFF32-NEXT: 00000000 t .text
COFF32-NEXT: 00000000 d L_.str
COFF32-NEXT: U _SomeOtherFunction
COFF32-NEXT: 00000000 T _main
COFF32-NEXT: U _puts
# RUN: yaml2obj %p/Inputs/COFF/x86-64.yaml | llvm-nm -a -S - \
# RUN: | FileCheck %s -check-prefix COFF64
# COFF64: 00000000 d .data
# COFF64-NEXT: 00000000 t .text
# COFF64-NEXT: 00000000 r ??__Ex@@YAXXZ
# COFF64-NEXT: 00000000 d L.str
# COFF64-NEXT: U SomeOtherFunction
# COFF64-NEXT: 00000000 T main
# COFF64-NEXT: U puts
WASM: 00000000 d .L.str
WASM-NEXT: 00000019 t .LSomeOtherFunction_bitcast
WASM-NEXT: U SomeOtherFunction
WASM-NEXT: 00000001 T main
WASM-NEXT: U puts
WASM-NEXT: 00000010 D var
# RUN: llvm-nm %p/Inputs/trivial-object-test.wasm \
# RUN: | FileCheck %s -check-prefix WASM
# WASM: 00000000 d .L.str
# WASM-NEXT: 00000019 t .LSomeOtherFunction_bitcast
# WASM-NEXT: U SomeOtherFunction
# WASM-NEXT: 00000001 T main
# WASM-NEXT: U puts
# WASM-NEXT: 00000010 D var
COFF64: 00000000 d .data
COFF64-NEXT: 00000000 t .text
COFF64-NEXT: 00000000 r ??__Ex@@YAXXZ
COFF64-NEXT: 00000000 d L.str
COFF64-NEXT: U SomeOtherFunction
COFF64-NEXT: 00000000 T main
COFF64-NEXT: U puts
# RUN: yaml2obj -docnum=1 %s > %t.elf-i386
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
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_386
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Symbols:
- Name: main
Type: STT_FUNC
Section: .text
Binding: STB_GLOBAL
Size: 0x0000000000000024
- Name: SomeOtherFunction
Binding: STB_GLOBAL
- Name: puts
Binding: STB_GLOBAL
# RUN: llvm-nm %t.elf-i386 | FileCheck %s -check-prefix=ELF
ELF-NOT: U
ELF: U SomeOtherFunction
ELF: 00000000 T main
ELF: U puts
# ELF-NOT: U
# ELF: U SomeOtherFunction
# ELF: 00000000 T main
# ELF: U puts
ELF-SIZE: U SomeOtherFunction
ELF-SIZE-NEXT: 00000000 00000024 T main
ELF-SIZE-NEXT: U puts
# RUN: llvm-nm -o %t.elf-i386 | FileCheck %s -DFILE=%t.elf-i386 -check-prefix=ELF-o
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
# RUN: llvm-nm %t.elf-i386 -S | FileCheck %s -check-prefix ELF-SIZE
ELF-u: U SomeOtherFunction
ELF-u: U puts
# ELF-SIZE: U SomeOtherFunction
# ELF-SIZE-NEXT: 00000000 00000024 T main
# ELF-SIZE-NEXT: U puts
ELF64: U SomeOtherFunction
ELF64: 0000000000000000 T main
ELF64: U puts
# ELF-o-NOT: U
# ELF-o: [[FILE]]: U SomeOtherFunction
# ELF-o: [[FILE]]: 00000000 T main
# ELF-o: [[FILE]]: U puts
WEAK-ELF64: w f1
WEAK-ELF64: 0000000000000000 W f2
WEAK-ELF64: v x1
WEAK-ELF64: 0000000000000000 V x2
# RUN: llvm-nm -u %t.elf-i386 | FileCheck %s -check-prefix ELF-u
ABSOLUTE-ELF64: 0000000000000123 a a1
ABSOLUTE-ELF64: 0000000000000123 A a2
# ELF-u: U SomeOtherFunction
# ELF-u: U puts
ELF64-DEBUG-SYMS: 00000000 b .bss
ELF64-DEBUG-SYMS-NEXT: 00000000 n .comment
ELF64-DEBUG-SYMS-NEXT: 00000000 d .data
ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_abbrev
ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_aranges
ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_frame
ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_info
ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_line
ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_pubnames
ELF64-DEBUG-SYMS-NEXT: 00000000 n .note.GNU-stack
ELF64-DEBUG-SYMS-NEXT: 00000000 t .text
ELF64-DEBUG-SYMS-NEXT: 00000000 a IsNAN.cpp
ELF64-DEBUG-SYMS-NEXT: 00000014 T _ZN4llvm5IsNANEd
ELF64-DEBUG-SYMS-NEXT: 00000000 T _ZN4llvm5IsNANEf
ELF64-DEBUG-SYMS-NEXT: U __isnan
ELF64-DEBUG-SYMS-NEXT: U __isnanf
# RUN: yaml2obj -docnum=2 %s > %t.elf-x86-64
# RUN: llvm-nm %t.elf-x86-64 | FileCheck %s -check-prefix ELF64
macho: U _SomeOtherFunction
macho: 00000000 T _main
macho: U _puts
# ELF64: U SomeOtherFunction
# ELF64: 0000000000000000 T main
# ELF64: U puts
macho-U-NOT: U _SomeOtherFunction
macho-U: 00000000 T _main
macho-U-NOT: U _puts
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Symbols:
- Name: main
Type: STT_FUNC
Section: .text
Binding: STB_GLOBAL
Size: 0x0000000000000024
- Name: SomeOtherFunction
Binding: STB_GLOBAL
- Name: puts
Binding: STB_GLOBAL
macho64: 0000000000000028 s L_.str
macho64: U _SomeOtherFunction
macho64: 0000000000000000 T _main
macho64: U _puts
# RUN: llvm-nm %p/Inputs/weak.elf-x86-64 \
# RUN: | FileCheck %s -check-prefix WEAK-ELF64
macho-tdb: 0000000000000030 s EH_frame0
macho-tdb: 0000000000000070 b _b
macho-tdb: 000000000000000c D _d
macho-tdb: 0000000000000000 T _t
macho-tdb: 0000000000000048 S _t.eh
# WEAK-ELF64: w f1
# WEAK-ELF64: 0000000000000000 W f2
# WEAK-ELF64: v x1
# WEAK-ELF64: 0000000000000000 V x2
macho-j: EH_frame0
macho-j: _b
macho-j: _d
macho-j: _t
macho-j: _t.eh
# RUN: llvm-nm %p/Inputs/absolute.elf-x86-64 \
# RUN: | FileCheck %s -check-prefix ABSOLUTE-ELF64
macho-r: 0000000000000048 S _t.eh
macho-r-NEXT: 0000000000000000 T _t
macho-r-NEXT: 000000000000000c D _d
macho-r-NEXT: 0000000000000070 b _b
macho-r-NEXT: 0000000000000030 s EH_frame0
# ABSOLUTE-ELF64: 0000000000000123 a a1
# ABSOLUTE-ELF64: 0000000000000123 A a2
macho-s: 000000000000000c D _d
macho-s-NOT: 0000000000000048 S _t.eh
macho-s-NOT: 0000000000000000 T _t
macho-s-NOT: 0000000000000070 b _b
macho-s-NOT: 0000000000000030 s EH_frame0
# RUN: llvm-nm -a %p/Inputs/IsNAN.o \
# RUN: | FileCheck %s -check-prefix ELF64-DEBUG-SYMS
macho-x: 0000000000000030 0e 05 0000 00000010 EH_frame0
macho-x: 0000000000000070 0e 03 0000 0000000d _b
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
# ELF64-DEBUG-SYMS: 00000000 b .bss
# ELF64-DEBUG-SYMS-NEXT: 00000000 n .comment
# ELF64-DEBUG-SYMS-NEXT: 00000000 d .data
# ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_abbrev
# ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_aranges
# ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_frame
# ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_info
# ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_line
# ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_pubnames
# ELF64-DEBUG-SYMS-NEXT: 00000000 n .note.GNU-stack
# ELF64-DEBUG-SYMS-NEXT: 00000000 t .text
# ELF64-DEBUG-SYMS-NEXT: 00000000 a IsNAN.cpp
# ELF64-DEBUG-SYMS-NEXT: 00000014 T _ZN4llvm5IsNANEd
# ELF64-DEBUG-SYMS-NEXT: 00000000 T _ZN4llvm5IsNANEf
# ELF64-DEBUG-SYMS-NEXT: U __isnan
# ELF64-DEBUG-SYMS-NEXT: U __isnanf
# RUN: llvm-nm %p/Inputs/relocatable-with-section-address.elf-x86-64 \
# RUN: | FileCheck %s -check-prefix ELF-SEC-ADDR64
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
## Test that llvm-nm uses addresses even with ELF .o files.
# ELF-SEC-ADDR64: 0000000000000058 D a
# ELF-SEC-ADDR64-NEXT: 000000000000005c D b
# ELF-SEC-ADDR64-NEXT: 0000000000000040 T f
# ELF-SEC-ADDR64-NEXT: 0000000000000050 T g
# ELF-SEC-ADDR64-NEXT: 0000000000000060 D p
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
macho-pa: 0000000100000f30 - 01 0000 BNSYM
macho-pa: 0000000100000f30 - 01 0000 FUN _main
macho-pa: 000000000000003b - 00 0000 FUN
macho-pa: 000000000000003b - 01 0000 ENSYM
macho-pa: 0000000000000000 - 01 0000 SO
macho-pa: 0000000100000000 T __mh_execute_header
macho-pa: 0000000100000f30 T _main
macho-pa: U _printf
macho-pa: U dyld_stub_binder
# RUN: llvm-nm %p/Inputs/thumb-symbols.elf.arm \
# RUN: | FileCheck %s -check-prefix ELF-THUMB
macho-u: _printf
macho-u: dyld_stub_binder
## Test that we drop the thumb bit only from function addresses.
# ELF-THUMB: 00000000 t f
# ELF-THUMB: 00000003 t g
Test that nm uses addresses even with ELF .o files.
ELF-SEC-ADDR64: 0000000000000058 D a
ELF-SEC-ADDR64-NEXT: 000000000000005c D b
ELF-SEC-ADDR64-NEXT: 0000000000000040 T f
ELF-SEC-ADDR64-NEXT: 0000000000000050 T g
ELF-SEC-ADDR64-NEXT: 0000000000000060 D p
# RUN: llvm-nm %p/Inputs/trivial-object-test.macho-i386 \
# RUN: | FileCheck %s -check-prefix macho
# macho: U _SomeOtherFunction
# macho: 00000000 T _main
# macho: U _puts
Test that we drop the thumb bit only from function addresses.
ELF-THUMB: 00000000 t f
ELF-THUMB: 00000003 t g
# RUN: llvm-nm -U %p/Inputs/trivial-object-test.macho-i386 \
# RUN: | FileCheck %s -check-prefix macho-U
A-OUT: U _SomeOtherFunction
A-OUT: 00000000 T _main
A-OUT: U _puts
# macho-U-NOT: U _SomeOtherFunction
# macho-U: 00000000 T _main
# macho-U-NOT: U _puts
# RUN: llvm-nm %p/Inputs/trivial-object-test.macho-x86-64 \
# RUN: | FileCheck %s -check-prefix macho64
# macho64: 0000000000000028 s L_.str
# macho64: U _SomeOtherFunction
# macho64: 0000000000000000 T _main
# macho64: U _puts
# RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 \
# RUN: | FileCheck %s -check-prefix macho-tdb
# macho-tdb: 0000000000000030 s EH_frame0
# macho-tdb: 0000000000000070 b _b
# macho-tdb: 000000000000000c D _d
# macho-tdb: 0000000000000000 T _t
# macho-tdb: 0000000000000048 S _t.eh
# RUN: llvm-nm -j %p/Inputs/macho-text-data-bss.macho-x86_64 \
# RUN: | FileCheck %s -check-prefix macho-j
# macho-j: EH_frame0
# macho-j: _b
# macho-j: _d
# macho-j: _t
# macho-j: _t.eh
# RUN: llvm-nm -r %p/Inputs/macho-text-data-bss.macho-x86_64 \
# RUN: | FileCheck %s -check-prefix macho-r
# macho-r: 0000000000000048 S _t.eh
# macho-r-NEXT: 0000000000000000 T _t
# macho-r-NEXT: 000000000000000c D _d
# macho-r-NEXT: 0000000000000070 b _b
# macho-r-NEXT: 0000000000000030 s EH_frame0
# RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 -s __DATA __data \
# RUN: | FileCheck %s -check-prefix macho-s
# macho-s: 000000000000000c D _d
# macho-s-NOT: 0000000000000048 S _t.eh
# macho-s-NOT: 0000000000000000 T _t
# macho-s-NOT: 0000000000000070 b _b
# macho-s-NOT: 0000000000000030 s EH_frame0
# RUN: llvm-nm -x %p/Inputs/macho-text-data-bss.macho-x86_64 \
# RUN: | FileCheck %s -check-prefix macho-x
# macho-x: 0000000000000030 0e 05 0000 00000010 EH_frame0
# macho-x: 0000000000000070 0e 03 0000 0000000d _b
# 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
# RUN: llvm-nm -o %p/Inputs/macho-text-data-bss.macho-x86_64 \
# RUN: | FileCheck %s -check-prefix macho-o
# 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
# RUN: llvm-nm -p -a %p/Inputs/macho-hello-g.macho-x86_64 \
# RUN: | FileCheck %s -check-prefix macho-pa
# 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
# macho-pa: 0000000100000f30 - 01 0000 BNSYM
# macho-pa: 0000000100000f30 - 01 0000 FUN _main
# macho-pa: 000000000000003b - 00 0000 FUN
# macho-pa: 000000000000003b - 01 0000 ENSYM
# macho-pa: 0000000000000000 - 01 0000 SO
# macho-pa: 0000000100000000 T __mh_execute_header
# macho-pa: 0000000100000f30 T _main
# macho-pa: U _printf
# macho-pa: U dyld_stub_binder
# RUN: llvm-nm -u %p/Inputs/macho-hello-g.macho-x86_64 \
# RUN: | FileCheck %s -check-prefix macho-u
# macho-u: _printf
# macho-u: dyld_stub_binder
# RUN: llvm-nm -S -a %p/Inputs/common.coff-i386 \
# RUN: | FileCheck %s -check-prefix COFF-COMMON
# 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
# RUN: mkdir -p %t
# RUN: cd %t
# RUN: cp %p/Inputs/trivial-object-test.macho-i386 a.out
# RUN: llvm-nm | FileCheck %s -check-prefix A-OUT
# A-OUT: U _SomeOtherFunction
# A-OUT: 00000000 T _main
# A-OUT: U _puts

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +1,22 @@
RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-objdump -f - | FileCheck %s -check-prefix COFF-i386
RUN: llvm-objdump -f %p/Inputs/trivial-object-test.elf-i386 \
RUN: | FileCheck %s -check-prefix ELF-i386
# RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-objdump -f - | FileCheck %s -check-prefix COFF-i386
XFAIL: *
# COFF-i386: : file format COFF-i386
# COFF-i386: architecture: i386
# COFF-i386: start address: 0x00000000{{$}}
COFF-i386: : file format
COFF-i386: architecture: i386
COFF-i386: HAS_RELOC
COFF-i386: HAS_SYMS
COFF-i386: start address 0x
# RUN: yaml2obj %s > %t-i386
# RUN: llvm-objdump -f %t-i386 | FileCheck %s -check-prefix ELF-i386
ELF-i386: : file format elf
ELF-i386: architecture: i386
ELF-i386: HAS_RELOC
ELF-i386: HAS_SYMS
ELF-i386: start address 0x
# ELF-i386: : file format ELF32-i386
# ELF-i386: architecture: i386
# ELF-i386: start address: 0x00000000{{$}}
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_386
Symbols:
- Name: foo
Binding: STB_GLOBAL

View File

@ -1,76 +1,135 @@
RUN: llvm-objdump -r %p/Inputs/trivial-object-test.coff-i386 \
RUN: | FileCheck %s -check-prefix COFF-i386
RUN: llvm-objdump -r %p/Inputs/trivial-object-test.coff-x86-64 \
RUN: | FileCheck %s -check-prefix COFF-x86-64
RUN: llvm-objdump -r %p/Inputs/trivial-object-test.elf-i386 \
RUN: | FileCheck %s -check-prefix ELF-i386
RUN: llvm-objdump -r %p/Inputs/trivial-object-test.elf-x86-64 \
RUN: | FileCheck %s -check-prefix ELF-x86-64
RUN: llvm-objdump -r %p/Inputs/trivial-object-test.elf-hexagon \
RUN: | FileCheck %s -check-prefix ELF-hexagon
RUN: llvm-objdump -r %p/Inputs/trivial-object-test.elf-mips64el \
RUN: | FileCheck %s -check-prefix ELF-MIPS64EL
RUN: llvm-objdump -r %p/Inputs/trivial-object-test.elf-mipsel \
RUN: | FileCheck %s -check-prefix ELF-MIPSEL
RUN: llvm-objdump -r %p/Inputs/trivial-object-test.wasm \
RUN: | FileCheck %s -check-prefix WASM
# RUN: llvm-objdump -r %p/Inputs/trivial-object-test.coff-i386 \
# RUN: | FileCheck %s -check-prefix COFF-i386
# RUN: llvm-objdump -r %p/Inputs/trivial-object-test.coff-x86-64 \
# RUN: | FileCheck %s -check-prefix COFF-x86-64
RUN: llvm-objdump -r %p/Inputs/relocations.elf-x86-64 \
RUN: | FileCheck %s -check-prefix ELF-complex-x86-64
# RUN: yaml2obj -docnum=1 %s > %t-i386
# RUN: llvm-objdump -r %t-i386 | FileCheck %s -check-prefix ELF-i386
COFF-i386: .text
COFF-i386: IMAGE_REL_I386_DIR32 L_.str
COFF-i386: IMAGE_REL_I386_REL32 _puts
COFF-i386: IMAGE_REL_I386_REL32 _SomeOtherFunction
# ELF-i386: .text
# ELF-i386: R_386_32 .section
# ELF-i386: R_386_PC32 symbol
COFF-x86-64: .text
COFF-x86-64: IMAGE_REL_AMD64_REL32 L.str
COFF-x86-64: IMAGE_REL_AMD64_REL32 puts
COFF-x86-64: IMAGE_REL_AMD64_REL32 SomeOtherFunction
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_386
Sections:
- Name: .text
Type: SHT_PROGBITS
- Name: .section
Type: SHT_PROGBITS
- Name: .rel.text
Type: SHT_REL
Link: .symtab
Info: .text
Relocations:
- Offset: 0x0
Symbol: .section
Type: R_386_32
- Offset: 0x1
Symbol: symbol
Type: R_386_PC32
Symbols:
- Name: .section
Type: STT_SECTION
Section: .section
- Name: symbol
Binding: STB_GLOBAL
ELF-i386: .text
ELF-i386: R_386_32 .rodata.str1.1
ELF-i386: R_386_PC32 puts
ELF-i386: R_386_PC32 SomeOtherFunction
# RUN: yaml2obj -docnum=2 %s > %t-x86-64
# RUN: llvm-objdump -r %t-x86-64 | FileCheck %s -check-prefix ELF-x86-64
ELF-x86-64: .text
ELF-x86-64: R_X86_64_32S .rodata.str1.1
ELF-x86-64: R_X86_64_PC32 puts
ELF-x86-64: R_X86_64_PC32 SomeOtherFunction
# ELF-x86-64: .text
# ELF-x86-64: R_X86_64_32S .section
# ELF-x86-64: R_X86_64_PC32 symbol
ELF-hexagon: .text
ELF-hexagon: R_HEX_GOTREL_HI16 .main
ELF-hexagon: R_HEX_GOTREL_LO16 .main
ELF-hexagon: R_HEX_HI16 puts
ELF-hexagon: R_HEX_LO16 puts
ELF-hexagon: R_HEX_B15_PCREL testf
ELF-hexagon: R_HEX_B22_PCREL puts
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .text
Type: SHT_PROGBITS
- Name: .section
Type: SHT_PROGBITS
- Name: .rel.text
Type: SHT_REL
Link: .symtab
Info: .text
Relocations:
- Offset: 0x0
Symbol: .section
Type: R_X86_64_32S
- Offset: 0x1
Symbol: symbol
Type: R_X86_64_PC32
Symbols:
- Name: .section
Type: STT_SECTION
Section: .section
- Name: symbol
Binding: STB_GLOBAL
// Note: this file was produced with gas to make sure we don't end up in a
// situation where LLVM produces and accepts a broken file.
ELF-MIPS64EL: .data
ELF-MIPS64EL: R_MIPS_64/R_MIPS_NONE/R_MIPS_NONE zed
# RUN: llvm-objdump -r %p/Inputs/trivial-object-test.elf-hexagon \
# RUN: | FileCheck %s -check-prefix ELF-hexagon
# RUN: llvm-objdump -r %p/Inputs/trivial-object-test.elf-mips64el \
# RUN: | FileCheck %s -check-prefix ELF-MIPS64EL
# RUN: llvm-objdump -r %p/Inputs/trivial-object-test.elf-mipsel \
# RUN: | FileCheck %s -check-prefix ELF-MIPSEL
# RUN: llvm-objdump -r %p/Inputs/trivial-object-test.wasm \
# RUN: | FileCheck %s -check-prefix WASM
ELF-MIPSEL: .text
ELF-MIPSEL: R_MIPS_HI16 _gp_disp
ELF-MIPSEL: R_MIPS_LO16 _gp_disp
ELF-MIPSEL: R_MIPS_GOT16 $.str
ELF-MIPSEL: R_MIPS_LO16 $.str
ELF-MIPSEL: R_MIPS_CALL16 puts
ELF-MIPSEL: R_MIPS_CALL16 SomeOtherFunction
# RUN: llvm-objdump -r %p/Inputs/relocations.elf-x86-64 \
# RUN: | FileCheck %s -check-prefix ELF-complex-x86-64
WASM: CODE
WASM-NEXT: R_WASM_MEMORY_ADDR_SLEB .L.str
WASM-NEXT: R_WASM_FUNCTION_INDEX_LEB puts
WASM-NEXT: R_WASM_FUNCTION_INDEX_LEB .LSomeOtherFunction_bitcast
WASM-NEXT: R_WASM_FUNCTION_INDEX_LEB SomeOtherFunction
# COFF-i386: .text
# COFF-i386: IMAGE_REL_I386_DIR32 L_.str
# COFF-i386: IMAGE_REL_I386_REL32 _puts
# COFF-i386: IMAGE_REL_I386_REL32 _SomeOtherFunction
ELF-complex-x86-64: .text
ELF-complex-x86-64-NEXT: R_X86_64_8 .data-4
ELF-complex-x86-64-NEXT: R_X86_64_16 .data-4
ELF-complex-x86-64-NEXT: R_X86_64_32 .data-4
ELF-complex-x86-64-NEXT: R_X86_64_32S .data-4
ELF-complex-x86-64-NEXT: R_X86_64_64 .data-4
ELF-complex-x86-64-NEXT: R_X86_64_PC32 .data-4
ELF-complex-x86-64-NEXT: R_X86_64_32 .data
ELF-complex-x86-64-NEXT: R_X86_64_32 .data+4
# COFF-x86-64: .text
# COFF-x86-64: IMAGE_REL_AMD64_REL32 L.str
# COFF-x86-64: IMAGE_REL_AMD64_REL32 puts
# COFF-x86-64: IMAGE_REL_AMD64_REL32 SomeOtherFunction
# ELF-hexagon: .text
# ELF-hexagon: R_HEX_GOTREL_HI16 .main
# ELF-hexagon: R_HEX_GOTREL_LO16 .main
# ELF-hexagon: R_HEX_HI16 puts
# ELF-hexagon: R_HEX_LO16 puts
# ELF-hexagon: R_HEX_B15_PCREL testf
# ELF-hexagon: R_HEX_B22_PCREL puts
## Note: this file was produced with gas to make sure we don't end up in a
## situation where LLVM produces and accepts a broken file.
# ELF-MIPS64EL: .data
# ELF-MIPS64EL: R_MIPS_64/R_MIPS_NONE/R_MIPS_NONE zed
# ELF-MIPSEL: .text
# ELF-MIPSEL: R_MIPS_HI16 _gp_disp
# ELF-MIPSEL: R_MIPS_LO16 _gp_disp
# ELF-MIPSEL: R_MIPS_GOT16 $.str
# ELF-MIPSEL: R_MIPS_LO16 $.str
# ELF-MIPSEL: R_MIPS_CALL16 puts
# ELF-MIPSEL: R_MIPS_CALL16 SomeOtherFunction
# WASM: CODE
# WASM-NEXT: R_WASM_MEMORY_ADDR_SLEB .L.str
# WASM-NEXT: R_WASM_FUNCTION_INDEX_LEB puts
# WASM-NEXT: R_WASM_FUNCTION_INDEX_LEB .LSomeOtherFunction_bitcast
# WASM-NEXT: R_WASM_FUNCTION_INDEX_LEB SomeOtherFunction
# ELF-complex-x86-64: .text
# ELF-complex-x86-64-NEXT: R_X86_64_8 .data-4
# ELF-complex-x86-64-NEXT: R_X86_64_16 .data-4
# ELF-complex-x86-64-NEXT: R_X86_64_32 .data-4
# ELF-complex-x86-64-NEXT: R_X86_64_32S .data-4
# ELF-complex-x86-64-NEXT: R_X86_64_64 .data-4
# ELF-complex-x86-64-NEXT: R_X86_64_PC32 .data-4
# ELF-complex-x86-64-NEXT: R_X86_64_32 .data
# ELF-complex-x86-64-NEXT: R_X86_64_32 .data+4

View File

@ -1,24 +1,41 @@
RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-objdump -s - | FileCheck %s -check-prefix COFF-i386
RUN: llvm-objdump -s %p/Inputs/trivial-object-test.elf-i386 \
RUN: | FileCheck %s -check-prefix ELF-i386
RUN: llvm-objdump -s %p/Inputs/shared-object-test.elf-i386 \
RUN: | FileCheck %s -check-prefix BSS
# RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-objdump -s - | FileCheck %s -check-prefix COFF-i386
COFF-i386: file format
COFF-i386: Contents of section .text:
COFF-i386: 0000 83ec0cc7 44240800 000000c7 04240000 ....D$.......$..
COFF-i386: 0010 0000e800 000000e8 00000000 8b442408 .............D$.
COFF-i386: 0020 83c40cc3 ....
COFF-i386: Contents of section .data:
COFF-i386: 0000 48656c6c 6f20576f 726c6421 00 Hello World!.
# COFF-i386: file format
# COFF-i386: Contents of section .text:
# COFF-i386: 0000 83ec0cc7 44240800 000000c7 04240000 ....D$.......$..
# COFF-i386: 0010 0000e800 000000e8 00000000 8b442408 .............D$.
# COFF-i386: 0020 83c40cc3 ....
# COFF-i386: Contents of section .data:
# COFF-i386: 0000 48656c6c 6f20576f 726c6421 00 Hello World!.
ELF-i386: trivial-object-test.elf-i386: file format
ELF-i386: Contents of section .text:
ELF-i386: 0000 83ec0cc7 44240800 000000c7 04240000 ....D$.......$..
ELF-i386: 0010 0000e8fc ffffffe8 fcffffff 8b442408 .............D$.
ELF-i386: 0020 83c40cc3 ....
ELF-i386: Contents of section .rodata.str1.1:
ELF-i386: 0024 48656c6c 6f20576f 726c6421 00 Hello World!.
# RUN: yaml2obj %s > %t.elf-i386
# RUN: llvm-objdump -s %t.elf-i386 | FileCheck %s -DFILE=%t.elf-i386 -check-prefix ELF-i386
BSS: Contents of section .bss:
BSS-NEXT: <skipping contents of bss section at [12c8, 12cc)>
# ELF-i386: [[FILE]]: file format
# ELF-i386: Contents of section .text:
# ELF-i386: 0000 83ec0cc7 44240800 000000c7 04240000 ....D$.......$..
# ELF-i386: 0010 0000e8fc ffffffe8 fcffffff 8b442408 .............D$.
# ELF-i386: 0020 83c40cc3 ....
# ELF-i386: Contents of section .rodata.str1.1:
# ELF-i386: 0024 48656c6c 6f20576f 726c6421 00 Hello World!.
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_386
Sections:
- Name: .text
Type: SHT_PROGBITS
Content: 83EC0CC744240800000000C7042400000000E8FCFFFFFFE8FCFFFFFF8B44240883C40CC3
- Name: .rodata.str1.1
Type: SHT_PROGBITS
Address: 0x0000000000000024
Content: 48656C6C6F20576F726C642100
# RUN: llvm-objdump -s %p/Inputs/shared-object-test.elf-i386 \
# RUN: | FileCheck %s -check-prefix BSS
# BSS: Contents of section .bss:
# BSS-NEXT: <skipping contents of bss section at [12c8, 12cc)>

View File

@ -1,16 +1,42 @@
; RUN: llvm-objdump -h %p/Inputs/trivial-object-test.elf-x86-64 \
; RUN: | FileCheck %s
# RUN: yaml2obj %s > %t.elf-x86-64
# RUN: llvm-objdump -h %t.elf-x86-64 | FileCheck %s
; To verify this, use readelf -S, not objdump -h. Binutils objdump filters the
; results in a way that we don't emulate.
# To verify this, use readelf -S, not objdump -h. Binutils objdump filters the
# results in a way that we don't emulate.
; CHECK: Sections:
; CHECK: Idx Name Size VMA Type
; CHECK: 0 00000000 0000000000000000
; CHECK: 1 .text 00000026 0000000000000000 TEXT
; CHECK: 2 .rodata.str1.1 0000000d 0000000000000026 DATA
; CHECK: 3 .note.GNU-stack 00000000 0000000000000033
; CHECK: 4 .rela.text 00000048 0000000000000038
; CHECK: 5 .symtab 000000c0 0000000000000080
; CHECK: 6 .strtab 00000033 0000000000000140
; CHECK: 7 .shstrtab 0000004b 0000000000000173
# CHECK: Sections:
# CHECK: Idx Name Size VMA Type
# CHECK: 0 00000000 0000000000000000
# CHECK: 1 .text 00000026 0000000000000000 TEXT
# CHECK: 2 .rodata.str1.1 0000000d 0000000000000026 DATA
# CHECK: 3 .note.GNU-stack 00000000 0000000000000033
# CHECK: 4 .rela.text 00000000 0000000000000038
# CHECK: 5 .symtab 00000018 0000000000000000
# CHECK: 6 .strtab 00000001 0000000000000000
# CHECK: 7 .shstrtab 00000045 0000000000000000
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Size: 0x26
- Name: .rodata.str1.1
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ]
Address: 0x0000000000000026
Size: 0xd
- Name: .note.GNU-stack
Type: SHT_PROGBITS
Address: 0x0000000000000033
- Name: .rela.text
Type: SHT_RELA
Address: 0x0000000000000038
Link: .symtab
Info: .text
Relocations:

View File

@ -1,43 +1,86 @@
RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-objdump -t - \
RUN: | FileCheck %s -check-prefix COFF-i386
RUN: llvm-objdump -t %p/Inputs/trivial-object-test.elf-i386 \
RUN: | FileCheck %s -check-prefix ELF-i386
RUN: llvm-objdump -t %p/Inputs/trivial-object-test.macho-i386 \
RUN: | FileCheck %s -check-prefix macho-i386
RUN: llvm-objdump -t %p/Inputs/shared-object-test.elf-i386 \
RUN: | FileCheck %s -check-prefix ELF-shared
# RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-objdump -t - \
# RUN: | FileCheck %s -check-prefix COFF-i386
COFF-i386: file format
COFF-i386: SYMBOL TABLE:
COFF-i386: [ 0](sec 1)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .text
COFF-i386: AUX scnlen 0x24 nreloc 3 nlnno 0 checksum 0x0 assoc 1 comdat 0
COFF-i386: [ 2](sec 2)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .data
COFF-i386: AUX scnlen 0xd nreloc 0 nlnno 0 checksum 0x0 assoc 2 comdat 0
COFF-i386: [ 4](sec 1)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x00000000 _main
COFF-i386: [ 5](sec 2)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 L_.str
COFF-i386: [ 6](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 _puts
COFF-i386: [ 7](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 _SomeOtherFunction
# COFF-i386: file format
# COFF-i386: SYMBOL TABLE:
# COFF-i386: [ 0](sec 1)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .text
# COFF-i386: AUX scnlen 0x24 nreloc 3 nlnno 0 checksum 0x0 assoc 1 comdat 0
# COFF-i386: [ 2](sec 2)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .data
# COFF-i386: AUX scnlen 0xd nreloc 0 nlnno 0 checksum 0x0 assoc 2 comdat 0
# COFF-i386: [ 4](sec 1)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x00000000 _main
# COFF-i386: [ 5](sec 2)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 L_.str
# COFF-i386: [ 6](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 _puts
# COFF-i386: [ 7](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 _SomeOtherFunction
ELF-i386: trivial-object-test.elf-i386: file format
ELF-i386: SYMBOL TABLE:
ELF-i386: 00000000 l df *ABS* 00000000 trivial-object-test.s
ELF-i386: 00000000 l d .text 00000000 .text
ELF-i386: 00000024 l d .rodata.str1.1 00000000 .rodata.str1.1
ELF-i386: 00000031 l d .note.GNU-stack 00000000 .note.GNU-stack
ELF-i386: 00000000 g F .text 00000024 main
ELF-i386: 00000000 *UND* 00000000 SomeOtherFunction
ELF-i386: 00000000 *UND* 00000000 puts
# RUN: yaml2obj %s > %t.elf-i386
# RUN: llvm-objdump -t %t.elf-i386 | FileCheck %s -check-prefix ELF-i386
macho-i386: trivial-object-test.macho-i386: file format Mach-O 32-bit i386
macho-i386: SYMBOL TABLE:
macho-i386: 00000000 g F __TEXT,__text _main
macho-i386: 00000000 *UND* _SomeOtherFunction
macho-i386: 00000000 *UND* _puts
# ELF-i386: {{.*}}elf-i386: file format
# ELF-i386: SYMBOL TABLE:
# ELF-i386: 00000000 l df *ABS* 00000000 trivial-object-test.s
# ELF-i386: 00000000 l d .text 00000000 .text
# ELF-i386: 00000024 l d .rodata.str1.1 00000000 .rodata.str1.1
# ELF-i386: 00000031 l d .note.GNU-stack 00000000 .note.GNU-stack
# ELF-i386: 00000000 g F .text 00000024 main
# ELF-i386: 00000000 *UND* 00000000 SomeOtherFunction
# ELF-i386: 00000000 *UND* 00000000 puts
ELF-shared: shared-object-test.elf-i386: file format
ELF-shared: SYMBOL TABLE:
ELF-shared: 00000200 l F .text 00000003 local_func
ELF-shared: 000012b8 l O *ABS* 00000000 .hidden _GLOBAL_OFFSET_TABLE_
ELF-shared: 00001248 l O *ABS* 00000000 .hidden _DYNAMIC
ELF-shared: 000012c4 g O .data 00000004 defined_sym
ELF-shared: 000001f0 g F .text 00000003 global_func
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_386
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- Name: .rodata.str1.1
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ]
Address: 0x0000000000000024
- Name: .note.GNU-stack
Type: SHT_PROGBITS
Address: 0x0000000000000031
Symbols:
- Name: trivial-object-test.s
Type: STT_FILE
Index: SHN_ABS
- Name: .text
Type: STT_SECTION
Section: .text
- Name: .rodata.str1.1
Type: STT_SECTION
Section: .rodata.str1.1
- Name: .note.GNU-stack
Type: STT_SECTION
Section: .note.GNU-stack
- Name: main
Type: STT_FUNC
Section: .text
Binding: STB_GLOBAL
Size: 0x0000000000000024
- Name: SomeOtherFunction
Binding: STB_GLOBAL
- Name: puts
Binding: STB_GLOBAL
# RUN: llvm-objdump -t %p/Inputs/trivial-object-test.macho-i386 \
# RUN: | FileCheck %s -check-prefix macho-i386
# macho-i386: trivial-object-test.macho-i386: file format Mach-O 32-bit i386
# macho-i386: SYMBOL TABLE:
# macho-i386: 00000000 g F __TEXT,__text _main
# macho-i386: 00000000 *UND* _SomeOtherFunction
# macho-i386: 00000000 *UND* _puts
# RUN: llvm-objdump -t %p/Inputs/shared-object-test.elf-i386 \
# RUN: | FileCheck %s -check-prefix ELF-shared
# ELF-shared: shared-object-test.elf-i386: file format
# ELF-shared: SYMBOL TABLE:
# ELF-shared: 00000200 l F .text 00000003 local_func
# ELF-shared: 000012b8 l O *ABS* 00000000 .hidden _GLOBAL_OFFSET_TABLE_
# ELF-shared: 00001248 l O *ABS* 00000000 .hidden _DYNAMIC
# ELF-shared: 000012c4 g O .data 00000004 defined_sym
# ELF-shared: 000001f0 g F .text 00000003 global_func

View File

@ -1,2 +1,10 @@
// Don't crash if required information is absent
RUN: llvm-readobj --dyn-syms %p/Inputs/trivial-object-test.elf-x86-64
## Don't crash if required information is absent
# RUN: yaml2obj %s > %t
# RUN: llvm-readobj --dyn-syms %t
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_386

View File

@ -1,2 +0,0 @@
// Don't crash while reading non-dynamic files.
RUN: llvm-readobj %p/Inputs/trivial-object-test.elf-x86-64

View File

@ -0,0 +1,50 @@
## Show the behavior of llvm-readobj/llvm-readelf when no operations are requested.
## Check the behavior on ET_EXEC input.
# RUN: yaml2obj --docnum=1 %s -o %t.exe
# RUN: llvm-readobj %t.exe | FileCheck %s -DFILE=%t.exe --check-prefix LLVM
# RUN: llvm-readelf %t.exe | FileCheck %s -DFILE=%t.exe --check-prefix GNU --allow-empty
# LLVM: File: [[FILE]]
# LLVM: Format: ELF64-x86-64
# LLVM: Arch: x86_64
# LLVM: AddressSize: 64bit
# LLVM: LoadName: <Not found>{{$}}
# LLVM-EMPTY:
# LLVM-NOT: {{.}}
# GNU-NOT: {{.}}
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_X86_64
## Check the behavior on ET_REL input.
# RUN: yaml2obj --docnum=2 %s -o %t.o
# RUN: llvm-readobj %t.o | FileCheck %s -DFILE=%t.o --check-prefix LLVM
# RUN: llvm-readelf %t.o | FileCheck %s -DFILE=%t.o --check-prefix GNU --allow-empty
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
## Check the behavior on ET_DYN input.
# RUN: yaml2obj --docnum=3 %s -o %t.so
# RUN: llvm-readobj %t.so | FileCheck %s -DFILE=%t.so --check-prefix LLVM
# RUN: llvm-readelf %t.so | FileCheck %s -DFILE=%t.so --check-prefix GNU --allow-empty
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64