[clang] [llvm] Global string alignment (PR #142346)
Ulrich Weigand via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 6 07:41:59 PDT 2025
uweigand wrote:
> The clang patch was written the way it was because it was necessary to comply with the ABI rules. Strings passed to printf don't have any sort of alignment requirement, so you can't really appeal to the ABI rules here, I think?
Just to be clear, the ABI requirement is that every symbol has to be at least 2-byte aligned. The problem is not passing the address of the string to printf, the problem is loading that address into a register in the first place. The most efficient way to load an address uses a PC-relative load address instruction, and this requires that the target symbol is 2-byte aligned.
https://github.com/llvm/llvm-project/pull/142346
More information about the llvm-commits
mailing list