Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 0e1cc48

Browse files
committedAug 31, 2017
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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312229 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 2c5db5c commit 0e1cc48

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed
 

‎lib/CodeGen/ItaniumCXXABI.cpp

+9-7
Original file line numberDiff line numberDiff line change
@@ -2998,13 +2998,15 @@ static llvm::GlobalVariable::LinkageTypes getTypeInfoLinkage(CodeGenModule &CGM,
29982998
if (RD->hasAttr<DLLImportAttr>() &&
29992999
ShouldUseExternalRTTIDescriptor(CGM, Ty))
30003000
return llvm::GlobalValue::ExternalLinkage;
3001-
// MinGW always uses LinkOnceODRLinkage for type info.
3002-
if (RD->isDynamicClass() &&
3003-
!CGM.getContext()
3004-
.getTargetInfo()
3005-
.getTriple()
3006-
.isWindowsGNUEnvironment())
3007-
return CGM.getVTableLinkage(RD);
3001+
if (RD->isDynamicClass()) {
3002+
llvm::GlobalValue::LinkageTypes LT = CGM.getVTableLinkage(RD);
3003+
// MinGW won't export the RTTI information when there is a key function.
3004+
// Make sure we emit our own copy instead of attempting to dllimport it.
3005+
if (RD->hasAttr<DLLImportAttr>() &&
3006+
llvm::GlobalValue::isAvailableExternallyLinkage(LT))
3007+
LT = llvm::GlobalValue::LinkOnceODRLinkage;
3008+
return LT;
3009+
}
30083010
}
30093011

30103012
return llvm::GlobalValue::LinkOnceODRLinkage;

‎test/CodeGenCXX/rtti-mingw64.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22
struct A { int a; };
33
struct B : virtual A { int b; };
44
B b;
5-
class C {
6-
virtual ~C();
7-
};
8-
C::~C() {}
95

10-
// CHECK: @_ZTI1C = linkonce_odr
116
// CHECK: @_ZTI1B = linkonce_odr constant { i8*, i8*, i32, i32, i8*, i64 }
127
// CHECK-SAME: i8* bitcast (i8** getelementptr inbounds (i8*, i8** @_ZTVN10__cxxabiv121__vmi_class_type_infoE, i64 2) to i8*),
138
// CHECK-SAME: i8* getelementptr inbounds ([3 x i8], [3 x i8]* @_ZTS1B, i32 0, i32 0),

0 commit comments

Comments
 (0)