• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// REQUIRES: x86
2
3// Check that wrapping works when the wrapped symbol is imported from a
4// different DLL, redirecting references that used to point at the import
5// thunk, towards the local wrap function instead.
6
7// RUN: split-file %s %t.dir
8// RUN: llc %t.dir/main.ll -o %t.main.obj --filetype=obj
9// RUN: llvm-as %t.dir/main.ll -o %t.main.bc
10// RUN: llvm-mc -filetype=obj -triple=x86_64-win32-gnu %t.dir/lib.s -o %t.lib.obj
11
12// RUN: lld-link -dll -out:%t.lib.dll %t.lib.obj -noentry -export:func -implib:%t.lib.lib
13// RUN: lld-link -out:%t.exe %t.main.obj %t.lib.lib -entry:entry -subsystem:console -wrap:func
14// RUN: lld-link -out:%t.exe %t.main.bc %t.lib.lib -entry:entry -subsystem:console -wrap:func
15
16#--- main.ll
17target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
18target triple = "x86_64-w64-windows-gnu"
19
20declare void @func()
21
22define void @entry() {
23  call void @func()
24  ret void
25}
26
27declare void @__real_func()
28
29define void @__wrap_func() {
30  call void @__real_func()
31  ret void
32}
33
34#--- lib.s
35.global func
36func:
37  ret
38