32 lines · plain
1; RUN: split-file %s %t2 3; RUN: opt -module-summary %t/av_ext_def.ll -o %t/av_ext_def.bc4; RUN: opt -module-summary %t/weak_def.ll -o %t/weak_def.bc5; 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,px8; RUN: llvm-dis %t/prevailing_import.2.3.import.bc -o - | FileCheck --match-full-lines --check-prefix=WEAK_DEF %s9; RUN: llvm-nm -jU %t/prevailing_import.2 | FileCheck --match-full-lines --check-prefix=NM %s10 11;; def should remain weak after function importing in the weak_def module12; WEAK_DEF: @def = weak constant i32 013 14;; It should also be defined in the corresponding object file15; NM: def16 17;--- av_ext_def.ll18target 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 021define ptr @ret_av_ext_def() {22 ret ptr @def23}24 25;--- weak_def.ll26target 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 029define ptr @ret_weak_def() {30 ret ptr @def31}32