xref: /llvm-project/llvm/test/tools/llvm-readobj/ELF/no-relocs.test (revision a6436b0b3a7fd9f13d7a059a6a78544a7e0b702f)
1# Show that llvm-readobj can handle no relocations when --relocations is
2# requested, both for LLVM and GNU output, both for no relocation sections and
3# for empty relocation sections.
4
5# RUN: yaml2obj %s -o %t.no_relocs
6# RUN: llvm-readobj %t.no_relocs --relocations | FileCheck %s --check-prefix NO-RELOCS-LLVM
7# RUN: llvm-readelf %t.no_relocs --relocations | FileCheck %s --check-prefix NO-RELOCS-GNU
8
9# RUN: llvm-objcopy -R .rela.text -R .rel.text %t.no_relocs %t.no_sec
10# RUN: llvm-readobj %t.no_sec --relocations | FileCheck %s --check-prefix NO-SEC-LLVM
11# RUN: llvm-readelf %t.no_sec --relocations | FileCheck %s --check-prefix NO-SEC-GNU
12
13# NO-RELOCS-LLVM:      Relocations [
14# NO-RELOCS-LLVM-NEXT:   Section (2) .rela.text {
15# NO-RELOCS-LLVM-NEXT:   }
16# NO-RELOCS-LLVM-NEXT:   Section (3) .rel.text {
17# NO-RELOCS-LLVM-NEXT:   }
18# NO-RELOCS-LLVM-NEXT: ]
19
20# NO-RELOCS-GNU:       Relocation section '.rela.text' at offset {{.*}} contains 0 entries:
21# NO-RELOCS-GNU-NEXT:    Offset Info Type Symbol's Value Symbol's Name + Addend
22# NO-RELOCS-GNU-EMPTY:
23# NO-RELOCS-GNU-NEXT:  Relocation section '.rel.text' at offset {{.*}} contains 0 entries:
24# NO-RELOCS-GNU-NEXT:   Offset Info Type Symbol's Value Symbol's Name
25# NO-RELOCS-GNU-EMPTY:
26
27# NO-SEC-LLVM:      Relocations [
28# NO-SEC-LLVM-NEXT: ]
29
30# NO-SEC-GNU: There are no relocations in this file.
31
32--- !ELF
33FileHeader:
34  Class: ELFCLASS64
35  Data:  ELFDATA2LSB
36  Type:  ET_REL
37Sections:
38  - Name: .text
39    Type: SHT_PROGBITS
40  - Name: .rela.text
41    Type: SHT_RELA
42    Info: .text
43  - Name: .rel.text
44    Type: SHT_REL
45    Info: .text
46