--- /dev/null
+## 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: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 O .data 0000000000000000 tls
+# CHECK-NEXT:0000000000000000 g .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 g 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
+++ /dev/null
-# RUN: yaml2obj -D BITS=32 %s -o %t.32
-# RUN: llvm-objdump --syms %t.32 > %t.32.txt
-# RUN: llvm-objdump -t %t.32 | cmp - %t.32.txt
-# RUN: FileCheck --check-prefix=ELF32 %s --input-file=%t.32.txt
-
-# RUN: yaml2obj -D BITS=64 %s -o %t.64
-# RUN: llvm-objdump --syms %t.64 | FileCheck --check-prefix=ELF64 %s
-
-# ELF32: SYMBOL TABLE:
-# ELF32-NEXT: 00001004 l F .text 00000000 lfoo
-# ELF32-NEXT: 00001008 l O .text 00000000 lbar
-# ELF32-NEXT: 00001004 g F .text 00000000 foo
-# ELF32-NEXT: 00001008 g O .text 00000000 bar
-
-# ELF64: SYMBOL TABLE:
-# ELF64-NEXT: 0000000000001004 l F .text 0000000000000000 lfoo
-# ELF64-NEXT: 0000000000001008 l O .text 0000000000000000 lbar
-# ELF64-NEXT: 0000000000001004 g F .text 0000000000000000 foo
-# ELF64-NEXT: 0000000000001008 g O .text 0000000000000000 bar
-
-!ELF
-FileHeader:
- Class: ELFCLASS[[BITS]]
- Data: ELFDATA2LSB
- Type: ET_EXEC
- Machine: EM_X86_64
-Sections:
- - Name: .bss
- Type: SHT_NOBITS
- Flags: [ SHF_ALLOC ]
- AddressAlign: 0x0000000000000010
- Size: 64
- - Name: .text
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- AddressAlign: 0x0000000000000010
- Content: "00000000"
-Symbols:
- - Name: lfoo
- Type: STT_FUNC
- Section: .text
- Value: 0x1004
- - Name: lbar
- Type: STT_OBJECT
- Section: .text
- Value: 0x1008
- - Name: foo
- Type: STT_FUNC
- Section: .text
- Value: 0x1004
- Binding: STB_GLOBAL
- - Name: bar
- Type: STT_OBJECT
- Section: .text
- Value: 0x1008
- Binding: STB_GLOBAL
-