aboutsummaryrefslogtreecommitdiff
path: root/test/ELF/wrap-no-real.s
blob: 100efa6bbc280ed537a98a6fdec9e565430f1c6d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// REQUIRES: x86
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/wrap-no-real.s -o %t2.o
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/wrap-no-real2.s -o %t3.o
// RUN: ld.lld -o %t3.so -shared %t3.o

// RUN: ld.lld -o %t %t1.o %t2.o -wrap foo
// RUN: llvm-objdump -d -print-imm-hex %t | FileCheck %s

// RUN: ld.lld -o %t %t1.o %t2.o %t3.so -wrap foo
// RUN: llvm-objdump -d -print-imm-hex %t | FileCheck %s

// CHECK: _start:
// CHECK-NEXT: movl $0x11010, %edx
// CHECK-NEXT: movl $0x11010, %edx
// CHECK-NEXT: movl $0x11000, %edx

// RUN: llvm-readobj -t %t | FileCheck -check-prefix=SYM %s

// Test the full symbol table. It is verbose, but lld at times
// produced duplicated symbols which are hard to test otherwise.

// SYM:       Symbols [
// SYM-NEXT:    Symbol {
// SYM-NEXT:     Name:  (0)
// SYM-NEXT:     Value:
// SYM-NEXT:     Size:
// SYM-NEXT:     Binding:
// SYM-NEXT:     Type
// SYM-NEXT:     Other:
// SYM-NEXT:     Section:
// SYM-NEXT:   }
// SYM-NEXT:   Symbol {
// SYM-NEXT:     Name: _DYNAMIC
// SYM-NEXT:     Value:
// SYM-NEXT:     Size:
// SYM-NEXT:     Binding:
// SYM-NEXT:     Type:
// SYM-NEXT:     Other [
// SYM-NEXT:       STV_HIDDEN
// SYM-NEXT:     ]
// SYM-NEXT:     Section: .dynamic
// SYM-NEXT:   }
// SYM-NEXT:   Symbol {
// SYM-NEXT:     Name: foo
// SYM-NEXT:     Value: 0x11000
// SYM-NEXT:     Size:
// SYM-NEXT:     Binding:
// SYM-NEXT:     Type:
// SYM-NEXT:     Other:
// SYM-NEXT:     Section:
// SYM-NEXT:   }
// SYM-NEXT:   Symbol {
// SYM-NEXT:     Name: _start
// SYM-NEXT:     Value:
// SYM-NEXT:     Size:
// SYM-NEXT:     Binding:
// SYM-NEXT:     Type
// SYM-NEXT:     Other:
// SYM-NEXT:     Section:
// SYM-NEXT:   }
// SYM-NEXT:   Symbol {
// SYM-NEXT:     Name: __wrap_foo
// SYM-NEXT:     Value: 0x11010
// SYM-NEXT:     Size:
// SYM-NEXT:     Binding:
// SYM-NEXT:     Type:
// SYM-NEXT:     Other:
// SYM-NEXT:     Section:
// SYM-NEXT:   }
// SYM-NEXT: ]

.global _start
_start:
  movl $foo, %edx
  movl $__wrap_foo, %edx
  movl $__real_foo, %edx