[llvm] 95a695b - [gold] Add case being tested by equivalent lld test

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 13 17:11:54 PST 2021


Author: Teresa Johnson
Date: 2021-02-13T17:09:56-08:00
New Revision: 95a695bea4a0aa8d5d1d0e7c29e8a5b4f6457480

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

LOG: [gold] Add case being tested by equivalent lld test

The new tests added by 1487747e990ce9f8851f3d92c3006a74134d7518 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.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/gold/X86/devirt_vcall_vis_export_dynamic.ll b/llvm/test/tools/gold/X86/devirt_vcall_vis_export_dynamic.ll
index 2785b933624c..0a374a6daf77 100644
--- a/llvm/test/tools/gold/X86/devirt_vcall_vis_export_dynamic.ll
+++ b/llvm/test/tools/gold/X86/devirt_vcall_vis_export_dynamic.ll
@@ -1,4 +1,4 @@
-;; Test that --export-dynamic prevents devirtualization.
+;; Test that dynamically exported symbols prevent devirtualization.
 ;; Note that --export-dynamic-symbol and --dynamic-list are tested similarly
 ;; in the v1.16 directory, because those were not properly passed down to the
 ;; plugin until then.
@@ -66,6 +66,41 @@
 ; RUN:   --export-dynamic 2>&1 | FileCheck /dev/null --implicit-check-not single-impl --allow-empty
 ; RUN: llvm-dis %t3.0.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-NODEVIRT-IR
 
+;; Check that all WPD fails with when linking against a shared library containing
+;; preemptible versions of the vtables. In this case the symbols in the object being
+;; linked against the shared library must be exported to .dynsym to allow the runtime
+;; preemption, even without any options.
+
+;; Index based WPD
+; RUN: opt -relocation-model=pic --thinlto-bc -o %t5.o %s
+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
+; RUN: 	 %t5.o -o %t5.so -shared
+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
+; RUN:   --plugin-opt=whole-program-visibility \
+; RUN:   --plugin-opt=-pass-remarks=. \
+; RUN:   %t5.o %t5.so -o %t5 \
+; RUN:   --export-dynamic 2>&1 | FileCheck /dev/null --implicit-check-not single-impl --allow-empty
+
+;; Hybrid WPD
+; RUN: opt -relocation-model=pic --thinlto-bc --thinlto-split-lto-unit -o %t5.o %s
+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
+; RUN: 	 %t5.o -o %t5.so -shared
+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
+; RUN:   --plugin-opt=whole-program-visibility \
+; RUN:   --plugin-opt=-pass-remarks=. \
+; RUN:   %t5.o %t5.so -o %t5 \
+; RUN:   --export-dynamic 2>&1 | FileCheck /dev/null --implicit-check-not single-impl --allow-empty
+
+;; Regular LTO WPD
+; RUN: opt -relocation-model=pic -o %t5.o %s
+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
+; RUN: 	 %t5.o -o %t5.so -shared
+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
+; RUN:   --plugin-opt=whole-program-visibility \
+; RUN:   --plugin-opt=-pass-remarks=. \
+; RUN:   %t5.o %t5.so -o %t5 \
+; RUN:   --export-dynamic 2>&1 | FileCheck /dev/null --implicit-check-not single-impl --allow-empty
+
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-grtev4-linux-gnu"
 


        


More information about the llvm-commits mailing list