This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR ld/19617: Always create dynamic sections for -E/--dynamic-list

On Wed, Jan 25, 2017 at 03:03:10PM +0000, Szabolcs Nagy wrote:
> 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
> 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/]
> 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

It makes sense for -E/-rdynamic to produce a dynamic section, but
unless an explicit --dynamic-linker was passed, it should default to

It does not make sense for --dynamic-list to produce a dynamic
section. Semantically --dynamic-list is just a list of symbols not to
leave interposable, but when static linking nothing is interposable


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]