[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / COFF / wrap-dllimport.s
blobd7662b29fdc78ab30478d1ed2511707111206a09
1 // REQUIRES: x86
3 // Check that we can wrap a dllimported symbol, so that references to
4 // __imp_<symbol> gets redirected to a defined local import instead.
6 // RUN: split-file %s %t.dir
7 // RUN: llvm-mc -filetype=obj -triple=i686-win32-gnu %t.dir/main.s -o %t.main.obj
8 // RUN: llvm-mc -filetype=obj -triple=i686-win32-gnu %t.dir/other.s -o %t.other.obj
10 // RUN: lld-link -dll -out:%t.dll %t.other.obj -noentry -safeseh:no -export:foo -implib:%t.lib
11 // RUN: lld-link -out:%t.exe %t.main.obj %t.lib -entry:entry -subsystem:console -debug:symtab -safeseh:no -wrap:foo -lldmap:%t.map
12 // RUN: llvm-objdump -s -d --print-imm-hex %t.exe | FileCheck %s
14 // CHECK: Contents of section .rdata:
15 // CHECK-NEXT: 402000 06104000
17 // CHECK: Disassembly of section .text:
18 // CHECK-EMPTY:
19 // CHECK: 00401000 <_entry>:
20 // CHECK-NEXT: 401000: ff 25 00 20 40 00 jmpl *0x402000
21 // CHECK-EMPTY:
22 // CHECK-NEXT: 00401006 <___wrap_foo>:
23 // CHECK-NEXT: 401006: c3 retl
25 // The jmpl instruction in _entry points at an address in 0x402000,
26 // which is the first 4 bytes of the .rdata section (above), which is a
27 // pointer that points at ___wrap_foo.
29 #--- main.s
30 .global _entry
31 _entry:
32 jmpl *__imp__foo
34 .global ___wrap_foo
35 ___wrap_foo:
36 ret
38 #--- other.s
39 .global _foo
41 _foo:
42 ret