A quick question about elf file headers, I can't seem to find anything useful on how to add/change fields in the elf header. I'd like to be able to change the magic numbers and to add a build date to the header, and probably a few other things.
As I understand it the linker creates the header information, but I don't see anything in the LD script that refers to it (though i'm new to ld scripts).
I'm using gcc and building for ARM.
thanks!
Updates:
- ok maybe my first question should be: is it possible to create/edit the header file at link time?
I didn't finish the book but iirc Linkers and Loaders by John Levine had the gory details that you would need to be able to do this.
In Solaris you can use elfedit but I think you are really asking solutions for Linux. Linux Is Not UniX :P
I haven't done this in awhile, but can't you just append arbitrary data to an executable. If you always append fixed-size data it would be trivial to recover anything you append. Variable size wouldn't be much harder. Probably easier than messing w/ elf headers and potentially ruining you executables.