"AT > region" interpreted as "> region" in linker script

Galit Heller Galit.Heller@nsc.com
Sun Jan 4 13:43:00 GMT 2004


Hi Nick,

> Do you agree with this patch ?
> 
> Cheers
>         Nick
> 
> ld/ChangeLog
> 2004-01-02  Nick Clifton  <nickc@redhat.com>
> 
>         * ldlang.c (lang_get_regions): Add extra parameter 'have_vma'
>         which if true will prevent the LMA region being used as a
>         replacement for a default VMA region.
>         (lang_leave_output_section_statement): Pass extra parameter.
>         (lang_leave_overlay): Likewise.
>         * ld.texinfo (Output Section LMA): Document that the LMA
>         region can be set to the VMA region if no VMA has been set.

Yes, this fixes the issue. I acknowledge that if a virtual address isn't set
explicitly, then using the load region is a more logical choice than the
current location counter value.

While trying the patch, I noticed a similar problem (not caused by the patch).
The problem is similar in the sense that a virtual address setting is
"not taken into account" with relation to a memory region setting:

The following scenario results in the error message:
ld-new: section .data [00000010 -> 0000001b] overlaps section .text [00000010 ->
000003a7]

MEMORY {
        ram         : ORIGIN = 0x10,     LENGTH = 0x1000
}

SECTIONS { .text 0x10 :  { *(.text) } 
           .data      :  { *(.data) } > ram
}

I.e. the second output section statement allocates the ram region from the
beginning, without taking into account that this area had already been
allocated to another output section.

Thanks,
Galit.



More information about the Binutils mailing list