diff options
author | Erich Keane <erich.keane@intel.com> | 2019-01-08 18:44:22 +0000 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2019-01-08 18:44:22 +0000 |
commit | 85c622497190a445947c8bf09d4e18a295f134c5 (patch) | |
tree | 50efee2cef4e866042caa2ce19422c4a3f52cf0b /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 6ccc173b97232a5f685b0b01d916792834feba9e (diff) | |
download | bcm5719-llvm-85c622497190a445947c8bf09d4e18a295f134c5.tar.gz bcm5719-llvm-85c622497190a445947c8bf09d4e18a295f134c5.zip |
Limit COFF 'common' emission to <=32 alignment types.
As reported in PR33035, LLVM crashes if given a common object with an
alignment of greater than 32 bits. This is because the COFF file format
does not support these alignments, so emitting them is broken anyway.
This patch changes any global definitions greater than 32 bit alignment
to no longer be in 'common'.
https://bugs.llvm.org/show_bug.cgi?id=33035
Differential Revision: https://reviews.llvm.org/D56391
Change-Id: I48609289753b7f3b58c5e2bc1712756750fbd45a
llvm-svn: 350643
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 54190493f04..ab0ac67d8e8 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -3761,6 +3761,11 @@ static bool isVarDeclStrongDefinition(const ASTContext &Context, } } } + // COFF doesn't support alignments greater than 32, so these cannot be + // in common. + if (Context.getTargetInfo().getTriple().isKnownWindowsMSVCEnvironment() && + Context.getTypeAlignIfKnown(D->getType()) > 32) + return true; return false; } |