41 lines · plain
1; REQUIRES: x862; RUN: llvm-as %s -o %t1.o3; RUN: llvm-as %p/Inputs/weakodr-visibility.ll -o %t2.o4 5; Testcase checks we keep desired visibility of weak 6; symbol in a library even if select different definition.7; We change the order of input files in command line and8; check that linker selects different symbol definitions,9; but keeps `protected` visibility.10 11; RUN: ld.lld %t1.o %t2.o -o %t.so -shared12; RUN: llvm-readobj --symbols %t.so | FileCheck %s13; RUN: llvm-objdump --no-print-imm-hex -d %t.so | FileCheck %s --check-prefix=FIRST14; CHECK: Symbol {15; CHECK: Name: foo16; CHECK-NEXT: Value:17; CHECK-NEXT: Size:18; CHECK-NEXT: Binding: Weak19; CHECK-NEXT: Type: Function20; CHECK-NEXT: Other [21; CHECK-NEXT: STV_PROTECTED22; CHECK-NEXT: ]23; CHECK-NEXT: Section:24; CHECK-NEXT: }25; FIRST: <foo>:26; FIRST-NEXT: movl $41, %eax27 28; Now swap the files order.29; RUN: ld.lld %t2.o %t1.o -o %t.so -shared30; RUN: llvm-readobj --symbols %t.so | FileCheck %s31; RUN: llvm-objdump --no-print-imm-hex -d %t.so | FileCheck %s --check-prefix=SECOND32; SECOND: <foo>:33; SECOND-NEXT: movl $42, %eax34 35target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"36target triple = "x86_64-unknown-linux-gnu"37 38define weak_odr i32 @foo(ptr %this) {39 ret i32 4140}41