@@ -45,9 +45,13 @@ ProgramHeaders:
45
45
## Check we can dump the SHT_HASH section even when an object
46
46
## does not have the section header table.
47
47
48
- # RUN: yaml2obj --docnum=2 %s -o %t.noshdr
49
- # RUN: llvm-readobj --hash-table %t.noshdr | FileCheck %s --check-prefix=NOSHDR
50
- # RUN: llvm-readelf --hash-table %t.noshdr | FileCheck %s --check-prefix=NOSHDR
48
+ # RUN: yaml2obj --docnum=2 -DNOHEADERS=true %s -o %t.noshdr
49
+ # RUN: llvm-readobj --hash-table %t.noshdr 2>&1 | \
50
+ # RUN: FileCheck %s -DFILE=%t.noshdr --check-prefix=NOSHDR --implicit-check-not=warning:
51
+ # RUN: llvm-readelf --hash-table %t.noshdr 2>&1 | \
52
+ # RUN: FileCheck %s -DFILE=%t.noshdr --check-prefix=NOSHDR --implicit-check-not=warning:
53
+
54
+ # NOSHDR: warning: '[[FILE]]': string table was not found
51
55
52
56
# NOSHDR: HashTable {
53
57
# NOSHDR-NEXT: Num Buckets: 1
@@ -58,37 +62,57 @@ ProgramHeaders:
58
62
59
63
--- !ELF
60
64
FileHeader:
61
- Class: ELFCLASS64
62
- Data: ELFDATA2LSB
63
- Type: ET_DYN
64
- ## We simulate no section header table by
65
- ## overriding the ELF header properties.
66
- EShOff: 0x0
67
- EShNum: 0x0
65
+ Class: ELFCLASS64
66
+ Data: ELFDATA2LSB
67
+ Type: ET_DYN
68
68
Sections:
69
69
- Name: .hash
70
70
Type: SHT_HASH
71
71
Flags: [ SHF_ALLOC ]
72
72
Bucket: [ 0 ]
73
73
Chain: [ 1 ]
74
+ EntSize: [[ENTSIZE=4]]
74
75
- Name: .dynamic
75
76
Type: SHT_DYNAMIC
76
77
Flags: [ SHF_ALLOC ]
77
78
Entries:
78
- - Tag: DT_HASH
79
+ - Tag: [[DYNTAG= DT_HASH]]
79
80
Value: 0x0
80
81
- Tag: DT_NULL
81
82
Value: 0x0
83
+ SectionHeaderTable:
84
+ NoHeaders: [[NOHEADERS=false]]
82
85
ProgramHeaders:
83
86
- Type: PT_LOAD
84
87
Sections:
85
88
- Section: .hash
86
89
- Section: .dynamic
87
90
- Type: PT_DYNAMIC
88
- VAddr: 0x1010
91
+ VAddr: 0x10
89
92
Sections:
90
93
- Section: .dynamic
91
94
95
+ ## Document we don't report a warning when the value of the sh_entsize field of the SHT_HASH section is not 4.
96
+
97
+ # RUN: yaml2obj --docnum=2 -DENTSIZE=0xff %s -o %t.ent.size
98
+ # RUN: llvm-readobj --hash-table %t.ent.size 2>&1 | \
99
+ # RUN: FileCheck %s -DFILE=%t.ent.size --check-prefix=NOSHDR --implicit-check-not=warning:
100
+ # RUN: llvm-readelf --hash-table %t.ent.size 2>&1 | \
101
+ # RUN: FileCheck %s -DFILE=%t.ent.size --check-prefix=NOSHDR --implicit-check-not=warning:
102
+
103
+ ## Document we need the DT_HASH dynamic tag to locate the hash table.
104
+
105
+ # RUN: yaml2obj --docnum=2 -DDYNTAG=DT_NULL %s -o %t.no.dyntag
106
+ # RUN: llvm-readobj --hash-table %t.no.dyntag 2>&1 | \
107
+ # RUN: FileCheck %s -DFILE=%t.no.dyntag --check-prefix=NODYNTAG --implicit-check-not=warning:
108
+ # RUN: llvm-readelf --hash-table %t.no.dyntag 2>&1 | \
109
+ # RUN: FileCheck %s -DFILE=%t.no.dyntag --check-prefix=NODYNTAG --implicit-check-not=warning:
110
+
111
+ # NODYNTAG: warning: '[[FILE]]': string table was not found
112
+
113
+ # NODYNTAG: HashTable {
114
+ # NODYNTAG-NEXT: }
115
+
92
116
## Each SHT_HASH section starts with two 32-bit fields: nbucket and nchain.
93
117
## Check we report an error when a DT_HASH value points to data that has size less than 8 bytes.
94
118
0 commit comments