[PATCH] D41037: Create reserved symbols early so they can be versioned

Dimitry Andric via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 10 14:53:00 PST 2017


On 10 Dec 2017, at 21:20, Rafael Avila de Espindola <rafael.espindola at gmail.com> wrote:
> 
> Dimitry Andric via Phabricator <reviews at reviews.llvm.org> writes:
> 
>> dim added a comment.
>> 
>> When I patch lld trunk https://reviews.llvm.org/rL320307 with this, executables linked by it make readelf (from binutils 2.28) produce a warning:
>> 
>>  readelf: Warning: [10]: Info field (0) should index a relocatable section.
> 
> I sent a patch for this as it happens without this patch.

Thanks, I had not noticed that this occurred before. :)


>> And I still don't see any `_end` symbol in the executable.
> 
> What executable? _end is only created when it is used. Do you have a
> case where it is not created but should have been? If so that is very
> likely an independent bug as this change only makes it possible to
> version it when it is already being created.

This was with a simple sbrk() test program, but it would also happen
with "hello world".  I failed to notice that these linked against
/lib/libc.so.7, which was still built with a bad lld, so it didn't have
any references to _end:

$ readelf -aW /lib/libc.so.7 | grep -w _end
<nothing>

Re-linking libc.so.7 with the fixed lld, it started showing those
references:

$ readelf -aW /usr/obj/usr/src/amd64.amd64/lib/libc/libc.so.7 | grep -w _end
00000000001cd4a0  0000006900000001 R_X86_64_64            0000000000405e59 _end@@FBSDprivate_1.0 + 0
00000000001cd4a8  0000006900000001 R_X86_64_64            0000000000405e59 _end@@FBSDprivate_1.0 + 0
   105: 0000000000405e59     0 NOTYPE  GLOBAL DEFAULT   26 _end@@FBSDprivate_1.0
  3159: 0000000000405e59     0 NOTYPE  GLOBAL DEFAULT   26 _end

And any executables linked against that version of libc.so.7 did end up
with correct _end entries:

$ readelf -aW helloworld | grep -w _end
readelf: Warning: [10]: Info field (0) should index a relocatable section.
     8: 0000000000204008     0 NOTYPE  GLOBAL DEFAULT   23 _end
    35: 0000000000204008     0 NOTYPE  GLOBAL DEFAULT   23 _end

So at least the issue with those reserved symbols seems to be solved.
Ed and I also would like to backport this to our 5.0 version, once it is
in.

-Dimitry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 223 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171210/3dd9596b/attachment.sig>


More information about the llvm-commits mailing list