1## Test how we dump SHT_RELR sections for 32 and 64-bit targets.
2
3## Test we use the "Entries" property when it is possible to
4## dump values correctly. Also, check we do not dump sh_entsize when
5## it has the default value.
6
7# RUN: yaml2obj --docnum=1 -D BITS=32 -D ENCODE=LSB %s -o %t.32le
8# RUN: obj2yaml %t.32le | FileCheck %s --check-prefix=ELF32LE
9# RUN: yaml2obj --docnum=1 -D BITS=32 -D ENCODE=MSB %s -o %t.32be
10# RUN: obj2yaml %t.32be | FileCheck %s --check-prefix=ELF32BE
11# RUN: yaml2obj --docnum=1 -D BITS=64 -D ENCODE=LSB %s -o %t.64le
12# RUN: obj2yaml %t.64le | FileCheck %s --check-prefix=ELF64LE
13# RUN: yaml2obj --docnum=1 -D BITS=64 -D ENCODE=MSB %s -o %t.64be
14# RUN: obj2yaml %t.64be | FileCheck %s --check-prefix=ELF64BE
15
16# ELF64LE:      Sections:
17# ELF64LE-NEXT:   - Name:    .relr.dyn
18# ELF64LE-NEXT:     Type:    SHT_RELR
19# ELF64LE-NEXT:     Entries: [ 0x8877665544332211 ]
20
21# ELF32LE:      Sections:
22# ELF32LE-NEXT:   - Name:    .relr.dyn
23# ELF32LE-NEXT:     Type:    SHT_RELR
24# ELF32LE-NEXT:     Entries: [ 0x0000000044332211, 0x0000000088776655 ]
25
26# ELF64BE:      Sections:
27# ELF64BE-NEXT:   - Name:    .relr.dyn
28# ELF64BE-NEXT:     Type:    SHT_RELR
29# ELF64BE-NEXT:     Entries: [ 0x1122334455667788 ]
30
31# ELF32BE:      Sections:
32# ELF32BE-NEXT:  - Name:    .relr.dyn
33# ELF32BE-NEXT:    Type:    SHT_RELR
34# ELF32BE-NEXT:    Entries: [ 0x0000000011223344, 0x0000000055667788 ]
35
36--- !ELF
37FileHeader:
38  Class:   ELFCLASS[[BITS]]
39  Data:    ELFDATA2[[ENCODE]]
40  Type:    ET_DYN
41  Machine: EM_X86_64
42Sections:
43  - Name: .relr.dyn
44    Type: SHT_RELR
45    Content: "1122334455667788"
46
47## Test we use the "Content" property when a SHT_RELR section is truncated.
48
49# RUN: yaml2obj --docnum=2 %s -o %t.content
50# RUN: obj2yaml %t.content | FileCheck %s --check-prefix=CONTENT
51
52# CONTENT:      - Name:    .relr.dyn
53# CONTENT-NEXT:   Type:    SHT_RELR
54# CONTENT-NEXT:   Content: '11223344556677'
55
56--- !ELF
57FileHeader:
58  Class:   ELFCLASS64
59  Data:    ELFDATA2MSB
60  Type:    ET_DYN
61  Machine: EM_X86_64
62Sections:
63  - Name: .relr.dyn
64    Type: SHT_RELR
65    Content: "11223344556677"
66
67## Test we are able to dump a SHT_RELR section when sh_entsize is invalid.
68## Here we use 0xFE as a value instead of expected 0x8.
69
70# RUN: yaml2obj --docnum=3 %s -o %t.entsize
71# RUN: obj2yaml %t.entsize | FileCheck %s --check-prefix=ENTSIZE
72
73# ENTSIZE:        - Name:    .relr.dyn
74# ENTSIZE-NEXT:     Type:    SHT_RELR
75# ENTSIZE-NEXT:     EntSize: 0x00000000000000FE
76# ENTSIZE-NEXT:     Content: '1122334455667788'
77# ENTSIZE-NEXT: ...
78
79--- !ELF
80FileHeader:
81  Class:   ELFCLASS64
82  Data:    ELFDATA2MSB
83  Type:    ET_DYN
84  Machine: EM_X86_64
85Sections:
86  - Name:    .relr.dyn
87    Type:    SHT_RELR
88    EntSize: 0xFE
89    Content: "1122334455667788"
90