Skip to content

Commit 685a699

Browse files
kikairoyajeremyd2019
authored andcommitted
[Cygwin] Global symbols should be external by default (llvm#139797)
Behaves as same as both of Clang and GCC targetting MinGW. Required for compatibility for Cygwin-GCC. Divided from llvm#138773
1 parent 4a8070f commit 685a699

File tree

8 files changed

+164
-11
lines changed

8 files changed

+164
-11
lines changed

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1671,7 +1671,7 @@ static bool shouldAssumeDSOLocal(const CodeGenModule &CGM,
16711671

16721672
const llvm::Triple &TT = CGM.getTriple();
16731673
const auto &CGOpts = CGM.getCodeGenOpts();
1674-
if (TT.isWindowsGNUEnvironment()) {
1674+
if (TT.isOSCygMing()) {
16751675
// In MinGW, variables without DLLImport can still be automatically
16761676
// imported from a DLL by the linker; don't mark variables that
16771677
// potentially could come from another DLL as DSO local.

clang/test/CodeGen/dllexport.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// RUN: %clang_cc1 -triple x86_64-windows-msvc -fms-extensions -emit-llvm -std=c11 -O0 -o - %s | FileCheck %s
33
// RUN: %clang_cc1 -triple i686-windows-gnu -fms-extensions -emit-llvm -std=c11 -O0 -o - %s | FileCheck %s
44
// RUN: %clang_cc1 -triple x86_64-windows-gnu -fms-extensions -emit-llvm -std=c11 -O0 -o - %s | FileCheck %s
5+
// RUN: %clang_cc1 -triple i686-pc-cygwin -fms-extensions -emit-llvm -std=c11 -O0 -o - %s | FileCheck %s
6+
// RUN: %clang_cc1 -triple x86_64-pc-cygwin -fms-extensions -emit-llvm -std=c11 -O0 -o - %s | FileCheck %s
57

68

79

clang/test/CodeGen/dllimport.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
// RUN: %clang_cc1 -triple x86_64-windows-msvc -fms-extensions -emit-llvm -std=c11 -O0 -o - %s | FileCheck --check-prefix=CHECK --check-prefix=MS %s
33
// RUN: %clang_cc1 -triple i686-windows-gnu -fms-extensions -emit-llvm -std=c11 -O0 -o - %s | FileCheck --check-prefix=CHECK --check-prefix=GNU %s
44
// RUN: %clang_cc1 -triple x86_64-windows-gnu -fms-extensions -emit-llvm -std=c11 -O0 -o - %s | FileCheck --check-prefix=CHECK --check-prefix=GNU %s
5+
// RUN: %clang_cc1 -triple i686-pc-cygwin -fms-extensions -emit-llvm -std=c11 -O0 -o - %s | FileCheck --check-prefix=CHECK --check-prefix=GNU %s
6+
// RUN: %clang_cc1 -triple x86_64-pc-cygwin -fms-extensions -emit-llvm -std=c11 -O0 -o - %s | FileCheck --check-prefix=CHECK --check-prefix=GNU %s
57
// RUN: %clang_cc1 -triple i686-windows-msvc -fms-extensions -emit-llvm -std=c11 -O1 -fno-inline -o - %s | FileCheck --check-prefix=O1 --check-prefix=MO1 %s
68
// RUN: %clang_cc1 -triple i686-windows-gnu -fms-extensions -emit-llvm -std=c11 -O1 -fno-inline -o - %s | FileCheck --check-prefix=O1 --check-prefix=GO1 %s
9+
// RUN: %clang_cc1 -triple i686-pc-cygwin -fms-extensions -emit-llvm -std=c11 -O1 -fno-inline -o - %s | FileCheck --check-prefix=O1 --check-prefix=GO1 %s
710

811
#define JOIN2(x, y) x##y
912
#define JOIN(x, y) JOIN2(x, y)

clang/test/CodeGen/dso-local-executable.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
// RUN: %clang_cc1 -triple x86_64-w64-mingw32 -emit-llvm %s -o - | FileCheck --check-prefixes=MINGW,MINGW-NATIVE_TLS,MINGW-AUTO-IMPORT %s
1313
// RUN: %clang_cc1 -triple x86_64-w64-mingw32 -emit-llvm %s -o - -fno-auto-import | FileCheck --check-prefixes=MINGW,MINGW-NATIVE_TLS,MINGW-NO-AUTO-IMPORT %s
1414
// RUN: %clang_cc1 -triple x86_64-w64-mingw32 -emit-llvm %s -o - -femulated-tls | FileCheck --check-prefixes=MINGW,MINGW-EMUTLS,MINGW-AUTO-IMPORT %s
15+
// RUN: %clang_cc1 -triple x86_64-pc-cygwin -emit-llvm %s -o - | FileCheck --check-prefixes=MINGW,MINGW-NATIVE_TLS,MINGW-AUTO-IMPORT %s
16+
// RUN: %clang_cc1 -triple x86_64-pc-cygwin -emit-llvm %s -o - -fno-auto-import | FileCheck --check-prefixes=MINGW,MINGW-NATIVE_TLS,MINGW-NO-AUTO-IMPORT %s
17+
// RUN: %clang_cc1 -triple x86_64-pc-cygwin -emit-llvm %s -o - -femulated-tls | FileCheck --check-prefixes=MINGW,MINGW-EMUTLS,MINGW-AUTO-IMPORT %s
1518
// MINGW: @baz = dso_local global i32 42
1619
// MINGW-NEXT: @import_var = external dllimport global i32
1720
// MINGW-NEXT: @weak_bar = extern_weak global i32

clang/test/CodeGenCXX/dllexport.cpp

Lines changed: 27 additions & 3 deletions
Large diffs are not rendered by default.

clang/test/CodeGenCXX/dllimport-members.cpp

Lines changed: 101 additions & 3 deletions
Large diffs are not rendered by default.

clang/test/CodeGenCXX/dllimport.cpp

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22
// RUN: %clang_cc1 -no-enable-noundef-analysis -triple x86_64-windows-msvc -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -DMSABI -w | FileCheck --check-prefix=MSC --check-prefix=M64 %s
33
// RUN: %clang_cc1 -no-enable-noundef-analysis -triple i686-windows-gnu -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -w | FileCheck --check-prefix=GNU --check-prefix=G32 %s
44
// RUN: %clang_cc1 -no-enable-noundef-analysis -triple x86_64-windows-gnu -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -w | FileCheck --check-prefix=GNU %s
5+
// RUN: %clang_cc1 -no-enable-noundef-analysis -triple i686-pc-cygwin -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -w | FileCheck --check-prefix=GNU --check-prefix=C32 %s
6+
// RUN: %clang_cc1 -no-enable-noundef-analysis -triple x86_64-pc-cygwin -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -w | FileCheck --check-prefix=GNU %s
57
// RUN: %clang_cc1 -no-enable-noundef-analysis -triple i686-windows-msvc -fno-rtti -fno-threadsafe-statics -fms-extensions -fms-compatibility-version=18.00 -emit-llvm -std=c++1y -O1 -disable-llvm-passes -o - %s -DMSABI -w | FileCheck --check-prefix=MO1 --check-prefix=M18 %s
68
// RUN: %clang_cc1 -no-enable-noundef-analysis -triple i686-windows-msvc -fno-rtti -fno-threadsafe-statics -fms-extensions -fms-compatibility-version=19.00 -emit-llvm -std=c++1y -O1 -disable-llvm-passes -o - %s -DMSABI -w | FileCheck --check-prefix=MO1 --check-prefix=M19 %s
79
// RUN: %clang_cc1 -no-enable-noundef-analysis -triple i686-windows-gnu -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O1 -disable-llvm-passes -o - %s -w | FileCheck --check-prefix=GO1 %s
8-
// RUN: %clang_cc1 -no-enable-noundef-analysis -triple x86_64-scei-ps4 -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -w | FileCheck --check-prefix=PS %s
9-
// RUN: %clang_cc1 -no-enable-noundef-analysis -triple x86_64-sie-ps5 -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -w | FileCheck --check-prefix=PS %s
10+
// RUN: %clang_cc1 -no-enable-noundef-analysis -triple x86_64-scei-ps4 -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -w | FileCheck --check-prefix=PS %s
11+
// RUN: %clang_cc1 -no-enable-noundef-analysis -triple x86_64-sie-ps5 -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -w | FileCheck --check-prefix=PS %s
1012

1113
// CHECK-NOT doesn't play nice with CHECK-DAG, so use separate run lines.
1214
// RUN: %clang_cc1 -no-enable-noundef-analysis -triple i686-windows-msvc -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -DMSABI -w | FileCheck --check-prefix=MSC2 %s
1315
// RUN: %clang_cc1 -no-enable-noundef-analysis -triple i686-windows-gnu -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -w | FileCheck --check-prefix=GNU2 %s
16+
// RUN: %clang_cc1 -no-enable-noundef-analysis -triple i686-pc-cygwin -fno-rtti -fno-threadsafe-statics -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s -w | FileCheck --check-prefix=GNU2 %s
1417

1518
// Helper structs to make templates more expressive.
1619
struct ImplicitInst_Imported {};
@@ -205,7 +208,7 @@ USEVAR(VarTmpl<ExplicitSpec_Imported>)
205208
// Functions
206209
//===----------------------------------------------------------------------===//
207210

208-
// GNU-DAG: declare dso_local void @_ZdlPv{{j|y}}(ptr, i{{32|64}})
211+
// GNU-DAG: declare dso_local void @_ZdlPv{{[jym]}}(ptr, i{{32|64}})
209212

210213
// Import function declaration.
211214
// MSC-DAG: declare dllimport void @"?decl@@YAXXZ"()
@@ -311,7 +314,7 @@ USE(friend5)
311314

312315
// Implicit declarations can be redeclared with dllimport.
313316
// MSC-DAG: declare dllimport nonnull ptr @"??2@{{YAPAXI|YAPEAX_K}}@Z"(
314-
// GNU-DAG: declare dllimport nonnull ptr @_Znw{{[yj]}}(
317+
// GNU-DAG: declare dllimport nonnull ptr @_Znw{{[yjm]}}(
315318
__declspec(dllimport) void* operator new(__SIZE_TYPE__ n);
316319
void UNIQ(use)() { ::operator new(42); }
317320

@@ -677,6 +680,7 @@ struct __declspec(dllimport) KeyFuncClass {
677680
};
678681
extern constexpr KeyFuncClass keyFuncClassVar = {};
679682
// G32-DAG: @_ZTV12KeyFuncClass = external dllimport unnamed_addr constant { [3 x ptr] }
683+
// C32-DAG: @_ZTV12KeyFuncClass = external dllimport unnamed_addr constant { [3 x ptr] }
680684

681685
struct __declspec(dllimport) X : public virtual W {};
682686
USECLASS(X)
@@ -813,20 +817,23 @@ template <typename T> struct __declspec(dllimport) PartiallySpecializedClassTemp
813817
USEMEMFUNC(PartiallySpecializedClassTemplate<void*>, f);
814818
// M32-DAG: declare dso_local x86_thiscallcc void @"?f@?$PartiallySpecializedClassTemplate@PAX@@QAEXXZ"
815819
// G32-DAG: declare dllimport x86_thiscallcc void @_ZN33PartiallySpecializedClassTemplateIPvE1fEv
820+
// C32-DAG: declare dllimport void @_ZN33PartiallySpecializedClassTemplateIPvE1fEv
816821

817822
// Attributes on explicit specializations are honored.
818823
template <typename T> struct ExplicitlySpecializedClassTemplate {};
819824
template <> struct __declspec(dllimport) ExplicitlySpecializedClassTemplate<void*> { void f(); };
820825
USEMEMFUNC(ExplicitlySpecializedClassTemplate<void*>, f);
821826
// M32-DAG: declare dllimport x86_thiscallcc void @"?f@?$ExplicitlySpecializedClassTemplate@PAX@@QAEXXZ"
822827
// G32-DAG: declare dllimport x86_thiscallcc void @_ZN34ExplicitlySpecializedClassTemplateIPvE1fEv
828+
// C32-DAG: declare dllimport void @_ZN34ExplicitlySpecializedClassTemplateIPvE1fEv
823829

824830
// MS inherits DLL attributes to partial specializations.
825831
template <typename T> struct __declspec(dllimport) PartiallySpecializedImportedClassTemplate {};
826832
template <typename T> struct PartiallySpecializedImportedClassTemplate<T*> { void f() {} };
827833
USEMEMFUNC(PartiallySpecializedImportedClassTemplate<void*>, f);
828834
// M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @"?f@?$PartiallySpecializedImportedClassTemplate@PAX@@QAEXXZ"
829835
// G32-DAG: define linkonce_odr dso_local x86_thiscallcc void @_ZN41PartiallySpecializedImportedClassTemplateIPvE1fEv
836+
// C32-DAG: define linkonce_odr dso_local void @_ZN41PartiallySpecializedImportedClassTemplateIPvE1fEv
830837

831838
// Attributes on the instantiation take precedence over attributes on the template.
832839
template <typename T> struct __declspec(dllexport) ExplicitlyInstantiatedWithDifferentAttr { void f() {} };
@@ -842,6 +849,7 @@ USEMEMFUNC(ExplicitInstantiationDeclImportedDefTemplate<int>, f);
842849
// M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @"?f@?$ExplicitInstantiationDeclImportedDefTemplate@H@@QAEXXZ"
843850
// M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc ptr @"??0?$ExplicitInstantiationDeclImportedDefTemplate@H@@QAE@XZ"
844851
// G32-DAG: define weak_odr dso_local x86_thiscallcc void @_ZN44ExplicitInstantiationDeclImportedDefTemplateIiE1fEv
852+
// C32-DAG: define weak_odr dso_local void @_ZN44ExplicitInstantiationDeclImportedDefTemplateIiE1fEv
845853

846854
template <typename T> struct __declspec(dllimport) ExplicitInstantiationDeclExportedDefImportedTemplate { void f() {} ExplicitInstantiationDeclExportedDefImportedTemplate() {} };
847855
extern template struct __declspec(dllimport) ExplicitInstantiationDeclExportedDefImportedTemplate <int>;
@@ -919,20 +927,23 @@ struct __declspec(dllimport) DerivedFromTemplate : public ClassTemplate<int> {};
919927
USEMEMFUNC(ClassTemplate<int>, func)
920928
// M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @"?func@?$ClassTemplate@H@@QAEXXZ"
921929
// G32-DAG: define linkonce_odr dso_local x86_thiscallcc void @_ZN13ClassTemplateIiE4funcEv
930+
// C32-DAG: define linkonce_odr dso_local void @_ZN13ClassTemplateIiE4funcEv
922931
// PS-DAG: declare dllimport void @_ZN13ClassTemplateIiE4funcEv
923932

924933
// ImportedTemplate is explicitly imported.
925934
struct __declspec(dllimport) DerivedFromImportedTemplate : public ImportedClassTemplate<int> {};
926935
USEMEMFUNC(ImportedClassTemplate<int>, func)
927936
// M32-DAG: declare dllimport x86_thiscallcc void @"?func@?$ImportedClassTemplate@H@@QAEXXZ"
928937
// G32-DAG: declare dllimport x86_thiscallcc void @_ZN21ImportedClassTemplateIiE4funcEv
938+
// C32-DAG: declare dllimport void @_ZN21ImportedClassTemplateIiE4funcEv
929939
// PS-DAG: declare dllimport void @_ZN21ImportedClassTemplateIiE4funcEv
930940

931941
// ExportedTemplate is explicitly exported.
932942
struct __declspec(dllimport) DerivedFromExportedTemplate : public ExportedClassTemplate<int> {};
933943
USEMEMFUNC(ExportedClassTemplate<int>, func)
934944
// M32-DAG: define weak_odr dso_local dllexport x86_thiscallcc void @"?func@?$ExportedClassTemplate@H@@QAEXXZ"
935945
// G32-DAG: define weak_odr dso_local dllexport x86_thiscallcc void @_ZN21ExportedClassTemplateIiE4funcEv
946+
// C32-DAG: define weak_odr dso_local dllexport void @_ZN21ExportedClassTemplateIiE4funcEv
936947
// PS-DAG: define weak_odr dllexport void @_ZN21ExportedClassTemplateIiE4funcEv
937948

938949
// Base class already implicitly instantiated without attribute.
@@ -941,6 +952,7 @@ struct __declspec(dllimport) DerivedFromTemplateD2 : public ClassTemplate<double
941952
USEMEMFUNC(ClassTemplate<double>, func)
942953
// M32-DAG: declare dllimport x86_thiscallcc void @"?func@?$ClassTemplate@N@@QAEXXZ"
943954
// G32-DAG: define linkonce_odr dso_local x86_thiscallcc void @_ZN13ClassTemplateIdE4funcEv
955+
// C32-DAG: define linkonce_odr dso_local void @_ZN13ClassTemplateIdE4funcEv
944956
// PS-DAG: declare dllimport void @_ZN13ClassTemplateIdE4funcEv
945957

946958
// MS: Base class already instantiated with dfferent attribute.
@@ -949,48 +961,55 @@ struct __declspec(dllimport) DerivedFromTemplateB2 : public ClassTemplate<bool>
949961
USEMEMFUNC(ClassTemplate<bool>, func)
950962
// M32-DAG: define weak_odr dso_local dllexport x86_thiscallcc void @"?func@?$ClassTemplate@_N@@QAEXXZ"
951963
// G32-DAG: define linkonce_odr dso_local x86_thiscallcc void @_ZN13ClassTemplateIbE4funcEv
964+
// C32-DAG: define linkonce_odr dso_local void @_ZN13ClassTemplateIbE4funcEv
952965
// PS-DAG: define weak_odr dllexport void @_ZN13ClassTemplateIbE4funcEv
953966

954967
// Base class already specialized without dll attribute.
955968
struct __declspec(dllimport) DerivedFromExplicitlySpecializedTemplate : public ExplicitlySpecializedTemplate<int> {};
956969
USEMEMFUNC(ExplicitlySpecializedTemplate<int>, func)
957970
// M32-DAG: define linkonce_odr dso_local x86_thiscallcc void @"?func@?$ExplicitlySpecializedTemplate@H@@QAEXXZ"
958971
// G32-DAG: define linkonce_odr dso_local x86_thiscallcc void @_ZN29ExplicitlySpecializedTemplateIiE4funcEv
972+
// C32-DAG: define linkonce_odr dso_local void @_ZN29ExplicitlySpecializedTemplateIiE4funcEv
959973
// PS-DAG: define linkonce_odr void @_ZN29ExplicitlySpecializedTemplateIiE4funcEv
960974

961975
// Base class alredy specialized with export attribute.
962976
struct __declspec(dllimport) DerivedFromExplicitlyExportSpecializedTemplate : public ExplicitlyExportSpecializedTemplate<int> {};
963977
USEMEMFUNC(ExplicitlyExportSpecializedTemplate<int>, func)
964978
// M32-DAG: define dso_local dllexport x86_thiscallcc void @"?func@?$ExplicitlyExportSpecializedTemplate@H@@QAEXXZ"
965979
// G32-DAG: define dso_local dllexport x86_thiscallcc void @_ZN35ExplicitlyExportSpecializedTemplateIiE4funcEv
980+
// C32-DAG: define dso_local dllexport void @_ZN35ExplicitlyExportSpecializedTemplateIiE4funcEv
966981
// PS-DAG: define dso_local dllexport void @_ZN35ExplicitlyExportSpecializedTemplateIiE4funcEv
967982

968983
// Base class already specialized with import attribute.
969984
struct __declspec(dllimport) DerivedFromExplicitlyImportSpecializedTemplate : public ExplicitlyImportSpecializedTemplate<int> {};
970985
USEMEMFUNC(ExplicitlyImportSpecializedTemplate<int>, func)
971986
// M32-DAG: declare dllimport x86_thiscallcc void @"?func@?$ExplicitlyImportSpecializedTemplate@H@@QAEXXZ"
972987
// G32-DAG: declare dllimport x86_thiscallcc void @_ZN35ExplicitlyImportSpecializedTemplateIiE4funcEv
988+
// C32-DAG: declare dllimport void @_ZN35ExplicitlyImportSpecializedTemplateIiE4funcEv
973989
// PS-DAG: declare dllimport void @_ZN35ExplicitlyImportSpecializedTemplateIiE4funcEv
974990

975991
// Base class already instantiated without dll attribute.
976992
struct __declspec(dllimport) DerivedFromExplicitlyInstantiatedTemplate : public ExplicitlyInstantiatedTemplate<int> {};
977993
USEMEMFUNC(ExplicitlyInstantiatedTemplate<int>, func)
978994
// M32-DAG: define weak_odr dso_local x86_thiscallcc void @"?func@?$ExplicitlyInstantiatedTemplate@H@@QAEXXZ"
979995
// G32-DAG: define weak_odr dso_local x86_thiscallcc void @_ZN30ExplicitlyInstantiatedTemplateIiE4funcEv
996+
// C32-DAG: define weak_odr dso_local void @_ZN30ExplicitlyInstantiatedTemplateIiE4funcEv
980997
// PS-DAG: define weak_odr void @_ZN30ExplicitlyInstantiatedTemplateIiE4funcEv
981998

982999
// Base class already instantiated with export attribute.
9831000
struct __declspec(dllimport) DerivedFromExplicitlyExportInstantiatedTemplate : public ExplicitlyExportInstantiatedTemplate<int> {};
9841001
USEMEMFUNC(ExplicitlyExportInstantiatedTemplate<int>, func)
9851002
// M32-DAG: define weak_odr dso_local dllexport x86_thiscallcc void @"?func@?$ExplicitlyExportInstantiatedTemplate@H@@QAEXXZ"
9861003
// G32-DAG: define weak_odr dso_local dllexport x86_thiscallcc void @_ZN36ExplicitlyExportInstantiatedTemplateIiE4funcEv
1004+
// C32-DAG: define weak_odr dso_local dllexport void @_ZN36ExplicitlyExportInstantiatedTemplateIiE4funcEv
9871005
// PS-DAG: define weak_odr dllexport void @_ZN36ExplicitlyExportInstantiatedTemplateIiE4funcEv
9881006

9891007
// Base class already instantiated with import attribute.
9901008
struct __declspec(dllimport) DerivedFromExplicitlyImportInstantiatedTemplate : public ExplicitlyImportInstantiatedTemplate<int> {};
9911009
USEMEMFUNC(ExplicitlyImportInstantiatedTemplate<int>, func)
9921010
// M32-DAG: declare dllimport x86_thiscallcc void @"?func@?$ExplicitlyImportInstantiatedTemplate@H@@QAEXXZ"
9931011
// G32-DAG: declare dllimport x86_thiscallcc void @_ZN36ExplicitlyImportInstantiatedTemplateIiE4funcEv
1012+
// C32-DAG: declare dllimport void @_ZN36ExplicitlyImportInstantiatedTemplateIiE4funcEv
9941013
// PS-DAG: declare dllimport void @_ZN36ExplicitlyImportInstantiatedTemplateIiE4funcEv
9951014

9961015
// MS: A dll attribute propagates through multiple levels of instantiation.
@@ -1000,6 +1019,7 @@ struct __declspec(dllimport) BottomClass : public MiddleClass<int> { };
10001019
USEMEMFUNC(TopClass<int>, func)
10011020
// M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @"?func@?$TopClass@H@@QAEXXZ"
10021021
// G32-DAG: define linkonce_odr dso_local x86_thiscallcc void @_ZN8TopClassIiE4funcEv
1022+
// C32-DAG: define linkonce_odr dso_local void @_ZN8TopClassIiE4funcEv
10031023
// PS-DAG: declare dllimport void @_ZN8TopClassIiE4funcEv
10041024

10051025
template <typename T> struct ExplicitInstantiationDeclTemplateBase { void func() {} };
@@ -1009,6 +1029,7 @@ template struct ExplicitInstantiationDeclTemplateBase<int>;
10091029
USEMEMFUNC(ExplicitInstantiationDeclTemplateBase<int>, func)
10101030
// M32-DAG: declare dllimport x86_thiscallcc void @"?func@?$ExplicitInstantiationDeclTemplateBase@H@@QAEXXZ"
10111031
// G32-DAG: define weak_odr dso_local x86_thiscallcc void @_ZN37ExplicitInstantiationDeclTemplateBaseIiE4funcEv
1032+
// C32-DAG: define weak_odr dso_local void @_ZN37ExplicitInstantiationDeclTemplateBaseIiE4funcEv
10121033
// PS-DAG: declare dllimport void @_ZN37ExplicitInstantiationDeclTemplateBaseIiE4funcEv
10131034

10141035
template <typename T> struct ExplicitInstantiationDeclTemplateBase2 { void func() {} };
@@ -1018,6 +1039,7 @@ template struct __declspec(dllexport) ExplicitInstantiationDeclTemplateBase2<int
10181039
USEMEMFUNC(ExplicitInstantiationDeclTemplateBase2<int>, func)
10191040
// M32-DAG: declare dllimport x86_thiscallcc void @"?func@?$ExplicitInstantiationDeclTemplateBase2@H@@QAEXXZ"
10201041
// G32-DAG: define weak_odr dso_local x86_thiscallcc void @_ZN38ExplicitInstantiationDeclTemplateBase2IiE4funcEv
1042+
// C32-DAG: define weak_odr dso_local void @_ZN38ExplicitInstantiationDeclTemplateBase2IiE4funcEv
10211043
// PS-DAG: declare dllimport void @_ZN38ExplicitInstantiationDeclTemplateBase2IiE4funcEv
10221044

10231045
namespace pr39496 {

clang/test/CodeGenCXX/dso-local-executable.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// RUN: %clang_cc1 -triple x86_64-pc-linux -mrelocation-model static -O1 -disable-llvm-passes -emit-llvm %s -o - | FileCheck --check-prefix=STATIC %s
22
// RUN: %clang_cc1 -triple x86_64-pc-linux -mrelocation-model static -fno-plt -O1 -disable-llvm-passes -emit-llvm %s -o - | FileCheck --check-prefix=NOPLT %s
33
// RUN: %clang_cc1 -triple x86_64-w64-mingw32 -O1 -disable-llvm-passes -emit-llvm %s -o - | FileCheck --check-prefix=MINGW %s
4+
// RUN: %clang_cc1 -triple x86_64-pc-cygwin -O1 -disable-llvm-passes -emit-llvm %s -o - | FileCheck --check-prefix=MINGW %s
45

56
// STATIC-DAG: @_ZTV1C = linkonce_odr dso_local unnamed_addr constant
67
// STATIC-DAG: @_ZTS1C = linkonce_odr dso_local constant

0 commit comments

Comments
 (0)