[PATCH] D88812: [llvm-readobj][test] - Improve testing in hash-table.test

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 8 02:38:35 PDT 2020


This revision was automatically updated to reflect the committed changes.
grimar marked an inline comment as done.
Closed by commit rG3578945004e3: [llvm-readobj][test] - Improve testing in hash-table.test (authored by grimar).

Changed prior to commit:
  https://reviews.llvm.org/D88812?vs=296125&id=296902#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88812/new/

https://reviews.llvm.org/D88812

Files:
  llvm/test/tools/llvm-readobj/ELF/hash-table.test


Index: llvm/test/tools/llvm-readobj/ELF/hash-table.test
===================================================================
--- llvm/test/tools/llvm-readobj/ELF/hash-table.test
+++ llvm/test/tools/llvm-readobj/ELF/hash-table.test
@@ -45,9 +45,13 @@
 ## Check we can dump the SHT_HASH section even when an object
 ## does not have the section header table.
 
-# RUN: yaml2obj --docnum=2 %s -o %t.noshdr
-# RUN: llvm-readobj --hash-table %t.noshdr | FileCheck %s --check-prefix=NOSHDR
-# RUN: llvm-readelf --hash-table %t.noshdr | FileCheck %s --check-prefix=NOSHDR
+# RUN: yaml2obj --docnum=2 -DNOHEADERS=true %s -o %t.noshdr
+# RUN: llvm-readobj --hash-table %t.noshdr 2>&1 | \
+# RUN:   FileCheck %s -DFILE=%t.noshdr --check-prefix=NOSHDR --implicit-check-not=warning:
+# RUN: llvm-readelf --hash-table %t.noshdr 2>&1 | \
+# RUN:   FileCheck %s -DFILE=%t.noshdr --check-prefix=NOSHDR --implicit-check-not=warning:
+
+# NOSHDR: warning: '[[FILE]]': string table was not found
 
 # NOSHDR:      HashTable {
 # NOSHDR-NEXT:   Num Buckets: 1
@@ -58,37 +62,57 @@
 
 --- !ELF
 FileHeader:
-  Class:  ELFCLASS64
-  Data:   ELFDATA2LSB
-  Type:   ET_DYN
-## We simulate no section header table by
-## overriding the ELF header properties.
-  EShOff: 0x0
-  EShNum: 0x0
+  Class: ELFCLASS64
+  Data:  ELFDATA2LSB
+  Type:  ET_DYN
 Sections:
   - Name:   .hash
     Type:   SHT_HASH
     Flags:  [ SHF_ALLOC ]
     Bucket: [ 0 ]
     Chain:  [ 1 ]
+    EntSize: [[ENTSIZE=4]]
   - Name:  .dynamic
     Type:  SHT_DYNAMIC
     Flags: [ SHF_ALLOC ]
     Entries:
-      - Tag:   DT_HASH
+      - Tag:   [[DYNTAG=DT_HASH]]
         Value: 0x0
       - Tag:   DT_NULL
         Value: 0x0
+SectionHeaderTable:
+  NoHeaders: [[NOHEADERS=false]]
 ProgramHeaders:
   - Type: PT_LOAD
     Sections:
       - Section: .hash
       - Section: .dynamic
   - Type: PT_DYNAMIC
-    VAddr: 0x1010
+    VAddr: 0x10
     Sections:
       - Section: .dynamic
 
+## Document we don't report a warning when the value of the sh_entsize field of the SHT_HASH section is not 4.
+
+# RUN: yaml2obj --docnum=2 -DENTSIZE=0xff %s -o %t.ent.size
+# RUN: llvm-readobj --hash-table %t.ent.size 2>&1 | \
+# RUN:   FileCheck %s -DFILE=%t.ent.size --check-prefix=NOSHDR --implicit-check-not=warning:
+# RUN: llvm-readelf --hash-table %t.ent.size 2>&1 | \
+# RUN:   FileCheck %s -DFILE=%t.ent.size --check-prefix=NOSHDR --implicit-check-not=warning:
+
+## Document we need the DT_HASH dynamic tag to locate the hash table.
+
+# RUN: yaml2obj --docnum=2 -DDYNTAG=DT_NULL %s -o %t.no.dyntag
+# RUN: llvm-readobj --hash-table %t.no.dyntag 2>&1 | \
+# RUN:   FileCheck %s -DFILE=%t.no.dyntag --check-prefix=NODYNTAG --implicit-check-not=warning:
+# RUN: llvm-readelf --hash-table %t.no.dyntag 2>&1 | \
+# RUN:   FileCheck %s -DFILE=%t.no.dyntag --check-prefix=NODYNTAG --implicit-check-not=warning:
+
+# NODYNTAG: warning: '[[FILE]]': string table was not found
+
+# NODYNTAG:      HashTable {
+# NODYNTAG-NEXT: }
+
 ## Each SHT_HASH section starts with two 32-bit fields: nbucket and nchain.
 ## Check we report an error when a DT_HASH value points to data that has size less than 8 bytes.
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88812.296902.patch
Type: text/x-patch
Size: 3146 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201008/622d638f/attachment.bin>


More information about the llvm-commits mailing list