brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.6 KiB · cab79b1 Raw
106 lines · plain
1; RUN: opt -module-summary %s -o %t.o2; RUN: opt -module-summary %p/Inputs/thinlto_weak_resolution.ll -o %t2.o3 4; Verify that prevailing weak for linker symbol is kept.5; Note that gold picks the first copy of a function as the prevailing one,6; so listing %t.o first is sufficient to ensure that its copies are prevailing.7; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \8; RUN:     --plugin-opt=thinlto \9; RUN:     --plugin-opt=save-temps \10; RUN:     -shared \11; RUN:     -o %t3.o %t.o %t2.o12 13; RUN: llvm-nm %t3.o | FileCheck %s14; CHECK: weakfunc15 16; The preempted functions should have been eliminated (the plugin will17; set linkage of odr functions to available_externally, and convert18; linkonce and weak to declarations).19; RUN: llvm-dis %t2.o.4.opt.bc -o - | FileCheck --check-prefix=OPT2 %s20; OPT2: target triple =21; OPT2-NOT: @22 23; RUN: llvm-dis %t.o.3.import.bc -o - | FileCheck --check-prefix=IMPORT %s24; RUN: llvm-dis %t2.o.3.import.bc -o - | FileCheck --check-prefix=IMPORT2 %s25 26target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"27target triple = "x86_64-unknown-linux-gnu"28 29 30define i32 @main() #0 {31entry:32  call void @linkonceodralias()33  call void @linkoncealias()34  call void @linkonceodrfuncwithalias()35  call void @linkoncefuncwithalias()36  call void @linkonceodrfunc()37  call void @linkoncefunc()38  call void @weakodrfunc()39  call void @weakfunc()40  call void @linkonceodrfuncInSingleModule()41  ret i32 042}43 44; Alias are resolved to weak_odr in prevailing module, but left as linkonce_odr45; in non-prevailing module (illegal to have an available_externally alias).46; IMPORT: @linkonceodralias = weak_odr alias void (), ptr @linkonceodrfuncwithalias47; IMPORT2: @linkonceodralias = linkonce_odr alias void (), ptr @linkonceodrfuncwithalias48@linkonceodralias = linkonce_odr alias void (), ptr @linkonceodrfuncwithalias49 50; Alias are resolved in prevailing module, but not optimized in51; non-prevailing module (illegal to have an available_externally alias).52; IMPORT: @linkoncealias = weak alias void (), ptr @linkoncefuncwithalias53; IMPORT2: @linkoncealias = linkonce alias void (), ptr @linkoncefuncwithalias54@linkoncealias = linkonce alias void (), ptr @linkoncefuncwithalias55 56; Function with an alias are resolved in prevailing module, but57; not optimized in non-prevailing module (illegal to have an58; available_externally aliasee).59; IMPORT: define weak_odr void @linkonceodrfuncwithalias()60; IMPORT2: define linkonce_odr void @linkonceodrfuncwithalias()61define linkonce_odr void @linkonceodrfuncwithalias() #0 {62entry:63  ret void64}65 66; Function with an alias are resolved to weak in prevailing module, but67; not optimized in non-prevailing module (illegal to have an68; available_externally aliasee).69; IMPORT: define weak void @linkoncefuncwithalias()70; IMPORT2: define linkonce void @linkoncefuncwithalias()71define linkonce void @linkoncefuncwithalias() #0 {72entry:73  ret void74}75 76; IMPORT: define weak_odr void @linkonceodrfunc()77; IMPORT2: define available_externally void @linkonceodrfunc()78define linkonce_odr void @linkonceodrfunc() #0 {79entry:80  ret void81}82; IMPORT: define weak void @linkoncefunc()83; IMPORT2: declare void @linkoncefunc()84define linkonce void @linkoncefunc() #0 {85entry:86  ret void87}88; IMPORT: define weak_odr void @weakodrfunc()89; IMPORT2: define available_externally void @weakodrfunc()90define weak_odr void @weakodrfunc() #0 {91entry:92  ret void93}94; IMPORT: define weak void @weakfunc()95; IMPORT2: declare void @weakfunc()96define weak void @weakfunc() #0 {97entry:98  ret void99}100 101; IMPORT: weak_odr void @linkonceodrfuncInSingleModule()102define linkonce_odr void @linkonceodrfuncInSingleModule() #0 {103entry:104  ret void105}106