This is the mail archive of the
mailing list for the binutils project.
Re: objcopy, --change-section-lma ?
- From: Nick Clifton <nickc at redhat dot com>
- To: Torsten Mohr <tmohr at s dot netic dot de>
- Cc: binutils at sourceware dot org
- Date: Mon, 12 Jun 2006 12:45:03 +0100
- Subject: Re: objcopy, --change-section-lma ?
- References: <firstname.lastname@example.org>
When dealing with this sort of question it is important to be
specific about what is being discussed, so let me point out a few minor
to my understanding in a section header entry there are 10 values
of 32 bit each.
For 32 bit files. For 64 bit files the values are 64 bit.
One reflects the VMA (SH_ADDR), but none reflectsthe LMA.
In the ELF file format. Other file formats can be supported by objcopy
and they may or may not have such a field.
I wondered how objcopy can change a sections LMA then and found out that
it changes one of the program headers.
I now wonder how it is ensured that this does not contradict to the
LMA of other sections?
When processing the modified executable prior to writing it out objcopy
(via the BFD library) should check for conflicting LMAs and report any
Are other sections affected implicitly?
No, only the section(s) specified on the objcopy command line should be
Or does objcopy add another program header if necessary?
If it does that, how is a section linked to a program header?
They are not. An ELF file can have either program headers or section
headers or both. If it has both then there is an assumed mapping
between the sh_addr fields of the section headers and the (p_vaddr +
p_memsz) address range of the program headers. Corrupt ELF files may
not conform to this assumption. It is intended that a program loader
can ignore any section headers in an ELF file entirely and instead just
use the program headers.