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: [ 0x44332211, 0x88776655 ]
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: [ 0x11223344, 0x55667788 ]
35
36--- !ELF
37FileHeader:
38  Class: ELFCLASS[[BITS]]
39  Data:  ELFDATA2[[ENCODE]]
40  Type:  ET_DYN
41Sections:
42  - Name: .relr.dyn
43    Type: SHT_RELR
44    Content: "1122334455667788"
45
46## Test we use the "Content" property when a SHT_RELR section is truncated.
47
48# RUN: yaml2obj --docnum=2 %s -o %t.content
49# RUN: obj2yaml %t.content | FileCheck %s --check-prefix=CONTENT
50
51# CONTENT:      - Name:    .relr.dyn
52# CONTENT-NEXT:   Type:    SHT_RELR
53# CONTENT-NEXT:   Content: '11223344556677'
54
55--- !ELF
56FileHeader:
57  Class: ELFCLASS64
58  Data:  ELFDATA2MSB
59  Type:  ET_DYN
60Sections:
61  - Name: .relr.dyn
62    Type: SHT_RELR
63    Content: "11223344556677"
64
65## Test we are able to dump a SHT_RELR section when sh_entsize is invalid.
66## Here we use 0xFE as a value instead of expected 0x8.
67
68# RUN: yaml2obj --docnum=3 %s -o %t.entsize
69# RUN: obj2yaml %t.entsize | FileCheck %s --check-prefix=ENTSIZE
70
71# ENTSIZE:        - Name:    .relr.dyn
72# ENTSIZE-NEXT:     Type:    SHT_RELR
73# ENTSIZE-NEXT:     EntSize: 0xFE
74# ENTSIZE-NEXT:     Content: '1122334455667788'
75# ENTSIZE-NEXT: ...
76
77--- !ELF
78FileHeader:
79  Class: ELFCLASS64
80  Data:  ELFDATA2MSB
81  Type:  ET_DYN
82Sections:
83  - Name:    .relr.dyn
84    Type:    SHT_RELR
85    EntSize: 0xFE
86    Content: "1122334455667788"
87