1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00
llvm-mirror/test/Object/yaml2obj-elf-symbol-visibility.yaml
Chris Bieneman 1f183c5130 [yaml2obj] Remove --format option in favor of YAML tags
Summary:
Our YAML library's handling of tags isn't perfect, but it is good enough to get rid of the need for the --format argument to yaml2obj. This patch does exactly that.

Instead of requiring --format, it infers the format based on the tags found in the object file. The supported tags are:

!ELF
!COFF
!mach-o
!fat-mach-o

I have a corresponding patch that is quite large that fixes up all the in-tree test cases.

Reviewers: rafael, Bigcheese, compnerd, silvas

Subscribers: compnerd, llvm-commits

Differential Revision: http://reviews.llvm.org/D21711

llvm-svn: 273915
2016-06-27 19:53:53 +00:00

137 lines
4.3 KiB
YAML

# RUN: yaml2obj %s | llvm-readobj -symbols - | \
# RUN: FileCheck --check-prefix OBJ %s
# RUN: yaml2obj %s | obj2yaml - | FileCheck --check-prefix YAML %s
# OBJ: Symbol {
# OBJ: Name: default1 (36)
# OBJ-NEXT: Value: 0x0
# OBJ-NEXT: Size: 4
# OBJ-NEXT: Binding: Global (0x1)
# OBJ-NEXT: Type: Object (0x1)
# OBJ-NEXT: Other: 0
# OBJ-NEXT: Section: .data (0x1)
# OBJ-NEXT: }
# OBJ-NEXT: Symbol {
# OBJ-NEXT: Name: default2 (27)
# OBJ-NEXT: Value: 0x4
# OBJ-NEXT: Size: 4
# OBJ-NEXT: Binding: Global (0x1)
# OBJ-NEXT: Type: Object (0x1)
# OBJ-NEXT: Other: 0
# OBJ-NEXT: Section: .data (0x1)
# OBJ-NEXT: }
# OBJ-NEXT: Symbol {
# OBJ-NEXT: Name: internal (8)
# OBJ-NEXT: Value: 0x8
# OBJ-NEXT: Size: 4
# OBJ-NEXT: Binding: Global (0x1)
# OBJ-NEXT: Type: Object (0x1)
# OBJ-NEXT: Other [ (0x1)
# OBJ-NEXT: STV_INTERNAL
# OBJ-NEXT: ]
# OBJ-NEXT: Section: .data (0x1)
# OBJ-NEXT: }
# OBJ-NEXT: Symbol {
# OBJ-NEXT: Name: hidden (1)
# OBJ-NEXT: Value: 0xC
# OBJ-NEXT: Size: 4
# OBJ-NEXT: Binding: Global (0x1)
# OBJ-NEXT: Type: Object (0x1)
# OBJ-NEXT: Other [ (0x2)
# OBJ-NEXT: STV_HIDDEN
# OBJ-NEXT: ]
# OBJ-NEXT: Section: .data (0x1)
# OBJ-NEXT: }
# OBJ-NEXT: Symbol {
# OBJ-NEXT: Name: protected (17)
# OBJ-NEXT: Value: 0x10
# OBJ-NEXT: Size: 4
# OBJ-NEXT: Binding: Global (0x1)
# OBJ-NEXT: Type: Object (0x1)
# OBJ-NEXT: Other [ (0xA3)
# OBJ-NEXT: STO_MIPS_MICROMIPS
# OBJ-NEXT: STO_MIPS_PIC
# OBJ-NEXT: STV_PROTECTED
# OBJ-NEXT: ]
# OBJ-NEXT: Section: .data (0x1)
# OBJ-NEXT: }
# YAML: Symbols:
# YAML-NEXT: Global:
# YAML-NEXT: - Name: default1
# YAML-NEXT: Type: STT_OBJECT
# YAML-NEXT: Section: .data
# YAML-NEXT: Size: 0x0000000000000004
# YAML-NEXT: - Name: default2
# YAML-NEXT: Type: STT_OBJECT
# YAML-NEXT: Section: .data
# YAML-NEXT: Value: 0x0000000000000004
# YAML-NEXT: Size: 0x0000000000000004
# YAML-NEXT: - Name: internal
# YAML-NEXT: Type: STT_OBJECT
# YAML-NEXT: Section: .data
# YAML-NEXT: Value: 0x0000000000000008
# YAML-NEXT: Size: 0x0000000000000004
# YAML-NEXT: Visibility: STV_INTERNAL
# YAML-NEXT: - Name: hidden
# YAML-NEXT: Type: STT_OBJECT
# YAML-NEXT: Section: .data
# YAML-NEXT: Value: 0x000000000000000C
# YAML-NEXT: Size: 0x0000000000000004
# YAML-NEXT: Visibility: STV_HIDDEN
# YAML-NEXT: - Name: protected
# YAML-NEXT: Type: STT_OBJECT
# YAML-NEXT: Section: .data
# YAML-NEXT: Value: 0x0000000000000010
# YAML-NEXT: Size: 0x0000000000000004
# YAML-NEXT: Visibility: STV_PROTECTED
# YAML-NEXT: Other: [ STO_MIPS_PIC, STO_MIPS_MICROMIPS ]
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Flags: [ EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ]
Sections:
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_WRITE ]
AddressAlign: 0x04
Size: 0x14
Symbols:
Global:
- Name: default1
Type: STT_OBJECT
Visibility: STV_DEFAULT
Section: .data
Value: 0x00
Size: 0x04
- Name: default2
Type: STT_OBJECT
Section: .data
Value: 0x04
Size: 0x04
- Name: internal
Type: STT_OBJECT
Visibility: STV_INTERNAL
Section: .data
Value: 0x08
Size: 0x04
- Name: hidden
Type: STT_OBJECT
Visibility: STV_HIDDEN
Section: .data
Value: 0x0C
Size: 0x04
- Name: protected
Type: STT_OBJECT
Visibility: STV_PROTECTED
Other: [ STO_MIPS_MICROMIPS, STO_MIPS_PIC ]
Section: .data
Value: 0x10
Size: 0x04