[lld] 5548bcd - [ELF] Refactor --version-script tests
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 3 20:40:51 PDT 2023
Author: Fangrui Song
Date: 2023-11-03T20:40:46-07:00
New Revision: 5548bcdacee218161fdb7e9347e4bd885948f72d
URL: https://github.com/llvm/llvm-project/commit/5548bcdacee218161fdb7e9347e4bd885948f72d
DIFF: https://github.com/llvm/llvm-project/commit/5548bcdacee218161fdb7e9347e4bd885948f72d.diff
LOG: [ELF] Refactor --version-script tests
Added:
Modified:
lld/test/ELF/version-script-symver.s
Removed:
lld/test/ELF/verdef.s
################################################################################
diff --git a/lld/test/ELF/verdef.s b/lld/test/ELF/verdef.s
deleted file mode 100644
index dd1f1d41f01481a..000000000000000
--- a/lld/test/ELF/verdef.s
+++ /dev/null
@@ -1,116 +0,0 @@
-# REQUIRES: x86
-# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
-# RUN: echo "LIBSAMPLE_1.0 { global: a; local: *; };" > %t.script
-# RUN: echo "LIBSAMPLE_2.0 { global: b; local: *; };" >> %t.script
-# RUN: echo "LIBSAMPLE_3.0 { global: c; local: *; };" >> %t.script
-# RUN: ld.lld --hash-style=sysv --version-script %t.script -shared -soname shared %t.o -o %t.so
-# RUN: llvm-readobj -V --dyn-syms %t.so | FileCheck --check-prefix=DSO %s
-
-# DSO: VersionSymbols [
-# DSO-NEXT: Symbol {
-# DSO-NEXT: Version: 0
-# DSO-NEXT: Name:
-# DSO-NEXT: }
-# DSO-NEXT: Symbol {
-# DSO-NEXT: Version: 2
-# DSO-NEXT: Name: a@@LIBSAMPLE_1.0
-# DSO-NEXT: }
-# DSO-NEXT: Symbol {
-# DSO-NEXT: Version: 3
-# DSO-NEXT: Name: b@@LIBSAMPLE_2.0
-# DSO-NEXT: }
-# DSO-NEXT: Symbol {
-# DSO-NEXT: Version: 4
-# DSO-NEXT: Name: c@@LIBSAMPLE_3.0
-# DSO-NEXT: }
-# DSO-NEXT: ]
-# DSO-NEXT: VersionDefinitions [
-# DSO-NEXT: Definition {
-# DSO-NEXT: Version: 1
-# DSO-NEXT: Flags [ (0x1)
-# DSO-NEXT: Base (0x1)
-# DSO-NEXT: ]
-# DSO-NEXT: Index: 1
-# DSO-NEXT: Hash: 127830196
-# DSO-NEXT: Name: shared
-# DSO-NEXT: Predecessors: []
-# DSO-NEXT: }
-# DSO-NEXT: Definition {
-# DSO-NEXT: Version: 1
-# DSO-NEXT: Flags [ (0x0)
-# DSO-NEXT: ]
-# DSO-NEXT: Index: 2
-# DSO-NEXT: Hash: 98457184
-# DSO-NEXT: Name: LIBSAMPLE_1.0
-# DSO-NEXT: Predecessors: []
-# DSO-NEXT: }
-# DSO-NEXT: Definition {
-# DSO-NEXT: Version: 1
-# DSO-NEXT: Flags [ (0x0)
-# DSO-NEXT: ]
-# DSO-NEXT: Index: 3
-# DSO-NEXT: Hash: 98456416
-# DSO-NEXT: Name: LIBSAMPLE_2.0
-# DSO-NEXT: Predecessors: []
-# DSO-NEXT: }
-# DSO-NEXT: Definition {
-# DSO-NEXT: Version: 1
-# DSO-NEXT: Flags [ (0x0)
-# DSO-NEXT: ]
-# DSO-NEXT: Index: 4
-# DSO-NEXT: Hash: 98456672
-# DSO-NEXT: Name: LIBSAMPLE_3.0
-# DSO-NEXT: Predecessors: []
-# DSO-NEXT: }
-# DSO-NEXT: ]
-# DSO-NEXT: VersionRequirements [
-# DSO-NEXT: ]
-
-## Check that we can link agains DSO we produced.
-# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/verdef.s -o %tmain.o
-# RUN: ld.lld --hash-style=sysv %tmain.o %t.so -o %tout
-# RUN: llvm-readobj -V %tout | FileCheck --check-prefix=MAIN %s
-
-# MAIN: VersionSymbols [
-# MAIN-NEXT: Symbol {
-# MAIN-NEXT: Version: 0
-# MAIN-NEXT: Name:
-# MAIN-NEXT: }
-# MAIN-NEXT: Symbol {
-# MAIN-NEXT: Version: 2
-# MAIN-NEXT: Name: a at LIBSAMPLE_1.0
-# MAIN-NEXT: }
-# MAIN-NEXT: Symbol {
-# MAIN-NEXT: Version: 3
-# MAIN-NEXT: Name: b at LIBSAMPLE_2.0
-# MAIN-NEXT: }
-# MAIN-NEXT: Symbol {
-# MAIN-NEXT: Version: 4
-# MAIN-NEXT: Name: c at LIBSAMPLE_3.0
-# MAIN-NEXT: }
-# MAIN-NEXT: ]
-# MAIN-NEXT: VersionDefinitions [
-# MAIN-NEXT: ]
-
-# RUN: echo "VERSION {" > %t.script
-# RUN: echo "LIBSAMPLE_1.0 { global: a; local: *; };" >> %t.script
-# RUN: echo "LIBSAMPLE_2.0 { global: b; local: *; };" >> %t.script
-# RUN: echo "LIBSAMPLE_3.0 { global: c; local: *; };" >> %t.script
-# RUN: echo "}" >> %t.script
-# RUN: ld.lld --hash-style=sysv --script %t.script -shared -soname shared %t.o -o %t2.so
-# RUN: llvm-readobj -V --dyn-syms %t2.so | FileCheck --check-prefix=DSO %s
-
-.globl a
-.type a, at function
-a:
-retq
-
-.globl b
-.type b, at function
-b:
-retq
-
-.globl c
-.type c, at function
-c:
-retq
diff --git a/lld/test/ELF/version-script-symver.s b/lld/test/ELF/version-script-symver.s
index ee87c3405ab63ef..db7c6f434ff4e57 100644
--- a/lld/test/ELF/version-script-symver.s
+++ b/lld/test/ELF/version-script-symver.s
@@ -39,6 +39,13 @@
# MIX2-NEXT: [[#]] foo3 at v1
# MIX2-NOT: {{.}}
+# RUN: ld.lld --version-script %t4.script -pie --export-dynamic %t.o -o %t4
+# RUN: llvm-readelf --dyn-syms %t4 | FileCheck --check-prefix=MIX2 %s
+# RUN: ld.lld --version-script %t4.script -pie %t.o -o %t4
+# RUN: llvm-readelf --dyn-syms %t4 | FileCheck --check-prefix=EXE %s
+
+# EXE: Symbol table '.dynsym' contains 1 entries:
+
# RUN: ld.lld --version-script %t4.script -shared %t.o %tref.o -o %t5.so
# RUN: llvm-readelf -r %t5.so | FileCheck --check-prefix=RELOC %s
More information about the llvm-commits
mailing list