diff options
author | Martin Storsjo <martin@martin.st> | 2017-08-31 09:46:27 +0000 |
---|---|---|
committer | Martin Storsjo <martin@martin.st> | 2017-08-31 09:46:27 +0000 |
commit | 0e1cc480682f4981cb4b18f43e98bd6bcf62a3ea (patch) | |
tree | 913b72aab53c078e24a5f9282beda927b30c50ad /lib/CodeGen/ItaniumCXXABI.cpp | |
parent | 2c5db5c3849cf368aa6a8e808ed7485c5b60f413 (diff) |
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
Diffstat (limited to 'lib/CodeGen/ItaniumCXXABI.cpp')
-rw-r--r-- | lib/CodeGen/ItaniumCXXABI.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/CodeGen/ItaniumCXXABI.cpp b/lib/CodeGen/ItaniumCXXABI.cpp index e07dbdd3ab..d78c032cec 100644 --- a/lib/CodeGen/ItaniumCXXABI.cpp +++ b/lib/CodeGen/ItaniumCXXABI.cpp @@ -2998,13 +2998,15 @@ static llvm::GlobalVariable::LinkageTypes getTypeInfoLinkage(CodeGenModule &CGM, 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; |