[lld] 0e6b582 - [ELF] Improve parseSymbolVersion tests in for compileBitcodeFiles

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 26 20:20:57 PST 2025


Author: Fangrui Song
Date: 2025-01-26T20:20:51-08:00
New Revision: 0e6b58202ca9c4d1ca814e4bea5bd3f0bac7f329

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

LOG: [ELF] Improve parseSymbolVersion tests in for compileBitcodeFiles

Otherwise, the tests won't catch a mistake that removes
`parseSymbolVersion`.

Added: 
    

Modified: 
    lld/test/ELF/lto/version-script.ll
    lld/test/ELF/lto/version-script2.ll

Removed: 
    


################################################################################
diff  --git a/lld/test/ELF/lto/version-script.ll b/lld/test/ELF/lto/version-script.ll
index 52b9afc38eeed7..54a5e01f2dee57 100644
--- a/lld/test/ELF/lto/version-script.ll
+++ b/lld/test/ELF/lto/version-script.ll
@@ -3,7 +3,7 @@
 ; RUN: echo "VERSION_1.0{ global: foo; local: *; }; VERSION_2.0{ global: bar; local: *; };" > %t.script
 ; RUN: ld.lld %t.o -o %t2 -shared --version-script %t.script -save-temps
 ; RUN: llvm-dis < %t2.0.0.preopt.bc | FileCheck %s
-; RUN: llvm-readobj --dyn-syms %t2 | FileCheck --check-prefix=DSO %s
+; RUN: llvm-readelf --dyn-syms %t2 | FileCheck --check-prefix=DSO %s
 
 target triple = "x86_64-unknown-linux-gnu"
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
@@ -19,32 +19,6 @@ define void @bar() {
 ; CHECK: define void @foo()
 ; CHECK: define void @bar()
 
-; DSO: DynamicSymbols [
-; DSO:   Symbol {
-; DSO:     Name:
-; DSO:     Value: 0x0
-; DSO:     Size: 0
-; DSO:     Binding: Local
-; DSO:     Type: None
-; DSO:     Other: 0
-; DSO:     Section: Undefined
-; DSO:   }
-; DSO:   Symbol {
-; DSO:     Name: foo@@VERSION_1.0
-; DSO:     Value:
-; DSO:     Size: 1
-; DSO:     Binding: Global
-; DSO:     Type: Function
-; DSO:     Other: 0
-; DSO:     Section: .text
-; DSO:   }
-; DSO:   Symbol {
-; DSO:     Name: bar@@VERSION_2.0
-; DSO:     Value:
-; DSO:     Size: 1
-; DSO:     Binding: Global
-; DSO:     Type: Function
-; DSO:     Other: 0
-; DSO:     Section: .text
-; DSO:   }
-; DSO: ]
+; DSO: Symbol table '.dynsym' contains 3 entries:
+; DSO:      1: {{.*}}               1 FUNC    GLOBAL DEFAULT [[#]] foo@@VERSION_1.0{{$}}
+; DSO:      2: {{.*}}               1 FUNC    GLOBAL DEFAULT [[#]] bar@@VERSION_2.0{{$}}

diff  --git a/lld/test/ELF/lto/version-script2.ll b/lld/test/ELF/lto/version-script2.ll
index dab22750f77b8f..5635731518fdb9 100644
--- a/lld/test/ELF/lto/version-script2.ll
+++ b/lld/test/ELF/lto/version-script2.ll
@@ -17,16 +17,16 @@
 ; RUN: ld.lld %t.o %tbar.so -o %t.so -shared --version-script %t/ver
 ; RUN: llvm-readelf --dyn-syms %t.so | FileCheck %s
 
-; CHECK:      UND       bar at VER1
-; CHECK-NEXT: {{[1-9]}} foo@@VER1
+; CHECK:      UND       bar at VER1{{$}}
+; CHECK-NEXT: {{[1-9]}} foo@@VER1{{$}}
 
 ;; For relocatable output, @ should be retained in the symbol name.
 ;; Don't parse and drop `@VER1`. Also check that --version-script is ignored.
 ; RUN: ld.lld %t.o -o %t.ro -r --version-script %t/ver
 ; RUN: llvm-readelf -s %t.ro | FileCheck %s --check-prefix=RELOCATABLE
 
-; RELOCATABLE:      {{[1-9]}} foo@@VER1
-; RELOCATABLE-NEXT: UND       bar at VER1
+; RELOCATABLE:      {{[1-9]}} foo@@VER1{{$}}
+; RELOCATABLE-NEXT: UND       bar at VER1{{$}}
 
 ;--- ver
 VER1 {};


        


More information about the llvm-commits mailing list