1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o
3# RUN: echo -e '.globl foo\nfoo: ret' | \
4# RUN:   llvm-mc -filetype=obj -triple=x86_64-pc-linux - -o %t2.o
5
6# RUN: ld.lld -shared -o %t.so %t1.o --start-lib %t2.o
7# RUN: llvm-readobj --dyn-syms %t.so | FileCheck %s
8
9# RUN: ld.lld -pie -o %t %t1.o --start-lib %t2.o
10# RUN: llvm-readobj --dyn-syms %t | FileCheck %s
11
12# CHECK:      Name: foo
13# CHECK-NEXT: Value: 0x0
14# CHECK-NEXT: Size: 0
15# CHECK-NEXT: Binding: Weak
16# CHECK-NEXT: Type: None
17# CHECK-NEXT: Other: 0
18# CHECK-NEXT: Section: Undefined
19
20## -u specifies a STB_DEFAULT undefined symbol, so the definition from %t2.o is
21## fetched.
22# RUN: ld.lld -u foo %t1.o --start-lib %t2.o -o %t1
23# RUN: llvm-readobj --syms %t1 | FileCheck %s --check-prefix=CHECK-U
24
25# CHECK-U:      Name: foo
26# CHECK-U:      Binding:
27# CHECK-U-SAME:          Global
28# CHECK-U:      Section:
29# CHECK-U-SAME:          .text
30
31.weak foo
32call foo@PLT
33
34.data
35.quad foo
36