1; REQUIRES: x86 2 3;; Test weak symbols are supported in LTO. The first definition should be 4;; used regardless of whether it is from a bitcode file or native object. 5 6; RUN: split-file %s %t 7 8; RUN: llvm-as %t/size1.ll -o %t-size1.bc 9; RUN: llvm-as %t/size2.ll -o %t-size2.bc 10; RUN: llc %t/size4.ll -o %t-size4.o -filetype=obj 11 12; RUN: ld.lld %t-size1.bc %t-size2.bc -o %t.so -shared 13; RUN: llvm-readobj --symbols %t.so | FileCheck %s -DSIZE=1 14 15; RUN: ld.lld %t-size2.bc %t-size1.bc -o %t2.so -shared 16; RUN: llvm-readobj --symbols %t2.so | FileCheck %s -DSIZE=2 17 18; RUN: ld.lld %t-size1.bc %t-size4.o -o %t3.so -shared 19; RUN: llvm-readobj --symbols %t3.so | FileCheck %s -DSIZE=1 20 21; RUN: ld.lld %t-size4.o %t-size1.bc -o %t4.so -shared 22; RUN: llvm-readobj --symbols %t4.so | FileCheck %s -DSIZE=4 23 24; CHECK: Name: a 25; CHECK-NEXT: Value: 26; CHECK-NEXT: Size: [[SIZE]] 27; CHECK-NEXT: Binding: Weak 28; CHECK-NEXT: Type: Object 29; CHECK-NEXT: Other: 0 30; CHECK-NEXT: Section: .data 31 32;--- size1.ll 33target triple = "x86_64-unknown-linux-gnu" 34target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 35 36@a = weak global i8 1 37 38;--- size2.ll 39target triple = "x86_64-unknown-linux-gnu" 40target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 41 42@a = weak global i16 1 43 44;--- size4.ll 45target triple = "x86_64-unknown-linux-gnu" 46target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 47 48@a = weak global i32 1 49