This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Load addresses for ELF program headers on ARM


Ok, that makes sense.  So if I really do want to create one blob which
will then perform its own relocations, it looks like I need to just
put both of those sections into a single program header.  It seems
like I ought to be able to do that with the following script:

SECTIONS
{
  TEXT 0 : { *(.init) *(.fini) *(.text) *(.init_array) *(.fini_array)
*(.jcr)} :main
  DATA 0x10000000 : AT( ADDR( TEXT ) + SIZEOF( TEXT ) ) { *(.data) } :main
}

PHDRS
{
  main PT_LOAD;
}

However, when I do this, it creates one gigantic segment which has
both sections at their relocation addresses, and zero-fills the 200MB
or so in between them.  It seems like the linker is not correctly
respecting load addresses when it tries to fit sections into segments.
 Is that something that can be gotten around somehow?

Thanks,
Matt

On Sun, Oct 10, 2010 at 8:55 PM, Alan Modra <amodra@gmail.com> wrote:
> On Sun, Oct 10, 2010 at 07:46:58PM -0500, Matt Fischer wrote:
>> The linker created two program headers, one for TEXT, and one for
>> DATA. ?The TEXT one looks fine--both vaddr and paddr are at 0. ?The
>> DATA segment, however, has a problem. ?It's been given a vaddr of
>> 0x10000000, and a paddr of 0x000000b4. ?The former is the section's
>> relocation address, and the latter is its load address. ?However, the
>> ARM spec for ELF states that segments should have vaddr set to their
>> load address, and paddr set to 0.
>
> Which ARM ELF spec are you talking about? ?An old and buggy one, I'd
> guess. ?If the one you're looking at says that it is clearly in
> conflict with the parent SysV ELF ABI spec. ?This spec
> http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044b/IHI0044B_aaelf.pdf
> is silent on p_vaddr and p_paddr.
>
> --
> Alan Modra
> Australia Development Lab, IBM
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]