r350754 - [CodeGen] Clarify comment about COFF common symbol alignment
Shoaib Meenai via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 9 12:05:16 PST 2019
Author: smeenai
Date: Wed Jan 9 12:05:16 2019
New Revision: 350754
URL: http://llvm.org/viewvc/llvm-project?rev=350754&view=rev
Log:
[CodeGen] Clarify comment about COFF common symbol alignment
After a discussion on the commit thread, it seems the 32 byte alignment
limitation is an MSVC toolchain artifact, not an inherent COFF
restriction. Clarify the comment accordingly, since saying COFF in the
comment but using isKnownWindowsMSVCEnvironment in the conditional is
confusing. Also add a newline before the comment, which is consistent
with the local style.
Differential Revision: https://reviews.llvm.org/D56466
Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=350754&r1=350753&r2=350754&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Wed Jan 9 12:05:16 2019
@@ -3761,8 +3761,12 @@ static bool isVarDeclStrongDefinition(co
}
}
}
- // COFF doesn't support alignments greater than 32, so these cannot be
- // in common.
+
+ // Microsoft's link.exe doesn't support alignments greater than 32 for common
+ // symbols, so symbols with greater alignment requirements cannot be common.
+ // Other COFF linkers (ld.bfd and LLD) support arbitrary power-of-two
+ // alignments for common symbols via the aligncomm directive, so this
+ // restriction only applies to MSVC environments.
if (Context.getTargetInfo().getTriple().isKnownWindowsMSVCEnvironment() &&
Context.getTypeAlignIfKnown(D->getType()) > 32)
return true;
More information about the cfe-commits
mailing list