[ELF] Improve parseSymbolVersion tests in for compileBitcodeFiles

Otherwise, the tests won't catch a mistake that removes
`parseSymbolVersion`.
This commit is contained in:
Fangrui Song 2025-01-26 20:20:51 -08:00
parent 7107f55d82
commit 0e6b58202c
2 changed files with 8 additions and 34 deletions

View File

@ -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{{$}}

View File

@ -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@VER1
; CHECK-NEXT: {{[1-9]}} foo@@VER1
; CHECK: UND bar@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@VER1
; RELOCATABLE: {{[1-9]}} foo@@VER1{{$}}
; RELOCATABLE-NEXT: UND bar@VER1{{$}}
;--- ver
VER1 {};