embed memory region information into an elf file

Nick Clifton nickc@redhat.com
Wed Apr 1 13:33:22 GMT 2020


Hi Massimiliano,

> Is there any magic argument of ld, or some plugin, that allows to
> embed the information of memory regions (usually present in the linker
> script) into the elf file?

In short: "no". :-(

> This way I could get the information I need (name, base address and
> size) directly from the elf, and I would no longer need to have the
> linker script (and parse it).

But you can add extra data into ELF files.  For example objcopy has an
--add-section option which could be used to insert a section containing
the required data.  (You would have to decide on the format of the data
and create a file containing the necessary information, but this should
not be too hard).

Cheers
  Nick





More information about the Binutils mailing list