diff options
author | Nico Rieck <nico.rieck@gmail.com> | 2014-01-14 15:22:47 +0000 |
---|---|---|
committer | Nico Rieck <nico.rieck@gmail.com> | 2014-01-14 15:22:47 +0000 |
commit | 7157bb765e487eeb6468525759850f3a10e2f38f (patch) | |
tree | 1d14e874c93c676d5d3d760b231622faddabab35 /llvm/test/CodeGen/X86/dllexport.ll | |
parent | 767fc967b40d85b8ade82ecc1887f130d283dfcb (diff) | |
download | bcm5719-llvm-7157bb765e487eeb6468525759850f3a10e2f38f.tar.gz bcm5719-llvm-7157bb765e487eeb6468525759850f3a10e2f38f.zip |
Decouple dllexport/dllimport from linkage
Representing dllexport/dllimport as distinct linkage types prevents using
these attributes on templates and inline functions.
Instead of introducing further mixed linkage types to include linkonce and
weak ODR, the old import/export linkage types are replaced with a new
separate visibility-like specifier:
define available_externally dllimport void @f() {}
@Var = dllexport global i32 1, align 4
Linkage for dllexported globals and functions is now equal to their linkage
without dllexport. Imported globals and functions must be either
declarations with external linkage, or definitions with
AvailableExternallyLinkage.
llvm-svn: 199218
Diffstat (limited to 'llvm/test/CodeGen/X86/dllexport.ll')
-rw-r--r-- | llvm/test/CodeGen/X86/dllexport.ll | 100 |
1 files changed, 94 insertions, 6 deletions
diff --git a/llvm/test/CodeGen/X86/dllexport.ll b/llvm/test/CodeGen/X86/dllexport.ll index bf57e78f35d..1d992125976 100644 --- a/llvm/test/CodeGen/X86/dllexport.ll +++ b/llvm/test/CodeGen/X86/dllexport.ll @@ -1,12 +1,100 @@ -; RUN: llc < %s | FileCheck %s -; PR2936 +; RUN: llc -mtriple i386-pc-win32 < %s | FileCheck -check-prefix=CHECK -check-prefix=WIN32 %s +; RUN: llc -mtriple i386-pc-mingw32 < %s | FileCheck -check-prefix=CHECK -check-prefix=MINGW %s -target triple = "i386-pc-mingw32" +; CHECK: .text -define dllexport x86_fastcallcc i32 @foo() nounwind { -entry: +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 _stdfun@0 +define dllexport x86_stdcallcc void @stdfun() nounwind { + ret void +} + +; CHECK: .globl @fastfun@0 +define dllexport x86_fastcallcc i32 @fastfun() nounwind { ret i32 0 } +; CHECK: .globl _thisfun +define dllexport x86_thiscallcc void @thisfun() nounwind { + ret void +} + +; CHECK: .section .text,"xr",discard,_lnk1 +; CHECK: .globl _lnk1 +define linkonce_odr dllexport void @lnk1() { + ret void +} + +; CHECK: .section .text,"xr",discard,_lnk2 +; CHECK: .globl _lnk2 +define linkonce_odr dllexport void @lnk2() alwaysinline { + ret void +} + +; CHECK: .section .text,"xr",discard,_weak1 +; CHECK: .globl _weak1 +define weak_odr dllexport void @weak1() { + ret void +} + + +; CHECK: .data +; CHECK: .globl _Var1 +@Var1 = dllexport global i32 1, align 4 + +; CHECK: .rdata,"r" +; CHECK: .globl _Var2 +@Var2 = dllexport unnamed_addr constant i32 1 + +; CHECK: .comm _Var3 +@Var3 = common dllexport global i32 0, align 4 + +; CHECK: .section .data,"w",discard,_WeakVar1 +; CHECK: .globl _WeakVar1 +@WeakVar1 = weak_odr dllexport global i32 1, align 4 + +; CHECK: .section .rdata,"r",discard,_WeakVar2 +; CHECK: .globl _WeakVar2 +@WeakVar2 = weak_odr dllexport unnamed_addr constant i32 1 + + ; CHECK: .section .drectve -; CHECK: -export:@foo@0 +; WIN32: /EXPORT:_Var1,DATA +; WIN32: /EXPORT:_Var2,DATA +; WIN32: /EXPORT:_Var3,DATA +; WIN32: /EXPORT:_WeakVar1,DATA +; WIN32: /EXPORT:_WeakVar2,DATA +; WIN32: /EXPORT:_f1 +; WIN32: /EXPORT:_f2 +; WIN32: /EXPORT:_stdfun@0 +; WIN32: /EXPORT:@fastfun@0 +; WIN32: /EXPORT:_thisfun +; WIN32: /EXPORT:_lnk1 +; WIN32: /EXPORT:_lnk2 +; WIN32: /EXPORT:_weak1 +; MINGW: -export:_Var1,data +; MINGW: -export:_Var2,data +; MINGW: -export:_Var3,data +; MINGW: -export:_WeakVar1,data +; MINGW: -export:_WeakVar2,data +; MINGW: -export:_f1 +; MINGW: -export:_f2 +; MINGW: -export:_stdfun@0 +; MINGW: -export:@fastfun@0 +; MINGW: -export:_thisfun +; MINGW: -export:_lnk1 +; MINGW: -export:_lnk2 +; MINGW: -export:_weak1 |