I am writing firmware for an ARM platform in which I want to have the main bootloader relocatable in memory rather than always loaded at a fixed address during boot. This means that I need a relocatable format stored in Flash, like ELF.
If ELF is used then I need an ELF loader stored in the ROM code that first gets execution after reset. While this is okay, I also need that same relocation code in the bootloader .. so I will have a lot of code duplication and loss of Flash space if. My intent for the ROM is to just load the bootloader from Flash, so it really is going to be very simple.
I toyed around with creating simple ROM stub that jumped into the text section of the stored ELF image (linked at the address it is stored at in Flash). While this sort of works, I think it might be overkill for my intent.
tl;dr: All I want/need is a relocatable format to store my binary in Flash. Are there other options that are perhaps simpler than ELF that retain relocation tables?