1 ; RUN: llc -mtriple i386-pc-win32 < %s \ 2 ; RUN: | FileCheck -check-prefix CHECK -check-prefix CHECK-CL %s 3 ; RUN: llc -mtriple i386-pc-mingw32 < %s \ 4 ; RUN: | FileCheck -check-prefix CHECK -check-prefix CHECK-GCC %s 5 ; RUN: llc -mtriple i686-pc-cygwin %s -o - \ 6 ; RUN: | FileCheck -check-prefix CHECK -check-prefix CHECK-GCC %s 7 ; RUN: llc -mtriple i386-pc-win32 < %s \ 8 ; RUN: | FileCheck -check-prefix NOTEXPORTED %s 9 ; RUN: llc -mtriple i386-pc-mingw32 < %s \ 10 ; RUN: | FileCheck -check-prefix NOTEXPORTED %s 11 ; RUN: llc -mtriple i686-pc-cygwin %s -o - \ 12 ; RUN: | FileCheck -check-prefix NOTEXPORTED %s 13 14 ; CHECK: .text 15 16 define void @notExported() { 17 ret void 18 } 19 20 ; CHECK: .globl _f1 21 define dllexport void @f1() { 22 ret void 23 } 24 25 ; CHECK: .globl _f2 26 define dllexport void @f2() unnamed_addr { 27 ret void 28 } 29 30 declare dllexport void @notDefined() 31 32 ; CHECK: .globl _stdfun@0 33 define dllexport x86_stdcallcc void @stdfun() nounwind { 34 ret void 35 } 36 37 ; CHECK: .globl @fastfun@0 38 define dllexport x86_fastcallcc i32 @fastfun() nounwind { 39 ret i32 0 40 } 41 42 ; CHECK: .globl _thisfun 43 define dllexport x86_thiscallcc void @thisfun() nounwind { 44 ret void 45 } 46 47 ; CHECK: .globl _lnk1 48 define linkonce_odr dllexport void @lnk1() { 49 ret void 50 } 51 52 ; CHECK: .globl _lnk2 53 define linkonce_odr dllexport void @lnk2() alwaysinline { 54 ret void 55 } 56 57 ; CHECK: .globl _weak1 58 define weak_odr dllexport void @weak1() { 59 ret void 60 } 61 62 63 ; CHECK: .data 64 ; CHECK: .globl _Var1 65 @Var1 = dllexport global i32 1, align 4 66 67 ; CHECK: .rdata,"dr" 68 ; CHECK: .globl _Var2 69 @Var2 = dllexport unnamed_addr constant i32 1 70 71 ; CHECK: .comm _Var3 72 @Var3 = common dllexport global i32 0, align 4 73 74 ; CHECK: .globl _WeakVar1 75 @WeakVar1 = weak_odr dllexport global i32 1, align 4 76 77 ; CHECK: .globl _WeakVar2 78 @WeakVar2 = weak_odr dllexport unnamed_addr constant i32 1 79 80 81 ; CHECK: .globl _alias 82 ; CHECK: .set _alias, _notExported 83 @alias = dllexport alias void(), void()* @notExported 84 85 ; CHECK: .globl _alias2 86 ; CHECK: .set _alias2, _f1 87 @alias2 = dllexport alias void(), void()* @f1 88 89 ; CHECK: .globl _alias3 90 ; CHECK: .set _alias3, _notExported 91 @alias3 = dllexport alias void(), void()* @notExported 92 93 ; CHECK: .weak _weak_alias 94 ; CHECK: .set _weak_alias, _f1 95 @weak_alias = weak_odr dllexport alias void(), void()* @f1 96 97 ; Verify items that should not be exported do not appear in the export table. 98 ; We use a separate check prefix to avoid confusion between -NOT and -SAME. 99 ; NOTEXPORTED: .section .drectve 100 ; NOTEXPORTED-NOT: notExported 101 ; NOTEXPORTED-NOT: notDefined 102 103 ; CHECK: .section .drectve 104 ; CHECK-CL: .ascii " /EXPORT:_f1" 105 ; CHECK-CL: .ascii " /EXPORT:_f2" 106 ; CHECK-CL: .ascii " /EXPORT:_stdfun@0" 107 ; CHECK-CL: .ascii " /EXPORT:@fastfun@0" 108 ; CHECK-CL: .ascii " /EXPORT:_thisfun" 109 ; CHECK-CL: .ascii " /EXPORT:_lnk1" 110 ; CHECK-CL: .ascii " /EXPORT:_lnk2" 111 ; CHECK-CL: .ascii " /EXPORT:_weak1" 112 ; CHECK-CL: .ascii " /EXPORT:_Var1,DATA" 113 ; CHECK-CL: .ascii " /EXPORT:_Var2,DATA" 114 ; CHECK-CL: .ascii " /EXPORT:_Var3,DATA" 115 ; CHECK-CL: .ascii " /EXPORT:_WeakVar1,DATA" 116 ; CHECK-CL: .ascii " /EXPORT:_WeakVar2,DATA" 117 ; CHECK-CL: .ascii " /EXPORT:_alias" 118 ; CHECK-CL: .ascii " /EXPORT:_alias2" 119 ; CHECK-CL: .ascii " /EXPORT:_alias3" 120 ; CHECK-CL: .ascii " /EXPORT:_weak_alias" 121 ; CHECK-GCC: .ascii " -export:f1" 122 ; CHECK-GCC: .ascii " -export:f2" 123 ; CHECK-GCC: .ascii " -export:stdfun@0" 124 ; CHECK-GCC: .ascii " -export:@fastfun@0" 125 ; CHECK-GCC: .ascii " -export:thisfun" 126 ; CHECK-GCC: .ascii " -export:lnk1" 127 ; CHECK-GCC: .ascii " -export:lnk2" 128 ; CHECK-GCC: .ascii " -export:weak1" 129 ; CHECK-GCC: .ascii " -export:Var1,data" 130 ; CHECK-GCC: .ascii " -export:Var2,data" 131 ; CHECK-GCC: .ascii " -export:Var3,data" 132 ; CHECK-GCC: .ascii " -export:WeakVar1,data" 133 ; CHECK-GCC: .ascii " -export:WeakVar2,data" 134 ; CHECK-GCC: .ascii " -export:alias" 135 ; CHECK-GCC: .ascii " -export:alias2" 136 ; CHECK-GCC: .ascii " -export:alias3" 137 ; CHECK-GCC: .ascii " -export:weak_alias" 138