public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* objcopy, --change-section-lma ?
@ 2006-06-10 20:25 Torsten Mohr
  2006-06-12 12:57 ` Nick Clifton
  0 siblings, 1 reply; 2+ messages in thread
From: Torsten Mohr @ 2006-06-10 20:25 UTC (permalink / raw)
  To: binutils

Hi,

to my understanding in a section header entry there are 10 values
of 32 bit each.  One reflects the VMA (SH_ADDR), but none reflects
the LMA.

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?

Are other sections affected implicitly?

Or does objcopy add another program header if necessary?
  If it does that, how is a section linked to a program header?


It would be great if anybody could give me a hint on this.


Best regards,
Torsten.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: objcopy, --change-section-lma ?
  2006-06-10 20:25 objcopy, --change-section-lma ? Torsten Mohr
@ 2006-06-12 12:57 ` Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2006-06-12 12:57 UTC (permalink / raw)
  To: Torsten Mohr; +Cc: binutils

Hi Torsten,

   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 
assumptions first:

> 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 
problems.

> Are other sections affected implicitly?

No, only the section(s) specified on the objcopy command line should be 
adjusted.

> Or does objcopy add another program header if necessary?

Yes.

> 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.

Cheers
   Nick

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-06-12 11:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-10 20:25 objcopy, --change-section-lma ? Torsten Mohr
2006-06-12 12:57 ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).