mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[llvm-readelf] - Report unique warnings when dumping hash symbols/histogram.
This converts 2 more places to use `reportUniqueWarning` and adds tests. Differential revision: https://reviews.llvm.org/D92551
This commit is contained in:
parent
78b51b6b79
commit
924cd26a7e
@ -71,13 +71,14 @@ ProgramHeaders:
|
||||
## the bucket array pointing to a cycle.
|
||||
|
||||
# RUN: yaml2obj --docnum=2 %s -o %t2.o
|
||||
# RUN: llvm-readelf --elf-hash-histogram 2>&1 %t2.o | FileCheck -DFILE=%t2.o %s --check-prefix=BROKEN
|
||||
# RUN: llvm-readelf --elf-hash-histogram 2>&1 %t2.o | \
|
||||
# RUN: FileCheck -DFILE=%t2.o %s --check-prefix=BROKEN --implicit-check-not=warning:
|
||||
|
||||
# BROKEN: warning: '[[FILE]]': .hash section is invalid: bucket 1: a cycle was detected in the linked chain
|
||||
# BROKEN: Histogram for bucket list length (total of 1 buckets)
|
||||
# BROKEN: Histogram for bucket list length (total of 2 buckets)
|
||||
# BROKEN-NEXT: Length Number % of total Coverage
|
||||
# BROKEN-NEXT: 0 0 ( 0.0%) 0.0%
|
||||
# BROKEN-NEXT: 1 1 (100.0%) 100.0%
|
||||
# BROKEN-NEXT: 1 2 (100.0%) 100.0%
|
||||
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
@ -88,7 +89,7 @@ Sections:
|
||||
- Name: .hash
|
||||
Type: SHT_HASH
|
||||
Link: .dynsym
|
||||
Bucket: [ 1 ]
|
||||
Bucket: [ 1, 1 ]
|
||||
Chain: [ 0, 1 ]
|
||||
- Name: .dynamic
|
||||
Type: SHT_DYNAMIC
|
||||
|
@ -328,12 +328,15 @@ ProgramHeaders:
|
||||
## the bucket array pointing to a cycle.
|
||||
|
||||
# RUN: yaml2obj --docnum=5 %s -o %t5.so
|
||||
# RUN: llvm-readelf --hash-symbols %t5.so 2>&1 | FileCheck %s -DFILE=%t5.so --check-prefix=BROKEN
|
||||
# RUN: llvm-readelf --hash-symbols %t5.so 2>&1 | \
|
||||
# RUN: FileCheck %s -DFILE=%t5.so --check-prefix=BROKEN --implicit-check-not=warning:
|
||||
|
||||
# BROKEN: Symbol table of .hash for image:
|
||||
# BROKEN-NEXT: Num Buc: Value Size Type Bind Vis Ndx Name
|
||||
# BROKEN-NEXT: 1 0: 00000000 0 NOTYPE LOCAL DEFAULT UND aaa
|
||||
# BROKEN: warning: '[[FILE]]': .hash section is invalid: bucket 1: a cycle was detected in the linked chain
|
||||
# BROKEN-NEXT: 1 1: 00000000 0 NOTYPE LOCAL DEFAULT UND aaa
|
||||
# BROKEN-NOT: {{.}}
|
||||
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
@ -344,7 +347,7 @@ Sections:
|
||||
- Name: .hash
|
||||
Type: SHT_HASH
|
||||
Link: .dynsym
|
||||
Bucket: [ 1 ]
|
||||
Bucket: [ 1, 1 ]
|
||||
Chain: [ 1, 1 ]
|
||||
- Name: .dynamic
|
||||
Type: SHT_DYNAMIC
|
||||
@ -355,8 +358,7 @@ Sections:
|
||||
- Tag: DT_HASH
|
||||
Value: 0x0
|
||||
DynamicSymbols:
|
||||
- Name: aaa
|
||||
- Name: bbb
|
||||
- Name: aaa
|
||||
ProgramHeaders:
|
||||
- Type: PT_LOAD
|
||||
FirstSec: .hash
|
||||
|
@ -4124,10 +4124,9 @@ void GNUStyle<ELFT>::printHashTableSymbols(const Elf_Hash &SysVHash) {
|
||||
break;
|
||||
|
||||
if (Visited[Ch]) {
|
||||
reportWarning(createError(".hash section is invalid: bucket " +
|
||||
this->reportUniqueWarning(".hash section is invalid: bucket " +
|
||||
Twine(Ch) +
|
||||
": a cycle was detected in the linked chain"),
|
||||
this->FileName);
|
||||
": a cycle was detected in the linked chain");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -4868,10 +4867,9 @@ void GNUStyle<ELFT>::printHashHistogram(const Elf_Hash &HashTable) {
|
||||
if (C == ELF::STN_UNDEF)
|
||||
break;
|
||||
if (Visited[C]) {
|
||||
reportWarning(createError(".hash section is invalid: bucket " +
|
||||
this->reportUniqueWarning(".hash section is invalid: bucket " +
|
||||
Twine(C) +
|
||||
": a cycle was detected in the linked chain"),
|
||||
this->FileName);
|
||||
": a cycle was detected in the linked chain");
|
||||
break;
|
||||
}
|
||||
Visited[C] = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user