[PATCH] D51637: [AsmPrinter] GlobalAlias with non-zero size and public linkage ends up with wrong size, PR38794

Daphne Pfister via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 10 17:20:51 PDT 2018


daphnediane added a comment.

In https://reviews.llvm.org/D51637#1227528, @john.brawn wrote:

> It does make me wonder though if perhaps it would be better to explicitly distinguish at the IR level between alias as "this name is another name for that other thing", which we want for the alias variable attribute and so don't want to emit a size; and "this name refers to a subpart of that other thing", which we want for aliases generated by GlobalMerge and so do want to emit a size.


Was considering trying this using attributes, but it looks like while GlobalValues contain an AttributeSet, GlobalAliases do not. I wonder if the best fix would just allow any sized global alias to emit sizes and have clang change how it makes such aliases so that the external symbol is unsized possibly with a command line flag to allow the sizes to match. It's interesting that the gcc documentation only has alias listed as supporting functions and not variables. https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#Common-Variable-Attributes and https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html. Other attributes that are common have references back to function attributes in the variable attribute section.


Repository:
  rL LLVM

https://reviews.llvm.org/D51637





More information about the llvm-commits mailing list