PATCH: Mark symbol in executables if it matches dynamic_list

H.J. Lu hjl.tools@gmail.com
Thu Feb 6 17:49:00 GMT 2014


On Wed, Jan 29, 2014 at 2:35 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Nov 7, 2011 at 9:35 PM, Alan Modra <amodra@gmail.com> wrote:
>> On Mon, Nov 07, 2011 at 09:50:26PM +0100, Octoploid wrote:
>>> On Mon, Nov 7, 2011 at 9:13 PM, Ian Lance Taylor <iant@google.com> wrote:
>>> > I'll note that this was recently fixed in gold.  If --export-dynamic is
>>> > passed to the linker, I think we should not garbage collect globally
>>> > visible functions.
>>
>> Try this.
>>
>>         * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Mark syms in
>>         executables when export_dynamic.
>>
>> Index: bfd/elflink.c
>> ===================================================================
>> RCS file: /cvs/src/src/bfd/elflink.c,v
>> retrieving revision 1.428
>> diff -u -p -r1.428 elflink.c
>> --- bfd/elflink.c       19 Oct 2011 07:17:19 -0000      1.428
>> +++ bfd/elflink.c       8 Nov 2011 05:31:11 -0000
>> @@ -11947,7 +11947,7 @@ bfd_elf_gc_mark_dynamic_ref_symbol (stru
>>    if ((h->root.type == bfd_link_hash_defined
>>         || h->root.type == bfd_link_hash_defweak)
>>        && (h->ref_dynamic
>> -         || (!info->executable
>> +         || ((!info->executable || info->export_dynamic)
>>               && h->def_regular
>>               && ELF_ST_VISIBILITY (h->other) != STV_INTERNAL
>>               && ELF_ST_VISIBILITY (h->other) != STV_HIDDEN
>>
>>
>

We failed to handle --dynamic-list here.  This patch fixes it.
OK to install?

Thanks.

-- 
H.J.
----
bfd/

PR gold/16530
* elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Mark symbol in
executables if it matches dynamic_list.

ld/testsuite/

PR gold/16530
* ld-elf/dynamic-1.c: New file.
* ld-elf/dynamic-1.rd: Likewise.
* ld-elf/dynamic-1.syms: Likewise.

* ld-elf/shared.exp (build_tests): Add dynamic-1.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Mark-symbol-in-executables-if-it-matches-dynamic_lis.patch
Type: text/x-patch
Size: 4241 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20140206/3059293f/attachment.bin>


More information about the Binutils mailing list