This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Creating arbitrary dynamic tags with BFD ld
- From: Alan Modra <amodra at gmail dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: binutils at sourceware dot org
- Date: Mon, 30 Sep 2019 23:29:36 +0930
- Subject: Re: Creating arbitrary dynamic tags with BFD ld
- References: <87blv23s8c.fsf@oldenburg2.str.redhat.com>
On Mon, Sep 30, 2019 at 02:04:35PM +0200, Florian Weimer wrote:
> Can BFD ld create arbitrary dynamic tags (with purely numeric arguments)
> even if it knows nothing about them?
Yes, if you are willing to edit linker scripts.
Inserting *special_dyn.o(.data) into the normal .dynamic like this:
.dynamic : { *special_dyn.o(.dynamic) *(.dynamic) }
will place whatever you put in special_dyn.o .dynamic section at the
start of .dynamic. Here's an example special_dyn.s.
.section .dynamic,"a",%6
.dc.a 0x7ffffffe
.dc.a 0x12345678
You can't put your extra tags at the end of the usual ld supplied ones
because ld will always add at least one DT_NULL which usually
terminates the section.
--
Alan Modra
Australia Development Lab, IBM