Compiler projects using llvm
## Test how --syms/-t prints the static symbol table.
# RUN: yaml2obj --docnum=1 %s -o %t
# RUN: llvm-objdump --syms %t > %t.txt
# RUN: llvm-objdump -t %t | cmp - %t.txt
# RUN: FileCheck %s --input-file=%t.txt --match-full-lines --strict-whitespace

#      CHECK:{{.*}}file format elf64-x86-64
#CHECK-EMPTY:
# CHECK-NEXT:SYMBOL TABLE:
# CHECK-NEXT:0000000000000000 l    df *ABS*	0000000000000000 a.c
# CHECK-NEXT:0000000000000000 l    d  .text	0000000000000000 .text
# CHECK-NEXT:0000000000002000 l     O .data	0000000000000000 local_object
# CHECK-NEXT:0000000000001fff l     F .text	0000000000000000 local_func
# CHECK-NEXT:0000000000000000 l       *ABS*	0000000000000000 local_abs
# CHECK-NEXT:0000000000000000 g       .data	0000000000000000 notype
# CHECK-NEXT:0000000000000000 g     O .data	0000000000000010 object
# CHECK-NEXT:0000000000000000 g     F .text	000000000000000f func
# CHECK-NEXT:0000000000000000 g     O *COM*	0000000000000000 common
# CHECK-NEXT:0000000000000000 g       .data	0000000000000000 tls
# CHECK-NEXT:0000000000000000 g   i   .text	0000000000000000 ifunc
# CHECK-NEXT:0000000000000000 g       .text	0000000000000000 invalid_type
# CHECK-NEXT:0000000000000000 g       .text	0000000000000000 STT_HIOS
# CHECK-NEXT:0000000000000000 g       .text	0000000000000000 STT_LOPROC
# CHECK-NEXT:0000000000000000         *UND*	0000000000000000 undef
# CHECK-NEXT:0000000000000000         *UND*	0000000000000000 SHN_LOPROC
# CHECK-NEXT:0000000000000000         *UND*	0000000000000000 SHN_LOOS
# CHECK-NEXT:0000000000000000         *UND*	0000000000000000 reserve
# CHECK-NEXT:0000000000000000 g       *ABS*	0000000000000000 abs
# CHECK-NEXT:0000000000000000         *COM*	0000000000000000 common2
# CHECK-NEXT:0000000000000000 u     O .data	0000000000000000 gnu_unique
# CHECK-NEXT:0000000000000000 g       .data	0000000000000000 invalid_binding
# CHECK-NEXT:0000000000000000 g       .data	0000000000000000 STB_HIOS
# CHECK-NEXT:0000000000000000 g       .data	0000000000000000 STB_LOPROC

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_EXEC
  Machine: EM_X86_64
Sections:
  - Name:  .text
    Type:  SHT_PROGBITS
  - Name:  .data
    Type:  SHT_PROGBITS
Symbols:
  - Name:    "a.c"
    Type:    STT_FILE
    Index:   SHN_ABS
  - Type:    STT_SECTION
    Section: .text
  - Name:    local_object
    Type:    STT_OBJECT
    Section: .data
    Value:   0x2000
  - Name:    local_func
    Type:    STT_FUNC
    Section: .text
    Value:   0x1fff
  - Name:    local_abs
    Index:   SHN_ABS
  - Name:    notype
    Binding: STB_GLOBAL
    Section: .data
  - Name:    object
    Type:    STT_OBJECT
    Size:    0x10
    Binding: STB_GLOBAL
    Section: .data
  - Name:    func
    Type:    STT_FUNC
    Size:    0xf
    Binding: STB_GLOBAL
    Section: .text
  - Name:    common
    Type:    STT_COMMON
    Binding: STB_GLOBAL
    Section: .data
  - Name:    tls
    Type:    STT_TLS
    Binding: STB_GLOBAL
    Section: .data
  - Name:    ifunc
    Type:    STT_GNU_IFUNC
    Binding: STB_GLOBAL
    Section: .text
  - Name:    invalid_type
    Type:    7
    Binding: STB_GLOBAL
    Section: .text
  - Name:    STT_HIOS
    Type:    12
    Binding: STB_GLOBAL
    Section: .text
  - Name:    STT_LOPROC
    Type:    13
    Binding: STB_GLOBAL
    Section: .text
  - Name:    undef
    Binding: STB_GLOBAL
  - Name:    SHN_LOPROC
    Binding: STB_GLOBAL
    Index:   0xff00
  - Name:    SHN_LOOS
    Binding: STB_GLOBAL
    Index:   0xff20
  - Name:    reserve
    Binding: STB_GLOBAL
    Index:   0xff40
  - Name:    abs
    Index:   SHN_ABS
    Binding: STB_GLOBAL
  - Name:    common2
    Binding: STB_GLOBAL
    Index:   SHN_COMMON
  - Name:    gnu_unique
    Type:    STT_OBJECT
    Binding: STB_GNU_UNIQUE
    Section: .data
  - Name:    invalid_binding
    Binding: 3
    Section: .data
  - Name:    STB_HIOS
    Binding: 12
    Section: .data
  - Name:    STB_LOPROC
    Binding: 13
    Section: .data

## For an ELF32 object, print the address and size fields as 32-bit hexadecimals.
# RUN: yaml2obj --docnum=2 -D BITS=32 %s -o %t.32
# RUN: llvm-objdump --syms %t.32 | FileCheck --check-prefix=ELF32 %s --match-full-lines --strict-whitespace
## For an ELF64 object, print the address and size fields as 64-bit hexadecimals.
# RUN: yaml2obj --docnum=2 -D BITS=64 %s -o %t.64
# RUN: llvm-objdump --syms %t.64 | FileCheck --check-prefix=ELF64 %s --match-full-lines --strict-whitespace

#      ELF32:SYMBOL TABLE:
# ELF32-NEXT:00000000         *UND*	00000000 sym

#      ELF64:SYMBOL TABLE:
# ELF64-NEXT:0000000000000000         *UND*	0000000000000000 sym

--- !ELF
FileHeader:
  Class:   ELFCLASS[[BITS]]
  Data:    ELFDATA2LSB
  Type:    ET_EXEC
  Machine: EM_X86_64
Symbols:
  - Name: sym