[PATCH] D124654: [AIX] Handling the label alignment of a global variable with its multiple aliases.

Esme Yi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 28 20:58:07 PDT 2022


Esme created this revision.
Esme added reviewers: jsji, shchenz, DiggerLin, sfertile, jhenderson, PowerPC.
Herald added subscribers: jeroen.dobbelaere, kbarton, hiraditya, nemanjai.
Herald added a project: All.
Esme requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch handles the case where a variable has multiple aliases.
AIX's assembly directive `.set` is not usable for aliasing purpose, and using different labels allows AIX to emulate symbol aliases. If there is data or linkage emitted between any two labels, meaning they are not aligned, XCOFF will automatically calculate offset for them.

This patch implements:

1. Labels of global variables and aliases are aligned by their offsets.

2. We didn't emit aliasing label for common and zero-initialized local symbols in PPCAIXAsmPrinter::emitGlobalVariableHelper, but emit linkage for them in AsmPrinter::emitGlobalAlias, which caused a FAILURE.

This patch fixes the bug by blocking emitting linkage for the alias without label.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124654

Files:
  llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
  llvm/test/CodeGen/PowerPC/aix-alias-merge.ll
  llvm/test/CodeGen/PowerPC/aix-alias.ll
  llvm/test/CodeGen/PowerPC/aix-tls-xcoff-variables.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124654.425958.patch
Type: text/x-patch
Size: 16172 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220429/dd3fe2f6/attachment.bin>


More information about the llvm-commits mailing list