<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Feb 26, 2017 at 12:33 PM, Rafael Avila de Espindola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Rui Ueyama via Phabricator via llvm-commits<br>
<span class=""><<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> writes:<br>
<br>
> ruiu created this revision.<br>
><br>
> Previously, LLD merged all read-only sections. So the following<br>
> program prints out "true" if -icf=all is specified.<br>
><br>
>   static const int foo = 1;<br>
>   static const int bar = 1;<br>
>   int main() { printf("%s\n", &foo == &bar ? "true" : "false"); }<br>
><br>
> This is somewhat counter-intuitive, and it actually caused nasty issues.<br>
> One example is <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=682773#c24" rel="noreferrer" target="_blank">https://bugs.chromium.org/p/<wbr>chromium/issues/detail?id=<wbr>682773#c24</a>.<br>
><br>
> This patch changes the way how it works. Now ICF merges only functions<br>
> (i.e. executable sections).<br>
<br>
</span>So, I would like to still have a way to merge all constants. It doesn't<br>
have to be the dafault.<br></blockquote><div><br></div><div>We can define this as -icf=everything or something (as opposed to the current -icf=all), but do you want that now?</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The above example would still show a bug if you were comparing the address of two<br>
functions. The issue is that we have to figure out an ELF extension to<br>
propagate unnamed_addr to the linker to do this properly.<br>
<br>
Cheers,<br>
Rafael<br>
</blockquote></div><br></div></div>