2016-04-01 11:54:03 +08:00
|
|
|
; RUN: llc -mtriple x86_64-pc-win32 < %s | FileCheck -check-prefix=CHECK -check-prefix=WIN32 %s
|
2014-01-14 23:22:47 +08:00
|
|
|
; RUN: llc -mtriple x86_64-pc-mingw32 < %s | FileCheck -check-prefix=CHECK -check-prefix=MINGW %s
|
2016-04-01 11:54:03 +08:00
|
|
|
; RUN: llc -mtriple x86_64-pc-win32 < %s | FileCheck -check-prefix=NOTEXPORTED %s
|
|
|
|
; RUN: llc -mtriple x86_64-pc-mingw32 < %s | FileCheck -check-prefix=NOTEXPORTED %s
|
2014-01-14 23:22:47 +08:00
|
|
|
|
|
|
|
; CHECK: .text
|
|
|
|
|
|
|
|
define void @notExported() {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: .globl f1
|
|
|
|
define dllexport void @f1() {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: .globl f2
|
|
|
|
define dllexport void @f2() unnamed_addr {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: .globl lnk1
|
|
|
|
define linkonce_odr dllexport void @lnk1() {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: .globl lnk2
|
|
|
|
define linkonce_odr dllexport void @lnk2() alwaysinline {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: .globl weak1
|
|
|
|
define weak_odr dllexport void @weak1() {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
; CHECK: .data
|
|
|
|
; CHECK: .globl Var1
|
|
|
|
@Var1 = dllexport global i32 1, align 4
|
|
|
|
|
2015-02-07 16:26:40 +08:00
|
|
|
; CHECK: .rdata,"dr"
|
2014-01-14 23:22:47 +08:00
|
|
|
; CHECK: .globl Var2
|
|
|
|
@Var2 = dllexport unnamed_addr constant i32 1
|
|
|
|
|
|
|
|
; CHECK: .comm Var3
|
|
|
|
@Var3 = common dllexport global i32 0, align 4
|
|
|
|
|
|
|
|
; CHECK: .globl WeakVar1
|
|
|
|
@WeakVar1 = weak_odr dllexport global i32 1, align 4
|
|
|
|
|
|
|
|
; CHECK: .globl WeakVar2
|
|
|
|
@WeakVar2 = weak_odr dllexport unnamed_addr constant i32 1
|
|
|
|
|
2016-04-05 03:10:55 +08:00
|
|
|
; CHECK: .bss
|
|
|
|
; CHECK: .globl WeakVar3
|
|
|
|
@WeakVar3 = weak_odr dllexport global i32 0, align 4
|
|
|
|
|
2014-01-14 23:22:47 +08:00
|
|
|
|
2014-01-14 23:23:25 +08:00
|
|
|
; CHECK: .globl alias
|
|
|
|
; CHECK: alias = notExported
|
2015-09-11 11:22:04 +08:00
|
|
|
@alias = dllexport alias void(), void()* @notExported
|
2014-01-14 23:23:25 +08:00
|
|
|
|
2016-04-05 03:10:55 +08:00
|
|
|
; CHECK: .globl aliasNotExported
|
|
|
|
; CHECK: aliasNotExported = f1
|
|
|
|
@aliasNotExported = alias void(), void()* @f1
|
|
|
|
|
2014-01-14 23:23:25 +08:00
|
|
|
; CHECK: .globl alias2
|
|
|
|
; CHECK: alias2 = f1
|
2015-09-11 11:22:04 +08:00
|
|
|
@alias2 = dllexport alias void(), void()* @f1
|
2014-01-14 23:23:25 +08:00
|
|
|
|
|
|
|
; CHECK: .globl alias3
|
2014-03-27 23:26:56 +08:00
|
|
|
; CHECK: alias3 = notExported
|
2015-09-11 11:22:04 +08:00
|
|
|
@alias3 = dllexport alias void(), void()* @notExported
|
2014-01-14 23:23:25 +08:00
|
|
|
|
|
|
|
; CHECK: .weak weak_alias
|
|
|
|
; CHECK: weak_alias = f1
|
2015-09-11 11:22:04 +08:00
|
|
|
@weak_alias = weak_odr dllexport alias void(), void()* @f1
|
2014-01-14 23:23:25 +08:00
|
|
|
|
2014-05-25 20:49:07 +08:00
|
|
|
@blob = global [6 x i8] c"\B8*\00\00\00\C3", section ".text", align 16
|
2015-09-11 11:22:04 +08:00
|
|
|
@blob_alias = dllexport alias i32 (), bitcast ([6 x i8]* @blob to i32 ()*)
|
2014-01-14 23:23:25 +08:00
|
|
|
|
2016-04-05 03:10:55 +08:00
|
|
|
@exportedButNotDefinedVariable = external dllexport global i32
|
|
|
|
declare dllexport void @exportedButNotDefinedFunction()
|
|
|
|
define void @foo() {
|
|
|
|
entry:
|
|
|
|
store i32 4, i32* @exportedButNotDefinedVariable, align 4
|
|
|
|
call void @exportedButNotDefinedFunction()
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Verify items that should not be exported do not appear in the export table.
|
2016-04-01 11:54:03 +08:00
|
|
|
; We use a separate check prefix to avoid confusion between -NOT and -SAME.
|
|
|
|
; NOTEXPORTED: .section .drectve
|
|
|
|
; NOTEXPORTED-NOT: notExported
|
2016-04-05 03:10:55 +08:00
|
|
|
; NOTEXPORTED-NOT: aliasNotExported
|
|
|
|
; NOTEXPORTED-NOT: exportedButNotDefinedVariable
|
|
|
|
; NOTEXPORTED-NOT: exportedButNotDefinedFunction
|
2016-04-01 11:54:03 +08:00
|
|
|
|
2014-01-14 23:22:47 +08:00
|
|
|
; CHECK: .section .drectve
|
2015-06-30 06:04:09 +08:00
|
|
|
; WIN32: /EXPORT:f1
|
|
|
|
; WIN32-SAME: /EXPORT:f2
|
|
|
|
; WIN32-SAME: /EXPORT:lnk1
|
|
|
|
; WIN32-SAME: /EXPORT:lnk2
|
|
|
|
; WIN32-SAME: /EXPORT:weak1
|
|
|
|
; WIN32-SAME: /EXPORT:Var1,DATA
|
|
|
|
; WIN32-SAME: /EXPORT:Var2,DATA
|
|
|
|
; WIN32-SAME: /EXPORT:Var3,DATA
|
|
|
|
; WIN32-SAME: /EXPORT:WeakVar1,DATA
|
|
|
|
; WIN32-SAME: /EXPORT:WeakVar2,DATA
|
2016-04-05 03:10:55 +08:00
|
|
|
; WIN32-SAME: /EXPORT:WeakVar3,DATA
|
2015-06-30 06:04:09 +08:00
|
|
|
; WIN32-SAME: /EXPORT:alias
|
|
|
|
; WIN32-SAME: /EXPORT:alias2
|
|
|
|
; WIN32-SAME: /EXPORT:alias3
|
|
|
|
; WIN32-SAME: /EXPORT:weak_alias
|
|
|
|
; WIN32-SAME: /EXPORT:blob_alias
|
|
|
|
; MINGW: -export:f1
|
|
|
|
; MINGW-SAME: -export:f2
|
|
|
|
; MINGW-SAME: -export:lnk1
|
|
|
|
; MINGW-SAME: -export:lnk2
|
|
|
|
; MINGW-SAME: -export:weak1
|
|
|
|
; MINGW-SAME: -export:Var1,data
|
|
|
|
; MINGW-SAME: -export:Var2,data
|
|
|
|
; MINGW-SAME: -export:Var3,data
|
|
|
|
; MINGW-SAME: -export:WeakVar1,data
|
|
|
|
; MINGW-SAME: -export:WeakVar2,data
|
2016-04-05 03:10:55 +08:00
|
|
|
; MINGW-SAME: -export:WeakVar3,data
|
2015-06-30 06:04:09 +08:00
|
|
|
; MINGW-SAME: -export:alias
|
|
|
|
; MINGW-SAME: -export:alias2
|
|
|
|
; MINGW-SAME: -export:alias3
|
|
|
|
; MINGW-SAME: -export:weak_alias
|
|
|
|
; MINGW-SAME: -export:blob_alias"
|