Skip to content

Commit 95a695b

Browse files
committed
[gold] Add case being tested by equivalent lld test
The new tests added by 1487747 for lld and gold plugin were largely equivalent, but the gold one was missing one of the cases added to lld. Add that test to the gold plugin version.
1 parent b3bafbc commit 95a695b

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

llvm/test/tools/gold/X86/devirt_vcall_vis_export_dynamic.ll

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
;; Test that --export-dynamic prevents devirtualization.
1+
;; Test that dynamically exported symbols prevent devirtualization.
22
;; Note that --export-dynamic-symbol and --dynamic-list are tested similarly
33
;; in the v1.16 directory, because those were not properly passed down to the
44
;; plugin until then.
@@ -66,6 +66,41 @@
6666
; RUN: --export-dynamic 2>&1 | FileCheck /dev/null --implicit-check-not single-impl --allow-empty
6767
; RUN: llvm-dis %t3.0.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-NODEVIRT-IR
6868

69+
;; Check that all WPD fails with when linking against a shared library containing
70+
;; preemptible versions of the vtables. In this case the symbols in the object being
71+
;; linked against the shared library must be exported to .dynsym to allow the runtime
72+
;; preemption, even without any options.
73+
74+
;; Index based WPD
75+
; RUN: opt -relocation-model=pic --thinlto-bc -o %t5.o %s
76+
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
77+
; RUN: %t5.o -o %t5.so -shared
78+
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
79+
; RUN: --plugin-opt=whole-program-visibility \
80+
; RUN: --plugin-opt=-pass-remarks=. \
81+
; RUN: %t5.o %t5.so -o %t5 \
82+
; RUN: --export-dynamic 2>&1 | FileCheck /dev/null --implicit-check-not single-impl --allow-empty
83+
84+
;; Hybrid WPD
85+
; RUN: opt -relocation-model=pic --thinlto-bc --thinlto-split-lto-unit -o %t5.o %s
86+
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
87+
; RUN: %t5.o -o %t5.so -shared
88+
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
89+
; RUN: --plugin-opt=whole-program-visibility \
90+
; RUN: --plugin-opt=-pass-remarks=. \
91+
; RUN: %t5.o %t5.so -o %t5 \
92+
; RUN: --export-dynamic 2>&1 | FileCheck /dev/null --implicit-check-not single-impl --allow-empty
93+
94+
;; Regular LTO WPD
95+
; RUN: opt -relocation-model=pic -o %t5.o %s
96+
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
97+
; RUN: %t5.o -o %t5.so -shared
98+
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
99+
; RUN: --plugin-opt=whole-program-visibility \
100+
; RUN: --plugin-opt=-pass-remarks=. \
101+
; RUN: %t5.o %t5.so -o %t5 \
102+
; RUN: --export-dynamic 2>&1 | FileCheck /dev/null --implicit-check-not single-impl --allow-empty
103+
69104
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
70105
target triple = "x86_64-grtev4-linux-gnu"
71106

0 commit comments

Comments
 (0)