I need to compile a piece of code, called program A, and obtain the ELF file with the physical addresses given by the linker.
Then, I need to compile program B and inject its code into program A which I cannot recompile, since I would lose information regarding the addresses of program A.
Right now, I have an empty section on program A where I'm trying to copy program B to. I'm trying to use the GNU objcopy
utility to update the empty section using the --update-section
flag but so far I've not been successful.
In short, I'm trying to compile a code which requires information about its own memory disposition (where variables and functions are in memory).