[PATCH] D87824: [lld][ELF][test] Add additional LTO testing

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 18 02:49:44 PDT 2020


jhenderson added inline comments.


================
Comment at: lld/test/ELF/lto/internalize-basic.ll:14
+
+define hidden void @bar() {
   ret void
----------------
MaskRay wrote:
> You can enhance the test by deleting `hidden`. The important property is `isUsedInRegularObj`, not visibility.
Done, but I noticed that `foo` is also `hidden`. Any idea why?


================
Comment at: lld/test/ELF/lto/wrap-2.ll:2
 ; REQUIRES: x86
-; LTO
-; RUN: llvm-as %s -o %t.o
-; RUN: llvm-as %S/Inputs/wrap-bar.ll -o %t1.o
-; RUN: ld.lld %t.o %t1.o -shared -o %t.so -wrap=bar
-; RUN: llvm-objdump -d %t.so | FileCheck %s
-; RUN: llvm-readobj --symbols %t.so | FileCheck -check-prefix=BIND %s
-
-; ThinLTO
-; RUN: opt -module-summary %s -o %t.o
-; RUN: opt -module-summary %S/Inputs/wrap-bar.ll -o %t1.o
-; RUN: ld.lld %t.o %t1.o -shared -o %t.so -wrap=bar
-; RUN: llvm-objdump -d %t.so | FileCheck %s
-; RUN: llvm-readobj --symbols %t.so | FileCheck -check-prefix=BIND %s
-
-; Make sure that calls in foo() are not eliminated and that bar is
-; routed to __wrap_bar and __real_bar is routed to bar.
+;; This test verifies that --wrap works correctly for inter-module references to
+;; the wrapped symbol, when LTO or ThinLTO is involved. It checks for various
----------------
MaskRay wrote:
> Is it related to D85782? My feeling is https://reviews.llvm.org/D85782#2211636 
> 
> I think we need to be careful making this promise. This is not intentionally guaranteed.
No, I don't think so, unless I misunderstood something. D85782 is for intra-module references, i.e. where the reference and definition are within the same input file. This test is about inter-module references, i.e. references between different modules.

The cases I've actually added are [Thin]LTO + native object, where one or other defines the symbol to be wrapped (as well as the wrapped version), and the other references that symbol. My understanding is that this behaviour should be stable.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87824/new/

https://reviews.llvm.org/D87824



More information about the llvm-commits mailing list