------- Additional Comments From nickc at redhat dot com  2008-02-22 11:29 
-------
Subject: Re:  New: Spurious "section xxx overlaps section yyy"

Hi Sergei,

> LD version 2.18.x produces bogus "section .xxx overlaps section .bss", while 
> LD
> version 2.16.1 works just fine.

Well the 2.18 linker is behaving as documented.  Specifically in the bit 
on the "Output Section LMA" in the manual:

   If neither AT nor AT> is specified for an allocatable section,
   the linker will set the LMA such that the difference between
   VMA and LMA for the section is the same as the preceding output
   section in the same region.

Since the .bss section does not have an AT or an AT> directive its LMA 
is set to 0x110, so that difference between its VMA (0x4110), as set by 
the "> RAM" directive, and its LMA is 0x4000, ie the same as the 
difference between the VMA and the LMA of the .data section.  (Try 
running the linker with the --no-check-sections option and then looking 
at the section headers to see this).

This is a change in the linker's behaviour that was made for the 2.18 
release.  There is even a mention of it in the NEWS file.

It does suggest a workaround for the problem:  Change the "> RAM" in the 
description of the .bss section to "AT> RAM".  ie:

    .bss : {
      . += 0x120;
    } AT> RAM

According to the manual this will set both the LMA and the VMA for the 
section, and you will end up with the same behaviour as the 2.16 linker. 
  (This change is backwards compatible, i.e. it will work with the 2.16 
linker as well).  Unfortunately there is a bug in the current linker 
sources such that the "AT> [region-name]" syntax is ignored unless there 
is  also an "> [region-name-2]" specified for the section, and the two 
regions are different.  I can see no good reason for this, and the 
behaviour certainly isn't documented, so I am planning to check in the 
uploaded patch to remove this restriction unless my regression testing 
shows up a problem.

Cheers
   Nick


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=5785

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to