This is the mail archive of the binutils@sourceware.org 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: Creating arbitrary dynamic tags with BFD ld


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


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