1// REQUIRES: x86
2// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
3// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/wrap.s -o %t2
4
5// RUN: ld.lld -o %t3 %t %t2 -wrap foo -wrap nosuchsym
6// RUN: llvm-objdump -d --print-imm-hex %t3 | FileCheck %s
7// RUN: ld.lld -o %t3 %t %t2 --wrap foo -wrap=nosuchsym
8// RUN: llvm-objdump -d --print-imm-hex %t3 | FileCheck %s
9// RUN: ld.lld -o %t3 %t %t2 --wrap foo --wrap foo -wrap=nosuchsym
10// RUN: llvm-objdump -d --print-imm-hex %t3 | FileCheck %s
11
12// CHECK: <_start>:
13// CHECK-NEXT: movl $0x11010, %edx
14// CHECK-NEXT: movl $0x11010, %edx
15// CHECK-NEXT: movl $0x11000, %edx
16
17// RUN: llvm-readobj --symbols %t3 > %t4.dump
18// RUN: FileCheck --check-prefix=SYM1 %s < %t4.dump
19// RUN: FileCheck --check-prefix=SYM2 %s < %t4.dump
20// RUN: FileCheck --check-prefix=SYM3 %s < %t4.dump
21
22// SYM1:      Name: foo
23// SYM1-NEXT: Value: 0x11000
24// SYM1-NEXT: Size:
25// SYM1-NEXT: Binding: Global
26// SYM1-NEXT: Type:    None
27// SYM1-NEXT: Other:   0
28// SYM2:      Name: __wrap_foo
29// SYM2-NEXT: Value: 0x11010
30// SYM2-NEXT: Size:
31// SYM2-NEXT: Binding: Weak
32// SYM2-NEXT: Type:    None
33// SYM2-NEXT: Other [
34// SYM2-NEXT:   STV_PROTECTED
35// SYM2-NEXT: ]
36// SYM3-NOT:  Name: __real_foo
37
38.global _start
39_start:
40  movl $foo, %edx
41  movl $__wrap_foo, %edx
42  movl $__real_foo, %edx
43