<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 22, 2017 at 6:14 AM, 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">Sean Silva <<a href="mailto:chisophugis@gmail.com">chisophugis@gmail.com</a>> writes:<br>
>> When __libc_start_main is hidden, it doesn't end up in the dynamic symbol<br>
>> table and so we use the default DynsymIndex of 0.<br>
>><br>
><br>
><br>
> I think BFD is doing the right thing. The `extern_weak hidden` is resolved<br>
> to null since by virtue of being hidden it doesn't refer to the function in<br>
> libc.so (and there is no definition in the executable). For some reason,<br>
> LLD thinks that it needs to resolve __libc_start_main dynamically and<br>
> things go horribly wrong. Rafael, what do you think?<br>
<br>
</span>If it is hidden it should really not end up in the dynamic symbol<br>
table. I will try to take a look at your reproducible latter in the day.<br></blockquote><div><br></div><div><br></div><div>FWIW, gold issues an error:</div><div><br></div><div>/usr/bin/ld.gold: error: hidden symbol '__libc_start_main' is not defined locally</div><div>/usr/bin/ld.gold: error: hidden symbol '__libc_start_main' is not defined locally</div><div><br></div><div>In theory `extern_weak hidden` could still fail to have a local definition and then it would resolve to 0 due to being weak, which is what BFD does. But `extern_weak hidden` is still pretty questionable. E.g. in the original case that Carlo ran into, this was not the expected behavior (and this error may have saved him some time actually).</div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Cheers,<br>
Rafael<br>
</blockquote></div><br></div></div>