Creating arbitrary dynamic tags with BFD ld
Alan Modra
amodra@gmail.com
Mon Sep 30 13:59:00 GMT 2019
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
More information about the Binutils
mailing list