public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "DeRosa, Anthony" <Anthony.DeRosa@edocorp.com>
To: <binutils@sourceware.org>
Subject: LMA XXX Overlaps Previous Sections When Using PHDRS
Date: Wed, 19 Dec 2007 22:19:00 -0000	[thread overview]
Message-ID: <3517CACAE247DD498B74D4B65A379E95270856@corpcboemb01.edocorp.com> (raw)

Hello,

I want to install the contents of an ELF file on a flash device, using
the LMA of the sections (or rather p_paddr of program header) in the ELF
as the addresses in flash.  The VMA and LMA will thus be different.  I
am using "PHDRS" in my linker script in order to specify where the
various sections should be installed on flash.  The problem I am seeing
is the following message:

$ i686-elf-gcc -o test.elf test.S -T link.ld -nostartfiles

/opt/cross-tools/binutils-2.17-gcc-4.1.1-newlib-1.14.0/lib/gcc/i686-elf/
4.1.1/../../../../i686-elf/bin/ld: test.elf: section .section_0 lma
0x1000 overlaps previous sections

/opt/cross-tools/binutils-2.17-gcc-4.1.1-newlib-1.14.0/lib/gcc/i686-elf/
4.1.1/../../../../i686-elf/bin/ld: test.elf: section .section_1 lma
0x1020 overlaps previous sections


Is this a warning, an error, or neither?  Why does it say "lma 0x1000"?
I thought the VMA was 0x1000, and the LMA is 0x4000.

Here is the example code and a contrived linker script.

------------------------------------------------------------------------
----
-- code
------------------------------------------------------------------------
----

.global _start

.section .text_0, "ax"
_start:
    jmp foo

.section .text_1, "ax"
foo:
    jmp foo

------------------------------------------------------------------------
----
-- linker script
------------------------------------------------------------------------
----

ENTRY (_start)

MEMORY 
{
    ram_0 : ORIGIN = 0x00001000, LENGTH = 32
    ram_1 : ORIGIN = 0x00001020, LENGTH = 32
}

PHDRS
{
    phdr_0 PT_LOAD AT (0x4000);
    phdr_1 PT_LOAD AT (0x5000);
}


SECTIONS
{

    .section_0 :
    { 
        *(.text)
        *(.data)
        *(.bss)
        *(.text_0) 

    } >ram_0 : phdr_0

    .section_1 :
    {
        *(.text_1) 
    } >ram_1 : phdr_1
    
}


             reply	other threads:[~2007-12-19 22:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-19 22:19 DeRosa, Anthony [this message]
2007-12-24 17:21 ` Nick Clifton
2007-12-25 23:09   ` Alan Modra
2007-12-26 19:02     ` Nick Clifton
2007-12-26 21:40       ` Alan Modra
  -- strict thread matches above, loose matches on Subject: below --
2007-12-19 22:15 DeRosa, Anthony

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3517CACAE247DD498B74D4B65A379E95270856@corpcboemb01.edocorp.com \
    --to=anthony.derosa@edocorp.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).