[clang] [clang] Fix x86_64-windows-msvc over- and under-alignment (PR #196505)
Hans Wennborg via cfe-commits
cfe-commits at lists.llvm.org
Mon May 11 01:27:58 PDT 2026
================
@@ -1114,3 +1114,20 @@ TargetInfo::simplifyConstraint(StringRef Constraint,
}
return Result;
}
+
+unsigned clang::Microsoft64BitMinGlobalAlign(uint64_t TypeSize) {
+ // MSVC does size based alignment for arm64 based on alignment section in
+ // below document. Replicate that to keep alignment consistent with object
+ // files compiled by MSVC.
+ // https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions
+ // The same is done for x64, but not documented.
+
+ if (TypeSize >= 512) // TypeSize >= 64 bytes
+ return 128; // align type at least 16 bytes
+ if (TypeSize >= 64) // TypeSize >= 8 bytes
+ return 64; // align type at least 8 butes
----------------
zmodem wrote:
Thanks! Done.
https://github.com/llvm/llvm-project/pull/196505
More information about the cfe-commits
mailing list