[PATCH] D56466: [CodeGen] Clarify comment about COFF common symbol alignment

Shoaib Meenai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 8 16:47:30 PST 2019


smeenai created this revision.
smeenai added reviewers: erichkeane, majnemer, mstorsjo.

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.


Repository:
  rC Clang

https://reviews.llvm.org/D56466

Files:
  lib/CodeGen/CodeGenModule.cpp


Index: lib/CodeGen/CodeGenModule.cpp
===================================================================
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -3761,8 +3761,11 @@
       }
     }
   }
-  // COFF doesn't support alignments greater than 32, so these cannot be
-  // in common.
+
+  // MSVC doesn't support alignments greater than 32 for common symbols, so
+  // symbols with greater alignment requirements cannot be common. Non-MSVC COFF
+  // environments support arbitrary power-of-two alignments for common symbols
+  // via the aligncomm directive, so the restriction doesn't apply there.
   if (Context.getTargetInfo().getTriple().isKnownWindowsMSVCEnvironment() &&
       Context.getTypeAlignIfKnown(D->getType()) > 32)
     return true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56466.180769.patch
Type: text/x-patch
Size: 775 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190109/57a0f5cb/attachment-0001.bin>


More information about the cfe-commits mailing list