[lld] b592cbf - [ELF][test] Improve discard-gnu-hash.s to check DT_HASH and DT_GNU_HASH

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 12 12:43:54 PST 2022


Author: Fangrui Song
Date: 2022-01-12T12:43:49-08:00
New Revision: b592cbf329eafcb1402df8bd1840694a1955683a

URL: https://github.com/llvm/llvm-project/commit/b592cbf329eafcb1402df8bd1840694a1955683a
DIFF: https://github.com/llvm/llvm-project/commit/b592cbf329eafcb1402df8bd1840694a1955683a.diff

LOG: [ELF][test] Improve discard-gnu-hash.s to check DT_HASH and DT_GNU_HASH

Added: 
    

Modified: 
    lld/test/ELF/linkerscript/discard-gnu-hash.s

Removed: 
    


################################################################################
diff  --git a/lld/test/ELF/linkerscript/discard-gnu-hash.s b/lld/test/ELF/linkerscript/discard-gnu-hash.s
index 5ebad7e26244..9ef2d190a876 100644
--- a/lld/test/ELF/linkerscript/discard-gnu-hash.s
+++ b/lld/test/ELF/linkerscript/discard-gnu-hash.s
@@ -1,23 +1,32 @@
 # REQUIRES: x86
-# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
 
-# RUN: ld.lld --hash-style both -shared -o %t1 %t
-# RUN: llvm-objdump --section-headers %t1 | FileCheck %s
+# RUN: ld.lld --hash-style both -shared -o %t %t.o
+# RUN: llvm-readelf -S -d %t | FileCheck %s
 # CHECK: .gnu.hash
 # CHECK: .hash
 
+# CHECK: (GNU_HASH)
+# CHECK: (HASH)
+
 # RUN: echo "SECTIONS { /DISCARD/ : { *(.hash) } }" > %t.script
-# RUN: ld.lld --hash-style both -shared -o %t1 --script %t.script %t
-# RUN: llvm-objdump --section-headers %t1 \
-# RUN:   | FileCheck %s --check-prefix=HASH
+# RUN: ld.lld --hash-style both -shared -o %t -T %t.script %t.o
+# RUN: llvm-readelf -S -d %t | FileCheck %s --check-prefix=HASH
 # HASH-NOT: .hash
 # HASH:     .gnu.hash
 # HASH-NOT: .hash
 
+# HASH-NOT: (HASH)
+# HASH:     (GNU_HASH)
+# HASH-NOT: (HASH)
+
 # RUN: echo "SECTIONS { /DISCARD/ : { *(.gnu.hash) } }" > %t.script
-# RUN: ld.lld --hash-style both -shared -o %t1 --script %t.script %t
-# RUN: llvm-objdump --section-headers %t1 \
-# RUN:   | FileCheck %s --check-prefix=GNUHASH
+# RUN: ld.lld --hash-style both -shared -o %t -T %t.script %t.o
+# RUN: llvm-readelf -S -d %t | FileCheck %s --check-prefix=GNUHASH
 # GNUHASH-NOT: .gnu.hash
 # GNUHASH:     .hash
 # GNUHASH-NOT: .gnu.hash
+
+# GNUHASH-NOT: (GNU_HASH)
+# GNUHASH:     (HASH)
+# GNUHASH-NOT: (GNU_HASH)


        


More information about the llvm-commits mailing list