[llvm] [PowerPC] Alignment of toc-data symbol should not be increased during optimizations (PR #94593)
Chen Zheng via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 6 19:51:18 PDT 2024
chenzheng1030 wrote:
> Why does AIX have this requirement? ppc64 ELFv2 ABI can increase the alignment without any issue.
IIUC, AIX has limited TOC region especially for small code model and TOC region is created by linker(i.e., compiler can not fully control the layout of the TOC entries), so to avoid wasting of TOC entries, guarding alignment of the TOC data symbols with normal toc entries is necessary.
```
int a;
int foo()
{
return a;
}
int b;
int main() {
return b + foo();
}
```
If a is a toc-data symbol and we change its alignment to 16 in the assembly ( 2^16 is the size of the TOC region for small code model), compiling the modified assembly will make AIX linker emit TOC overflow error.
https://github.com/llvm/llvm-project/pull/94593
More information about the llvm-commits
mailing list