This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] PR ld/19617: Always create dynamic sections for -E/--dynamic-list
- From: Szabolcs Nagy <szabolcs dot nagy at arm dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>, <binutils at sourceware dot org>
- Cc: <nd at arm dot com>, Rich Felker <dalias at libc dot org>
- Date: Wed, 25 Jan 2017 15:03:10 +0000
- Subject: Re: [PATCH] PR ld/19617: Always create dynamic sections for -E/--dynamic-list
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Szabolcs dot Nagy at arm dot com;
- Nodisclaimer: True
- References: <20160217224138.GA31323@intel.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On 17/02/16 22:41, H.J. Lu wrote:
> In embedded environments, including boot loaders, the non-PIC executable
> needs to export its symbols to modules loaded in the future. We should
> always create dynamic sections for -E/--dynamic-list.
>
> Any comments?
>
> Thanks.
>
>
> H.J.
> --
> bfd/
>
> PR ld/19617
> * elflink.c (elf_link_add_object_symbols): Always create dynamic
> sections for -E/--dynamic-list.
>
since this commit
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bf89386a862ace008f0152bca8bddf996d3993c8
static linking with --dynamic-list adds a nonsense
dynamic-loader to the executable e.g.
echo 'int main(){}' >a.c
echo '{main;};' >foo.list
gcc -static -Wl,--dynamic-list=foo.list a.c
readelf -l a.out |grep interpreter
[Requesting program interpreter: /lib/ld64.so.1]
i don't think --dynamic-list should imply dynamic section
(--export-dynamic is not specified) and even if there is
a dynamic section, why is there a loader? (static linked
binary may be able to relocate itself)
this broke static linking of gdb which always adds
--dynamic-list to the link command line.
i opened
https://sourceware.org/bugzilla/show_bug.cgi?id=21086