cancel
Showing results for 
Search instead for 
Did you mean: 

is there a way to replace some hex values in .elf files?

Ashei.8
Associate II

Right now, i have generated a hex file using objcopy, added a crc etc to it.

Now, is there any way to add this hex information back to the original elf file? It would be nice to have it all packaged in one file back again.

3 REPLIES 3

The ELF object format is documented, you can work on it with the usual File IO functions.

If adding data into sections you might have to expand and re-render the object file. If you've left space or a place holder via linker, etc you can do a more simple substitution or patch of the data in-place.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
LMI2
Lead

I have heard that production programmer machines can put individual serial serial number into a hex data, but there must be a place for it. HEX file is a text file.

Typically you can specify an address, or use substitution on a string constant "*SERIAL*" or whatever. Objects provide for sections and symbols to locate things by name.

Traversing and modifying binary, object and hex files should be within the scope of a software engineer.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..