• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; REQUIRES: x86
2; RUN: llvm-as %s -o %t1.o
3; RUN: llvm-as %p/Inputs/weakodr-visibility.ll -o %t2.o
4
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 and
8; check that linker selects different symbol definitions,
9; but keeps `protected` visibility.
10
11; RUN: ld.lld %t1.o %t2.o -o %t.so -shared
12; RUN: llvm-readobj --symbols %t.so | FileCheck %s
13; RUN: llvm-objdump -d %t.so | FileCheck %s --check-prefix=FIRST
14; CHECK:       Symbol {
15; CHECK:        Name: foo
16; CHECK-NEXT:   Value:
17; CHECK-NEXT:   Size:
18; CHECK-NEXT:   Binding: Weak
19; CHECK-NEXT:   Type: Function
20; CHECK-NEXT:   Other [
21; CHECK-NEXT:     STV_PROTECTED
22; CHECK-NEXT:   ]
23; CHECK-NEXT:   Section:
24; CHECK-NEXT: }
25; FIRST:      <foo>:
26; FIRST-NEXT:   movl    $41, %eax
27
28; Now swap the files order.
29; RUN: ld.lld %t2.o %t1.o -o %t.so -shared
30; RUN: llvm-readobj --symbols %t.so | FileCheck %s
31; RUN: llvm-objdump -d %t.so | FileCheck %s --check-prefix=SECOND
32; SECOND:      <foo>:
33; SECOND-NEXT:   movl    $42, %eax
34
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(i8* %this) {
39  ret i32 41
40}
41