This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
change a "const int" in an ELF file
- From: Torsten Mohr <tmohr at s dot netic dot de>
- To: binutils <binutils at sources dot redhat dot com>
- Date: Sun, 16 Feb 2003 20:57:47 +0100
- Subject: change a "const int" in an ELF file
Hi,
i work on software for embedded systems for a NEC V850.
Is there a way to change the value of a "const int" in
a certain section in an ELF file to a different value?
As an example, if there's at compile time:
const int __attribute__((special_section)) a_value = 0x12345678;
After the final ELF file is linked together, i'd like to change
the value of "a_value" to a different value.
With "v850-unknown-elf-readelf -s ELF-File | grep a_value" i can
get the address of the value, but how can i access that address
in the ELF-File?
Does anybody know of a way on how to do this?
Best regards,
Torsten.
Background:
Our customer wants us to do a "ROM check".
The source code is compiled, the object files are linked
to an ELF file and from that ELF file an S-Record is
generated which can be flashed into the controller.
I wrote a perl script reads parts of that ELF file,
generates a check sum and then writes that checksum back
to a certain address. This works, but it is really slow.