1; RUN: split-file %s %t 2 3; RUN: opt -module-summary %t/av_ext_def.ll -o %t/av_ext_def.bc 4; RUN: opt -module-summary %t/weak_def.ll -o %t/weak_def.bc 5; RUN: llvm-lto2 run -o %t/prevailing_import -save-temps %t/av_ext_def.bc %t/weak_def.bc \ 6; RUN: -r=%t/av_ext_def.bc,ret_av_ext_def,px -r=%t/av_ext_def.bc,def,x \ 7; RUN: -r=%t/weak_def.bc,ret_weak_def,px -r=%t/weak_def.bc,def,px 8; RUN: llvm-dis %t/prevailing_import.2.3.import.bc -o - | FileCheck --match-full-lines --check-prefix=WEAK_DEF %s 9; RUN: llvm-nm -jU %t/prevailing_import.2 | FileCheck --match-full-lines --check-prefix=NM %s 10 11;; def should remain weak after function importing in the weak_def module 12; WEAK_DEF: @def = weak constant i32 0 13 14;; It should also be defined in the corresponding object file 15; NM: def 16 17;--- av_ext_def.ll 18target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 19target triple = "x86_64-unknown-linux-gnu" 20@def = available_externally constant i32 0 21define ptr @ret_av_ext_def() { 22 ret ptr @def 23} 24 25;--- weak_def.ll 26target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 27target triple = "x86_64-unknown-linux-gnu" 28@def = weak constant i32 0 29define ptr @ret_weak_def() { 30 ret ptr @def 31} 32