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 emitted between any two labels, meaning they are not aligned, XCOFF will automatically calculate the offset for them.
This patch implements:
- Emits the label of the alias just before emitting the value of the sub-element that the alias referred to.
- A set of aliases that refers to the same offset should be aligned.
- We didn't emit aliasing labels for common and zero-initialized local symbols in PPCAIXAsmPrinter::emitGlobalVariableHelper, but emitted linkage for them in AsmPrinter::emitGlobalAlias, which caused a FAILURE. This patch fixes the bug by blocking emitting linkage for the alias without a label.
No idea why my comments here is lost in my last post. I will re-post it.
I tested some array and vector cases, I think current patch may not be able to handle them well on AIX. Could you please verify? As you are also handling array here, so do we plan to fix them all? Or we just want to fix ConstantStruct type?
case 1: vector type, ConstantDataSequential
case 2: array type, ConstantDataSequential:
case 3: array type, ConstantArray: