This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
objcopy with automatic adjusting sections feature
- From: Piotr Piwko <piotr dot piwko at embedded-engineering dot pl>
- To: binutils at sourceware dot org
- Date: Tue, 19 Oct 2010 17:56:58 +0200
- Subject: objcopy with automatic adjusting sections feature
Hello,
I have a question related objcopy tool. I have the ELF object file
'object', and I want to update the data of one section (assume
'.mysec'). Is there any possibility to re-compute start, VMA and LMA
addresses of all sections which are placed below '.mysec'? Now, I do
it manually in this way:
Assume that I have this kind of memory map:
25 .mysec 001eef40 80b9b000 80b9b000 003ab000 2**0
CONTENTS, ALLOC, LOAD, READONLY, DATA
26 .machvec.init 00000088 80d89f40 80d89f40 00599f40 2**2
CONTENTS, ALLOC, LOAD, DATA
27 .bss 000240dc 80d8a000 80d8a000 00599fc8 2**5
ALLOC
Remove the current section:
objcopy object -R .mysec
Add new section and fill it with data of mysec_data file
objcopy object --add-section .mysec=mysec_data
Change the section flags
objcopy object --set-section flags .mysec=contents,alloc,load,readonly,data
Set a new VMA and LMA values
objcopy vmlinux --change-section-vma .mysec=0x80b9b000
And then I change the addresses of .machvec.init and .bss sections to
fit the new memory arrangement.
Do you know any tips of hints to do it automatically instead of
annoying computing and changing it step by step?
Thank you in advance for you engagement in this issue.
--
Piotr Piwko
http://www.embedded-engineering.pl/