llvm.org GIT mirror llvm / 1491ef7
Handle dllexport for global aliases git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199219 91177308-0d34-0410-b5e6-96231b3b80d8 Nico Rieck 6 years ago
3 changed file(s) with 65 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
657657 if (I->hasDLLExportStorageClass())
658658 DLLExportedGlobals.push_back(getSymbol(I));
659659
660 for (Module::const_alias_iterator I = M.alias_begin(), E = M.alias_end();
661 I != E; ++I) {
662 const GlobalValue *GV = I;
663 if (!GV->hasDLLExportStorageClass())
664 continue;
665
666 while (const GlobalAlias *A = dyn_cast(GV))
667 GV = A->getAliasedGlobal();
668
669 if (isa(GV))
670 DLLExportedFns.push_back(getSymbol(I));
671 else if (isa(GV))
672 DLLExportedGlobals.push_back(getSymbol(I));
673 }
674
660675 // Output linker support code for dllexported globals on windows.
661676 if (!DLLExportedGlobals.empty() || !DLLExportedFns.empty()) {
662677 const TargetLoweringObjectFileCOFF &TLOFCOFF =
5555 @WeakVar2 = weak_odr dllexport unnamed_addr constant i32 1
5656
5757
58 ; CHECK: .globl alias
59 ; CHECK: alias = notExported
60 @alias = dllexport alias void()* @notExported
61
62 ; CHECK: .globl alias2
63 ; CHECK: alias2 = f1
64 @alias2 = dllexport alias void()* @f1
65
66 ; CHECK: .globl alias3
67 ; CHECK: alias3 = alias
68 @alias3 = dllexport alias void()* @alias
69
70 ; CHECK: .weak weak_alias
71 ; CHECK: weak_alias = f1
72 @weak_alias = dllexport alias weak_odr void()* @f1
73
74
5875 ; CHECK: .section .drectve
5976 ; WIN32: /EXPORT:Var1,DATA
6077 ; WIN32: /EXPORT:Var2,DATA
6683 ; WIN32: /EXPORT:lnk1
6784 ; WIN32: /EXPORT:lnk2
6885 ; WIN32: /EXPORT:weak1
86 ; WIN32: /EXPORT:alias
87 ; WIN32: /EXPORT:alias2
88 ; WIN32: /EXPORT:alias3
89 ; WIN32: /EXPORT:weak_alias
6990 ; MINGW: -export:Var1,data
7091 ; MINGW: -export:Var2,data
7192 ; MINGW: -export:Var3,data
7697 ; MINGW: -export:lnk1
7798 ; MINGW: -export:lnk2
7899 ; MINGW: -export:weak1
100 ; MINGW: -export:alias
101 ; MINGW: -export:alias2
102 ; MINGW: -export:alias3
103 ; MINGW: -export:weak_alias
7070 @WeakVar2 = weak_odr dllexport unnamed_addr constant i32 1
7171
7272
73 ; CHECK: .globl _alias
74 ; CHECK: _alias = _notExported
75 @alias = dllexport alias void()* @notExported
76
77 ; CHECK: .globl _alias2
78 ; CHECK: _alias2 = _f1
79 @alias2 = dllexport alias void()* @f1
80
81 ; CHECK: .globl _alias3
82 ; CHECK: _alias3 = _alias
83 @alias3 = dllexport alias void()* @alias
84
85 ; CHECK: .weak _weak_alias
86 ; CHECK: _weak_alias = _f1
87 @weak_alias = dllexport alias weak_odr void()* @f1
88
89
7390 ; CHECK: .section .drectve
7491 ; WIN32: /EXPORT:_Var1,DATA
7592 ; WIN32: /EXPORT:_Var2,DATA
84101 ; WIN32: /EXPORT:_lnk1
85102 ; WIN32: /EXPORT:_lnk2
86103 ; WIN32: /EXPORT:_weak1
104 ; WIN32: /EXPORT:_alias
105 ; WIN32: /EXPORT:_alias2
106 ; WIN32: /EXPORT:_alias3
107 ; WIN32: /EXPORT:_weak_alias
87108 ; MINGW: -export:_Var1,data
88109 ; MINGW: -export:_Var2,data
89110 ; MINGW: -export:_Var3,data
97118 ; MINGW: -export:_lnk1
98119 ; MINGW: -export:_lnk2
99120 ; MINGW: -export:_weak1
121 ; MINGW: -export:_alias
122 ; MINGW: -export:_alias2
123 ; MINGW: -export:_alias3
124 ; MINGW: -export:_weak_alias