xref: /llvm-project/llvm/test/tools/llvm-readobj/ELF/no-shdrs.test (revision a36de097faf7ada39a5fd38ddc4cb8c8e258bd2e)
1# Show that llvm-readobj can handle ELF files where the section header table has
2# been stripped, both for GNU and LLVM style output.
3
4# RUN: yaml2obj %s -o %t.raw
5# RUN: llvm-objcopy --strip-sections %t.raw %t.o
6# RUN: llvm-readobj --file-headers --section-headers --symbols %t.o | FileCheck %s --check-prefix=LLVM
7# RUN: llvm-readelf --file-headers --section-headers --symbols %t.o | FileCheck %s --check-prefix=GNU --allow-empty
8# RUN: llvm-readelf --file-headers --section-details --symbols %t.o | FileCheck %s --check-prefix=GNU --allow-empty
9
10# LLVM:      SectionHeaderCount:      0
11# LLVM:      StringTableSectionIndex: 0
12# LLVM:      Sections [
13# LLVM-NEXT: ]
14# LLVM-NEXT: Symbols [
15# LLVM-NEXT: ]
16
17# GNU:     Number of section headers:         0
18# GNU:     Section header string table index: 0
19# GNU-EMPTY:
20# GNU:     There are no sections in this file.
21# GNU-NOT: Symbol table '{{.*}}' contains {{.*}} entries
22
23--- !ELF
24FileHeader:
25  Class: ELFCLASS64
26  Data:  ELFDATA2LSB
27  Type:  ET_REL
28Sections:
29  - Name: .text
30    Type: SHT_PROGBITS
31Symbols:
32  - Name:    foobar
33    Section: .text
34    Binding: STB_GLOBAL
35