[flang] Support OPEN(..., FORM="BINARY") (#124657)
[llvm-project.git] / lld / test / COFF / lto-imp-prefix.ll
blobd617a6ef58107854c265447dd843e60fb6648086
1 ; REQUIRES: x86
3 ; RUN: rm -rf %t.dir
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
17 ;--- main.ll
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() {
22 entry:
23   tail call void @importedFunc()
24   tail call void @other()
25   ret void
28 declare dllimport void @importedFunc()
30 declare void @other()
32 ;--- other1.ll
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() {
39 entry:
40   ret void
43 @__imp_unusedFunc = global ptr @unusedFuncReplacement
45 define internal void @unusedFuncReplacement() {
46 entry:
47   ret void
50 define void @other() {
51 entry:
52   ret void
55 ;--- other2.ll
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_
62 ; prefix.
63 define void @importedFunc() {
64 entry:
65   ret void
68 define void @other() {
69 entry:
70   ret void