Index: llvm/test/tools/llvm-readobj/ELF/hash-histogram.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/hash-histogram.test +++ llvm/test/tools/llvm-readobj/ELF/hash-histogram.test @@ -71,13 +71,14 @@ ## 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 @@ - Name: .hash Type: SHT_HASH Link: .dynsym - Bucket: [ 1 ] + Bucket: [ 1, 1 ] Chain: [ 0, 1 ] - Name: .dynamic Type: SHT_DYNAMIC Index: llvm/test/tools/llvm-readobj/ELF/hash-symbols.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/hash-symbols.test +++ llvm/test/tools/llvm-readobj/ELF/hash-symbols.test @@ -328,12 +328,15 @@ ## 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 @@ - Name: .hash Type: SHT_HASH Link: .dynsym - Bucket: [ 1 ] + Bucket: [ 1, 1 ] Chain: [ 1, 1 ] - Name: .dynamic Type: SHT_DYNAMIC @@ -355,8 +358,7 @@ - Tag: DT_HASH Value: 0x0 DynamicSymbols: - - Name: aaa - - Name: bbb + - Name: aaa ProgramHeaders: - Type: PT_LOAD FirstSec: .hash Index: llvm/tools/llvm-readobj/ELFDumper.cpp =================================================================== --- llvm/tools/llvm-readobj/ELFDumper.cpp +++ llvm/tools/llvm-readobj/ELFDumper.cpp @@ -4124,10 +4124,9 @@ 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 @@ 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;