1# RUN: yaml2obj --docnum=1 %s -o %t1.o
2# RUN: llvm-nm %t1.o --format=sysv | FileCheck %s
3
4--- !ELF
5FileHeader:
6  Class:   ELFCLASS64
7  Data:    ELFDATA2LSB
8  Type:    ET_REL
9  Machine: EM_X86_64
10Sections:
11  - Name:  .text
12    Type:  SHT_PROGBITS
13    Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
14Symbols:
15  - Name:    symbol_undefined
16  - Name:    symbol
17    Section: .text
18  - Name:    symbol_common
19    Index:   SHN_COMMON
20  - Name:    symbol_absolute
21    Index:   SHN_ABS
22  - Name:    proc
23    Index:   0xff01
24  - Name:    os
25    Index:   0xff21
26  - Name:    reserved
27    Index:   0xfffe
28
29# CHECK:      os               {{.*}}|
30# CHECK-NEXT: proc             {{.*}}|
31# CHECK-NEXT: reserved         {{.*}}|
32# CHECK-NEXT: symbol           {{.*}}|     |.text
33# CHECK-NEXT: symbol_absolute  {{.*}}|     |*ABS*
34# CHECK-NEXT: symbol_common    {{.*}}|     |*COM*
35# CHECK-NEXT: symbol_undefined {{.*}}|     |*UND*
36
37## Here we have a symbol that belongs to a section with a broken name
38## (sh_name offset goes past the end of the sections name string table).
39## We test that we can still print a reasonable output and don't crash/assert.
40
41# RUN: yaml2obj --docnum=2 %s -o %t2.o
42# RUN: llvm-nm %t2.o --format=sysv | FileCheck %s --check-prefix=ERR
43
44# ERR: foo |0000000000000000| ? | NOTYPE|0000000000000000| |
45
46--- !ELF
47FileHeader:
48  Class:   ELFCLASS64
49  Data:    ELFDATA2LSB
50  Type:    ET_REL
51  Machine: EM_X86_64
52Sections:
53  - Name:  .broken
54    Type:  SHT_PROGBITS
55    Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
56    ShName: 0xffff
57Symbols:
58  - Name:    foo
59    Section: .broken
60