================
@@ -1687,7 +1687,8 @@ CharUnits ASTContext::getDeclAlign(const Decl *D, bool 
ForAlignof) const {
       if (VD->hasGlobalStorage() && !ForAlignof) {
         uint64_t TypeSize =
             !BaseT->isIncompleteType() ? getTypeSize(T.getTypePtr()) : 0;
-        Align = std::max(Align, getTargetInfo().getMinGlobalAlign(TypeSize));
+        Align = std::max(Align, getTargetInfo().getMinGlobalAlign(
+                                    TypeSize, VD->hasDefinition()));
----------------
uweigand wrote:

So the intent of the option is to 1) when emitting a symbol definition 
directly, keep using the 2-byte ABI alignment, but 2) when refering to a symbol 
that *might* be defined externally, do not make using any alignment assumption. 
 In GCC this is using the same checks used elsewhere to test where a symbol is 
guaranteed local or might be external (keeping in mind things like weak symbols 
or ELF overrides).

https://github.com/llvm/llvm-project/pull/73511
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to