]> granicus.if.org Git - clang/commit
[COFF, ARM64] Align global symbol by size for ARM64 MSVC ABI
authorTom Tan <Tom.Tan@microsoft.com>
Thu, 2 May 2019 00:38:14 +0000 (00:38 +0000)
committerTom Tan <Tom.Tan@microsoft.com>
Thu, 2 May 2019 00:38:14 +0000 (00:38 +0000)
commit7a72a8bc72710febe64ee092f919514f3de6cf88
tree123340c9a3ece56e5d5c99e9d8620b5d44671e8a
parentc9884fd36d9a452fad1edc440dbc2835340e1602
[COFF, ARM64] Align global symbol by size for ARM64 MSVC ABI

According to alignment section in below ARM64 ABI document, MSVC could increase
alignment of global data based on its total size. Clang doesn't do this. Compile
the same symbol into different alignments by Clang and MSVC could cause link
error because some instruction encodings, like 64-bit LDR/STR with immediate,
require the target to be 8 bytes aligned, and linker could choose code stream
with such LDR/STR instruction from MSVC and 4 bytes aligned data from Clang into
final image, which actually cannot be linked together
(see https://bugs.llvm.org/show_bug.cgi?id=41506 for more details).

https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=vs-2019#alignment

Differential Revision: https://reviews.llvm.org/D61225

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359744 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/TargetInfo.h
lib/AST/ASTContext.cpp
lib/Basic/Targets/AArch64.cpp
lib/Basic/Targets/AArch64.h
lib/Basic/Targets/NVPTX.cpp
test/CodeGen/arm64-microsoft-struct-align.cpp [new file with mode: 0644]