r312229 - Revert r312224: "[ItaniumCXXABI] Always use linkonce_odr linkage for RTTI data on MinGW"
Martin Storsjo via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 31 02:46:27 PDT 2017
Author: mstorsjo
Date: Thu Aug 31 02:46:27 2017
New Revision: 312229
URL: http://llvm.org/viewvc/llvm-project?rev=312229&view=rev
Log:
Revert r312224: "[ItaniumCXXABI] Always use linkonce_odr linkage for RTTI data on MinGW"
Breaks on buildbot:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/4548/steps/test-check-all/logs/stdio
The test in CodeGenCXX/virt-dtor-key.cpp tests using %itanium_abi_triple;
on non-windows platforms, this resolves to the current platform triple
(where there was no behaviour change), while on windows, it resolves to
a mingw triple (where the behaviour was intentionally changed).
Modified:
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/test/CodeGenCXX/rtti-mingw64.cpp
Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=312229&r1=312228&r2=312229&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Thu Aug 31 02:46:27 2017
@@ -2998,13 +2998,15 @@ static llvm::GlobalVariable::LinkageType
if (RD->hasAttr<DLLImportAttr>() &&
ShouldUseExternalRTTIDescriptor(CGM, Ty))
return llvm::GlobalValue::ExternalLinkage;
- // MinGW always uses LinkOnceODRLinkage for type info.
- if (RD->isDynamicClass() &&
- !CGM.getContext()
- .getTargetInfo()
- .getTriple()
- .isWindowsGNUEnvironment())
- return CGM.getVTableLinkage(RD);
+ if (RD->isDynamicClass()) {
+ llvm::GlobalValue::LinkageTypes LT = CGM.getVTableLinkage(RD);
+ // MinGW won't export the RTTI information when there is a key function.
+ // Make sure we emit our own copy instead of attempting to dllimport it.
+ if (RD->hasAttr<DLLImportAttr>() &&
+ llvm::GlobalValue::isAvailableExternallyLinkage(LT))
+ LT = llvm::GlobalValue::LinkOnceODRLinkage;
+ return LT;
+ }
}
return llvm::GlobalValue::LinkOnceODRLinkage;
Modified: cfe/trunk/test/CodeGenCXX/rtti-mingw64.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/rtti-mingw64.cpp?rev=312229&r1=312228&r2=312229&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/rtti-mingw64.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/rtti-mingw64.cpp Thu Aug 31 02:46:27 2017
@@ -2,12 +2,7 @@
struct A { int a; };
struct B : virtual A { int b; };
B b;
-class C {
- virtual ~C();
-};
-C::~C() {}
-// CHECK: @_ZTI1C = linkonce_odr
// CHECK: @_ZTI1B = linkonce_odr constant { i8*, i8*, i32, i32, i8*, i64 }
// CHECK-SAME: i8* bitcast (i8** getelementptr inbounds (i8*, i8** @_ZTVN10__cxxabiv121__vmi_class_type_infoE, i64 2) to i8*),
// CHECK-SAME: i8* getelementptr inbounds ([3 x i8], [3 x i8]* @_ZTS1B, i32 0, i32 0),
More information about the cfe-commits
mailing list