4 ; RUN: split-file %s %t.dir
5 ; RUN: llvm-as %t.dir/main.ll -o %t.main.obj
6 ; RUN: llvm-as %t.dir/other1.ll -o %t.other1.obj
7 ; RUN: llvm-as %t.dir/other2.ll -o %t.other2.obj
9 ; RUN: lld-link /entry:entry %t.main.obj %t.other1.obj /out:%t1.exe /subsystem:console /debug:symtab
11 ;; Check that we don't retain __imp_ prefixed symbols we don't need.
12 ; RUN: llvm-nm %t1.exe | FileCheck %s
13 ; CHECK-NOT: __imp_unusedFunc
15 ; RUN: lld-link /entry:entry %t.main.obj %t.other2.obj /out:%t2.exe /subsystem:console
18 target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
19 target triple = "x86_64-w64-windows-gnu"
21 define void @entry() {
23 tail call void @importedFunc()
24 tail call void @other()
28 declare dllimport void @importedFunc()
33 target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
34 target triple = "x86_64-w64-windows-gnu"
36 @__imp_importedFunc = global ptr @importedFuncReplacement
38 define internal void @importedFuncReplacement() {
43 @__imp_unusedFunc = global ptr @unusedFuncReplacement
45 define internal void @unusedFuncReplacement() {
50 define void @other() {
56 target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
57 target triple = "x86_64-w64-windows-gnu"
59 @__imp_importedFunc = global ptr @importedFunc
61 ; Test with two external symbols with the same name, with/without the __imp_
63 define void @importedFunc() {
68 define void @other() {