[PATCH] PR18757: Copy attributes to static extern "C" aliases

Reid Kleckner rnk at google.com
Wed Feb 12 17:22:01 PST 2014


I tried to apply this with a test case that doesn't run the optimizer, and
discovered something scary.  GlobalAlias inherits from GlobalValue and
therefore has a section, but the LangRef doesn't document this and we don't
know how to serialize and deserialize it.

So, if we applied this patch, the section on the alias would be dropped if
we did LTO.  :(


On Thu, Feb 6, 2014 at 3:17 PM, Mark Mentovai <mark at chromium.org> wrote:

> LLVM r183756 changed how GlobalOpt handled aliases, exposing a latent bug
> in clang that caused attributes, such as __attribute__((section())) to not
> be honored in emitted code with this optimization. This optimization in
> question replaces an alias target with its sole alias, taking the name,
> linkage, and attributes of the alias. clang creates aliases for certain
> extern "C" values, setting the linkage of the alias correctly, but ignoring
> the attributes. This patch gives the aliases of such extern "C" values the
> same attributes as their targets, so that when GlobalOpt is performed, the
> correct attributes are used.
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140212/0ea19df0/attachment.html>


More information about the cfe-commits mailing list