17ab1f692STeresa Johnson; RUN: opt -module-summary %s -o %t.o
27ab1f692STeresa Johnson; RUN: opt -module-summary %p/Inputs/thinlto_alias.ll -o %t2.o
37ab1f692STeresa Johnson
47ab1f692STeresa Johnson; Ensure that a preempted weak symbol that is linked in as a local
57ab1f692STeresa Johnson; copy is handled properly. Specifically, the local copy will be promoted,
67ab1f692STeresa Johnson; and internalization should be able to use the original non-promoted
77ab1f692STeresa Johnson; name to locate the summary (otherwise internalization will abort because
87ab1f692STeresa Johnson; it expects to locate summaries for all definitions).
97ab1f692STeresa Johnson; Note that gold picks the first copy of weakfunc() as the prevailing one,
107ab1f692STeresa Johnson; so listing %t2.o first is sufficient to ensure that this copy is
117ab1f692STeresa Johnson; preempted.
127ab1f692STeresa Johnson; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold.so \
137ab1f692STeresa Johnson; RUN:     --plugin-opt=thinlto \
147ab1f692STeresa Johnson; RUN:     --plugin-opt=save-temps \
157ab1f692STeresa Johnson; RUN:     -o %t3.o %t2.o %t.o
167ab1f692STeresa Johnson; RUN: llvm-nm %t3.o | FileCheck %s
179ba95f99STeresa Johnson; RUN: llvm-dis %t.o.4.opt.bc -o - | FileCheck --check-prefix=OPT %s
189ba95f99STeresa Johnson; RUN: llvm-dis %t2.o.4.opt.bc -o - | FileCheck --check-prefix=OPT2 %s
199ba95f99STeresa Johnson
209ba95f99STeresa Johnson; This does not currently pass because the gold plugin now uses the
219ba95f99STeresa Johnson; combined summary rather than the IRMover to change the module's linkage
229ba95f99STeresa Johnson; during the ThinLTO backend. The internalization step implemented by IRMover
239ba95f99STeresa Johnson; for preempted symbols has not yet been implemented for the combined summary.
249ba95f99STeresa Johnson; XFAIL: *
257ab1f692STeresa Johnson
267ab1f692STeresa Johnson; CHECK-NOT: U f
277ab1f692STeresa Johnson; OPT: define hidden void @weakfunc.llvm.0()
287ab1f692STeresa Johnson; OPT2: define weak void @weakfunc()
297ab1f692STeresa Johnson
30*2ceb628fSDavide Italianotarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
317ab1f692STeresa Johnsontarget triple = "x86_64-unknown-linux-gnu"
327ab1f692STeresa Johnson
337ab1f692STeresa Johnson@weakfuncAlias = alias void (...), bitcast (void ()* @weakfunc to void (...)*)
347ab1f692STeresa Johnsondefine weak void @weakfunc() {
357ab1f692STeresa Johnsonentry:
367ab1f692STeresa Johnson  ret void
377ab1f692STeresa Johnson}
38