Index: llvm/test/tools/llvm-readobj/ELF/gnuhash.test =================================================================== --- llvm/test/tools/llvm-readobj/ELF/gnuhash.test +++ llvm/test/tools/llvm-readobj/ELF/gnuhash.test @@ -1,7 +1,7 @@ ## Check how the GNU Hash section is dumped with --gnu-hash-table. -# RUN: yaml2obj --docnum=1 -DBITS=64 -DMACHINE=EM_X86_64 -D MASKWORDS=2 -D NBUCKETS=3 %s -o %t.x64 -# RUN: yaml2obj --docnum=1 -DBITS=32 -DMACHINE=EM_386 %s -D MASKWORDS=2 -D NBUCKETS=3 -o %t.x32 +# RUN: yaml2obj --docnum=1 -DBITS=64 -DMACHINE=EM_X86_64 %s -o %t.x64 +# RUN: yaml2obj --docnum=1 -DBITS=32 -DMACHINE=EM_386 %s -o %t.x32 # RUN: llvm-readobj --gnu-hash-table %t.x64 | FileCheck %s # RUN: llvm-readelf --gnu-hash-table %t.x64 | FileCheck %s @@ -33,9 +33,9 @@ SymNdx: 0x1 Shift2: 0x2 ## The number of words in the Bloom filter. The value of 2 is no-op. - MaskWords: [[MASKWORDS]] + MaskWords: [[MASKWORDS=2]] ## The number of hash buckets. The value of 3 is no-op. - NBuckets: [[NBUCKETS]] + NBuckets: [[NBUCKETS=3]] BloomFilter: [0x3, 0x4] HashBuckets: [0x5, 0x6, 0x7] HashValues: [0x8, 0x9, 0xA, 0xB] @@ -290,15 +290,15 @@ ## Check we report a proper warning when a hash table goes past the end of the file. -## Case A: the 'nbuckets' field is set so that the table goes past the end of the file. -# RUN: yaml2obj --docnum=1 -DBITS=64 -DMACHINE=EM_X86_64 -D MASKWORDS=4294967295 -D NBUCKETS=3 %s -o %t.err.maskwords +## Case A: the 'maskwords' field is set so that the table goes past the end of the file. +# RUN: yaml2obj --docnum=1 -DBITS=64 -DMACHINE=EM_X86_64 -D MASKWORDS=4294967295 %s -o %t.err.maskwords # RUN: llvm-readobj --gnu-hash-table %t.err.maskwords 2>&1 | \ # RUN: FileCheck %s -DFILE=%t.err.maskwords -DMASKWORDS=4294967295 -DNBUCKETS=3 --check-prefix=ERR # RUN: llvm-readelf --gnu-hash-table %t.err.maskwords 2>&1 | \ # RUN: FileCheck %s -DFILE=%t.err.maskwords -DMASKWORDS=4294967295 -DNBUCKETS=3 --check-prefix=ERR -## Case B: the 'maskwords' field is set so that the table goes past the end of the file. -# RUN: yaml2obj --docnum=1 -DBITS=64 -DMACHINE=EM_X86_64 -D MASKWORDS=2 -D NBUCKETS=4294967295 %s -o %t.err.nbuckets +## Case B: the 'nbuckets' field is set so that the table goes past the end of the file. +# RUN: yaml2obj --docnum=1 -DBITS=64 -DMACHINE=EM_X86_64 -D NBUCKETS=4294967295 %s -o %t.err.nbuckets # RUN: llvm-readobj --gnu-hash-table %t.err.nbuckets 2>&1 | \ # RUN: FileCheck %s -DFILE=%t.err.nbuckets -DMASKWORDS=2 -DNBUCKETS=4294967295 --check-prefix=ERR # RUN: llvm-readelf --gnu-hash-table %t.err.nbuckets 2>&1 | \ 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 @@ -211,8 +211,7 @@ ## Check we dump a histogram for the .gnu.hash table even when the .hash table is skipped. ## Case A: the .hash table has no data to build histogram and it is skipped. -## (NBUCKET == 0x2 is a no-op: it does not change the number of buckets described by the "Bucket" key). -# RUN: yaml2obj --docnum=5 -DNBUCKET=0x2 %s -o %t5.o +# RUN: yaml2obj --docnum=5 %s -o %t5.o # RUN: llvm-readelf --elf-hash-histogram %t5.o 2>&1 | \ # RUN: FileCheck %s --check-prefix=GNU-HASH --implicit-check-not="Histogram" @@ -236,7 +235,8 @@ Type: SHT_HASH Flags: [ SHF_ALLOC ] Bucket: [ 0 ] - NBucket: [[NBUCKET]] +## 0x2 is a no-op: it does not change the number of buckets described by the "Bucket" key + NBucket: [[NBUCKET=0x2]] Chain: [ 0, 0 ] - Name: .gnu.hash Type: SHT_GNU_HASH @@ -269,17 +269,15 @@ ## Check we report a proper warning when the GNU hash table goes past the end of the file. -## Case A: the 'nbuckets' field is set so that the GNU hash table goes past the end of the file. -## The value of 1 for the NBUCKETS is no-op. -# RUN: yaml2obj --docnum=6 -D MASKWORDS=0x80000000 -D NBUCKETS=1 %s -o %t7 +## Case A: the 'maskwords' field is set so that the GNU hash table goes past the end of the file. +# RUN: yaml2obj --docnum=6 -D MASKWORDS=0x80000000 %s -o %t7 # RUN: llvm-readelf --elf-hash-histogram %t7 2>&1 | \ # RUN: FileCheck %s -DFILE=%t7 --check-prefix=ERR5 --implicit-check-not="Histogram" # ERR5: warning: '[[FILE]]': unable to dump the SHT_GNU_HASH section at 0x78: it goes past the end of the file -## Case B: the 'maskwords' field is set so that the GNU hash table goes past the end of the file. -## The value of 1 for the MASKWORDS is no-op. -# RUN: yaml2obj --docnum=6 -D MASKWORDS=1 -D NBUCKETS=0x80000000 %s -o %t8 +## Case B: the 'nbuckets' field is set so that the GNU hash table goes past the end of the file. +# RUN: yaml2obj --docnum=6 -D NBUCKETS=0x80000000 %s -o %t8 # RUN: llvm-readelf --elf-hash-histogram %t8 2>&1 | \ # RUN: FileCheck %s -DFILE=%t8 --check-prefix=ERR5 --implicit-check-not="Histogram" @@ -296,10 +294,10 @@ Header: SymNdx: 0x0 Shift2: 0x0 -## The number of words in the Bloom filter. - MaskWords: [[MASKWORDS]] -## The number of hash buckets. - NBuckets: [[NBUCKETS]] +## The number of words in the Bloom filter. The value of 1 is no-op. + MaskWords: [[MASKWORDS=1]] +## The number of hash buckets. The value of 1 is no-op. + NBuckets: [[NBUCKETS=1]] BloomFilter: [ 0x0 ] HashBuckets: [ 0x0 ] HashValues: [ 0x0 ] 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 @@ -388,7 +388,7 @@ ## Case A.1: the hash table ends right before the EOF. We have a broken nbucket ## field that has a value larger than the number of buckets. -# RUN: yaml2obj --docnum=7 %s -o %t7.1.o -DNBUCKET=0x5d -DNCHAIN=0x1 +# RUN: yaml2obj --docnum=7 %s -o %t7.1.o -DNBUCKET=0x5d # RUN: llvm-readelf --hash-symbols %t7.1.o 2>&1 | FileCheck %s --check-prefix=NOERR1 # NOERR1: Symbol table of .hash for image: # NOERR1-NEXT: Num Buc: Value Size Type Bind Vis Ndx Name @@ -396,7 +396,7 @@ ## Case A.2: the hash table ends 1 byte past the EOF. We have a broken nbucket ## field that has a value larger than the number of buckets. -# RUN: yaml2obj --docnum=7 %s -o %t7.2.o -DNBUCKET=0x5e -DNCHAIN=0x1 +# RUN: yaml2obj --docnum=7 %s -o %t7.2.o -DNBUCKET=0x5e # RUN: llvm-readelf --hash-symbols %t7.2.o 2>&1 | FileCheck %s --check-prefix=ERR2 -DFILE=%t7.2.o # ERR2: Symbol table of .hash for image: # ERR2-NEXT: warning: '[[FILE]]': the hash table at offset 0x54 goes past the end of the file (0x1d4), nbucket = 94, nchain = 1{{$}} @@ -404,7 +404,7 @@ ## Case B.1: the hash table ends right before the EOF. We have a broken nchain ## field that has a value larger than the number of chains. -# RUN: yaml2obj --docnum=7 %s -o %t7.3.o -DNBUCKET=0x1 -DNCHAIN=0x5d +# RUN: yaml2obj --docnum=7 %s -o %t7.3.o -DNCHAIN=0x5d # RUN: llvm-readelf --hash-symbols %t7.3.o 2>&1 | \ # RUN: FileCheck %s --implicit-check-not="warning:" --check-prefix=NOERR2 -DFILE=%t7.3.o # NOERR2: warning: '[[FILE]]': hash table nchain (93) differs from symbol count derived from SHT_DYNSYM section header (1) @@ -414,7 +414,7 @@ ## Case B.2: the hash table ends 1 byte past the EOF. We have a broken nchain ## field that has a value larger than the number of chains. -# RUN: yaml2obj --docnum=7 %s -o %t7.4.o -DNBUCKET=0x1 -DNCHAIN=0x5e +# RUN: yaml2obj --docnum=7 %s -o %t7.4.o -DNCHAIN=0x5e # RUN: llvm-readelf --hash-symbols %t7.4.o 2>&1 | FileCheck %s --check-prefix=ERR3 -DFILE=%t7.4.o # ERR3: Symbol table of .hash for image: # ERR3-NEXT: warning: '[[FILE]]': the hash table at offset 0x54 goes past the end of the file (0x1d4), nbucket = 1, nchain = 94{{$}} @@ -431,9 +431,9 @@ Type: SHT_HASH Flags: [ SHF_ALLOC ] Bucket: [ 0 ] - NBucket: [[NBUCKET]] + NBucket: [[NBUCKET=1]] Chain: [ 0 ] - NChain: [[NCHAIN]] + NChain: [[NCHAIN=1]] - Name: .dynamic Type: SHT_DYNAMIC Flags: [ SHF_WRITE, SHF_ALLOC ] @@ -451,19 +451,19 @@ ## Check we report a proper warning when a GNU hash table goes past the end of the file. -## Case A: the 'nbuckets' field is set so that the table goes past the end of the file. -# RUN: yaml2obj --docnum=8 -D MASKWORDS=4294967295 -D NBUCKETS=3 %s -o %t.err.maskwords +## Case A: the 'maskwords' field is set so that the table goes past the end of the file. +# RUN: yaml2obj --docnum=8 -D MASKWORDS=4294967295 %s -o %t.err.maskwords # RUN: llvm-readelf --hash-symbols %t.err.maskwords 2>&1 | \ -# RUN: FileCheck %s -DFILE=%t.err.maskwords -DMASKWORDS=4294967295 -DNBUCKETS=3 --check-prefix=ERR4 +# RUN: FileCheck %s -DFILE=%t.err.maskwords --check-prefix=ERR4 # ERR4: Symbol table of .gnu.hash for image: # ERR4-NEXT: Num Buc: Value Size Type Bind Vis Ndx Name # ERR4-NEXT: warning: '[[FILE]]': unable to dump the SHT_GNU_HASH section at 0x78: it goes past the end of the file -## Case B: the 'maskwords' field is set so that the table goes past the end of the file. -# RUN: yaml2obj --docnum=8 -D MASKWORDS=2 -D NBUCKETS=4294967295 %s -o %t.err.nbuckets +## Case B: the 'nbuckets' field is set so that the table goes past the end of the file. +# RUN: yaml2obj --docnum=8 -D NBUCKETS=4294967295 %s -o %t.err.nbuckets # RUN: llvm-readelf --hash-symbols %t.err.nbuckets 2>&1 | \ -# RUN: FileCheck %s -DFILE=%t.err.nbuckets -DMASKWORDS=2 -DNBUCKETS=4294967295 --check-prefix=ERR4 +# RUN: FileCheck %s -DFILE=%t.err.nbuckets --check-prefix=ERR4 --- !ELF FileHeader: @@ -479,9 +479,9 @@ SymNdx: 0x1 Shift2: 0x2 ## The number of words in the Bloom filter. The value of 2 is no-op. - MaskWords: [[MASKWORDS]] + MaskWords: [[MASKWORDS=2]] ## The number of hash buckets. The value of 3 is no-op. - NBuckets: [[NBUCKETS]] + NBuckets: [[NBUCKETS=3]] BloomFilter: [0x3, 0x4] HashBuckets: [0x5, 0x6, 0x7] HashValues: [0x8, 0x9, 0xA, 0xB]