1 ; RUN: llc -mtriple x86_64-pc-win32 < %s | FileCheck -check-prefix=CHECK -check-prefix=WIN32 %s 2 ; RUN: llc -mtriple x86_64-pc-mingw32 < %s | FileCheck -check-prefix=CHECK -check-prefix=MINGW %s 3 ; RUN: llc -mtriple x86_64-pc-win32 < %s | FileCheck -check-prefix=NOTEXPORTED %s 4 ; RUN: llc -mtriple x86_64-pc-mingw32 < %s | FileCheck -check-prefix=NOTEXPORTED %s 5 6 ; CHECK: .text 7 8 define void @notExported() { 9 ret void 10 } 11 12 ; CHECK: .globl f1 13 define dllexport void @f1() { 14 ret void 15 } 16 17 ; CHECK: .globl f2 18 define dllexport void @f2() unnamed_addr { 19 ret void 20 } 21 22 ; CHECK: .globl lnk1 23 define linkonce_odr dllexport void @lnk1() { 24 ret void 25 } 26 27 ; CHECK: .globl lnk2 28 define linkonce_odr dllexport void @lnk2() alwaysinline { 29 ret void 30 } 31 32 ; CHECK: .globl weak1 33 define weak_odr dllexport void @weak1() { 34 ret void 35 } 36 37 38 ; CHECK: .data 39 ; CHECK: .globl Var1 40 @Var1 = dllexport global i32 1, align 4 41 42 ; CHECK: .rdata,"dr" 43 ; CHECK: .globl Var2 44 @Var2 = dllexport unnamed_addr constant i32 1 45 46 ; CHECK: .comm Var3 47 @Var3 = common dllexport global i32 0, align 4 48 49 ; CHECK: .globl WeakVar1 50 @WeakVar1 = weak_odr dllexport global i32 1, align 4 51 52 ; CHECK: .globl WeakVar2 53 @WeakVar2 = weak_odr dllexport unnamed_addr constant i32 1 54 55 ; CHECK: .bss 56 ; CHECK: .globl WeakVar3 57 @WeakVar3 = weak_odr dllexport global i32 0, align 4 58 59 60 ; CHECK: .globl alias 61 ; CHECK: alias = notExported 62 @alias = dllexport alias void(), void()* @notExported 63 64 ; CHECK: .globl aliasNotExported 65 ; CHECK: aliasNotExported = f1 66 @aliasNotExported = alias void(), void()* @f1 67 68 ; CHECK: .globl alias2 69 ; CHECK: alias2 = f1 70 @alias2 = dllexport alias void(), void()* @f1 71 72 ; CHECK: .globl alias3 73 ; CHECK: alias3 = notExported 74 @alias3 = dllexport alias void(), void()* @notExported 75 76 ; CHECK: .weak weak_alias 77 ; CHECK: weak_alias = f1 78 @weak_alias = weak_odr dllexport alias void(), void()* @f1 79 80 @blob = global [6 x i8] c"\B8*\00\00\00\C3", section ".text", align 16 81 @blob_alias = dllexport alias i32 (), bitcast ([6 x i8]* @blob to i32 ()*) 82 83 @exportedButNotDefinedVariable = external dllexport global i32 84 declare dllexport void @exportedButNotDefinedFunction() 85 define void @foo() { 86 entry: 87 store i32 4, i32* @exportedButNotDefinedVariable, align 4 88 call void @exportedButNotDefinedFunction() 89 ret void 90 } 91 92 ; Verify items that should not be exported do not appear in the export table. 93 ; We use a separate check prefix to avoid confusion between -NOT and -SAME. 94 ; NOTEXPORTED: .section .drectve 95 ; NOTEXPORTED-NOT: notExported 96 ; NOTEXPORTED-NOT: aliasNotExported 97 ; NOTEXPORTED-NOT: exportedButNotDefinedVariable 98 ; NOTEXPORTED-NOT: exportedButNotDefinedFunction 99 100 ; CHECK: .section .drectve 101 ; WIN32: /EXPORT:f1 102 ; WIN32-SAME: /EXPORT:f2 103 ; WIN32-SAME: /EXPORT:lnk1 104 ; WIN32-SAME: /EXPORT:lnk2 105 ; WIN32-SAME: /EXPORT:weak1 106 ; WIN32-SAME: /EXPORT:Var1,DATA 107 ; WIN32-SAME: /EXPORT:Var2,DATA 108 ; WIN32-SAME: /EXPORT:Var3,DATA 109 ; WIN32-SAME: /EXPORT:WeakVar1,DATA 110 ; WIN32-SAME: /EXPORT:WeakVar2,DATA 111 ; WIN32-SAME: /EXPORT:WeakVar3,DATA 112 ; WIN32-SAME: /EXPORT:alias 113 ; WIN32-SAME: /EXPORT:alias2 114 ; WIN32-SAME: /EXPORT:alias3 115 ; WIN32-SAME: /EXPORT:weak_alias 116 ; WIN32-SAME: /EXPORT:blob_alias 117 ; MINGW: -export:f1 118 ; MINGW-SAME: -export:f2 119 ; MINGW-SAME: -export:lnk1 120 ; MINGW-SAME: -export:lnk2 121 ; MINGW-SAME: -export:weak1 122 ; MINGW-SAME: -export:Var1,data 123 ; MINGW-SAME: -export:Var2,data 124 ; MINGW-SAME: -export:Var3,data 125 ; MINGW-SAME: -export:WeakVar1,data 126 ; MINGW-SAME: -export:WeakVar2,data 127 ; MINGW-SAME: -export:WeakVar3,data 128 ; MINGW-SAME: -export:alias 129 ; MINGW-SAME: -export:alias2 130 ; MINGW-SAME: -export:alias3 131 ; MINGW-SAME: -export:weak_alias 132 ; MINGW-SAME: -export:blob_alias" 133