[clang] [clang][LoongArch] Align global symbol by size (PR #101309)

Sergei Barannikov via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 31 09:37:40 PDT 2024


s-barannikov wrote:

> > > > This looks wrong. Preferred and ABI alignments should be set in ~Triple~. ADD: Sorry, I meant DataLayout, of course.
> > > 
> > > 
> > > Thanks for pointing this out. How does data layout affect the alignment of constant string global variable symbols?
> > 
> > 
> > They will be aligned to the preferred alignment specified as Y in the "-a:X:Y" part of the data layout, IIRC.
> 
> Thanks for the explanation. I understand that data layout can set default and preferred alignment for all globals. This patch chooses alignment based on the size of global objects. Can data layout do that?

You can specify ABI and preferred alignments for "first class" types, and separately for aggregates. It is all documented [here](https://llvm.org/docs/LangRef.html#data-layout).


https://github.com/llvm/llvm-project/pull/101309


More information about the cfe-commits mailing list