fix memory regions with displaced BSS data
Nathan Sidwell
nathan@codesourcery.com
Wed May 20 10:33:00 GMT 2009
This patch fixes a problem with memory regions and bss-like sections. consider
the following linker script:
SECTIONS {
.text : { *(.text) } >ram AT>rom
.data : { *(.data) } >ram
.bss : { *(.bss) } >ram
.trail : { LONG(5) } >ram
Here, we're storing an initial image in ROM, intending to copy it to RAM in
startup code. Clearly we don't want an image of the bss section in ROM, and the
.bss section does not cause the advancement of the allocation point (the LMA).
So .trail ends up with an LMA just after .data. This coincides with .bss, and
so the overlap checking code issues an error message. A real script may have
multiple data/bss-like tuples for different physical RAMs.
Notice that the overlap checking code checks LMAs because:
/* We must check the sections' LMA addresses not their VMA
addresses because overlay sections can have overlapping VMAs
but they must have distinct LMAs. */
which is fine for overlays, but breaks this usage. the attached patch relaxes
the check slightly further by only checking LOAD sections, rather than (nearly)
all ALLOC sections.
Ideally we'd do two checks, one on LMAs, for LOAD sections and one on VMAs
skipping overlay sections. Unfortunately, AFAICT, we don't know at this point
what sections are overlay sections -- that information is in the linker script
statement tree, not the output section list.
built and tested for i686-elf, ok?
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: all.diff
URL: <https://sourceware.org/pipermail/binutils/attachments/20090520/e22a345f/attachment.ksh>
More information about the Binutils
mailing list