<div dir="ltr">Wouldn't it be better to somehow change how linker scripts are interpreted rather than breaking absolute symbol semantics?<div><br></div><div>Peter</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 27, 2016 at 7:44 AM, Eugene Leviant via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The problem is that such kind of bugs very quickly become "features" :)<br>
Here is the real use case:<br>
<br>
1) There is an undefined 'MySym' symbol in a shared library, which has GOT entry<br>
2) You link this shared library using this script:<br>
<br>
SECTIONS {<br>
   /* .... */<br>
   PROVIDE_HIDDEN(MySym = .);<br>
   /* ... */<br>
}<br>
<br>
After library is loaded MySym will have incorrect value, because it is<br>
actually an absolute symbol.<br>
I think every GOT entry should be relocated, shouldn't it?<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
2016-10-27 17:32 GMT+03:00 Rafael Espíndola <<a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>>:<br>
> On 27 October 2016 at 04:42, Eugene Leviant <<a href="mailto:evgeny.leviant@gmail.com">evgeny.leviant@gmail.com</a>> wrote:<br>
>>> The entry in the got should always contain 42, not 42 + load address, no?<br>
>><br>
>> Looks like it shouldn't. Just try running the same test case<br>
>> (abs-hidden.s) using ld.bfd and ld.gold.<br>
>> Interesting fact is that ld.bfd emits two relative relocs: one for<br>
>> .got and one for .text.<br>
><br>
> So, where are you seeing this being an issue? My argument is that it<br>
> looks like a bug in bfd/gold, no in lld.<br>
><br>
> Gold produces a relocation to set the got entry to 42 + load_address.<br>
> BFD does the same for the got, but also changes<br>
><br>
> .quad foo<br>
><br>
> to contain 42 + load_address at runtime. That really looks like a bug,<br>
> if in a single assembly file we have<br>
><br>
>         .quad foo<br>
>         foo=42<br>
><br>
> both gas and MC produce a file with no relocations and just the value<br>
> 42. Why should splitting the asm file in two change it?<br>
><br>
> Cheers,<br>
> Rafael<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">-- <div>Peter</div></div></div>
</div>