r217897 - Don't try to use C5/D5 comdats in COFF.
Rafael Espindola
rafael.espindola at gmail.com
Tue Sep 16 13:19:43 PDT 2014
Author: rafael
Date: Tue Sep 16 15:19:43 2014
New Revision: 217897
URL: http://llvm.org/viewvc/llvm-project?rev=217897&view=rev
Log:
Don't try to use C5/D5 comdats in COFF.
This should fix the mingw bootstrap.
Modified:
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/test/CodeGenCXX/ctor-dtor-alias.cpp
Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=217897&r1=217896&r2=217897&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Tue Sep 16 15:19:43 2014
@@ -3029,8 +3029,12 @@ static StructorCodegen getCodegenToUse(C
if (!llvm::GlobalAlias::isValidLinkage(Linkage))
return StructorCodegen::RAUW;
- if (llvm::GlobalValue::isWeakForLinker(Linkage))
- return StructorCodegen::COMDAT;
+ if (llvm::GlobalValue::isWeakForLinker(Linkage)) {
+ // Only ELF supports COMDATs with arbitrary names (C5/D5).
+ if (CGM.getTarget().getTriple().isOSBinFormatELF())
+ return StructorCodegen::COMDAT;
+ return StructorCodegen::Emit;
+ }
return StructorCodegen::Alias;
}
Modified: cfe/trunk/test/CodeGenCXX/ctor-dtor-alias.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/ctor-dtor-alias.cpp?rev=217897&r1=217896&r2=217897&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/ctor-dtor-alias.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/ctor-dtor-alias.cpp Tue Sep 16 15:19:43 2014
@@ -8,6 +8,8 @@
// RUN: FileCheck --check-prefix=CHECK5 --input-file=%t %s
// RUN: FileCheck --check-prefix=CHECK6 --input-file=%t %s
+// RUN: %clang_cc1 %s -triple i686-pc-windows-gnu -emit-llvm -o - -mconstructor-aliases -O1 -disable-llvm-optzns | FileCheck --check-prefix=COFF %s
+
namespace test1 {
// Test that we produce the apropriate comdats when creating aliases to
// weak_odr constructors and destructors.
@@ -19,6 +21,9 @@ namespace test1 {
// CHECK1: define weak_odr void @_ZN5test16foobarIvED0Ev({{.*}} comdat $_ZN5test16foobarIvED5Ev
// CHECK1-NOT: comdat
+// COFF doesn't support comdats with arbitrary names (C5/D5).
+// COFF-NOT: comdat
+
template <typename T>
struct foobar {
foobar() {}
More information about the cfe-commits
mailing list