# RUN: yaml2obj -format=elf %s | llvm-readobj -symbols - | \
# RUN:   FileCheck --check-prefix OBJ %s
# RUN: yaml2obj -format=elf %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: 1
# 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: 2
# 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: 3
# 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

---
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
      Section:         .data
      Value:           0x10
      Size:            0x04