[PATCH] D30365: ELF ICF: Merge only functions.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 26 14:22:12 PST 2017


On Sun, Feb 26, 2017 at 12:33 PM, Rafael Avila de Espindola <
rafael.espindola at gmail.com> wrote:

> Rui Ueyama via Phabricator via llvm-commits
> <llvm-commits at lists.llvm.org> writes:
>
> > ruiu created this revision.
> >
> > Previously, LLD merged all read-only sections. So the following
> > program prints out "true" if -icf=all is specified.
> >
> >   static const int foo = 1;
> >   static const int bar = 1;
> >   int main() { printf("%s\n", &foo == &bar ? "true" : "false"); }
> >
> > This is somewhat counter-intuitive, and it actually caused nasty issues.
> > One example is https://bugs.chromium.org/p/chromium/issues/detail?id=
> 682773#c24.
> >
> > This patch changes the way how it works. Now ICF merges only functions
> > (i.e. executable sections).
>
> So, I would like to still have a way to merge all constants. It doesn't
> have to be the dafault.
>

We can define this as -icf=everything or something (as opposed to the
current -icf=all), but do you want that now?

The above example would still show a bug if you were comparing the address
> of two
> functions. The issue is that we have to figure out an ELF extension to
> propagate unnamed_addr to the linker to do this properly.
>
> Cheers,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170226/e956beb0/attachment.html>


More information about the llvm-commits mailing list