Section X overlaps section Y problem.

Sergei Organov osv@topconrd.ru
Wed Jun 29 17:59:00 GMT 2005


Hello,

On embedded target, to copy at startup some data and/or code from ROM to
RAM at startup, I've been using the following technique that worked for
me for years. The last version of binutils where I know it works is
version 2.10.

The ld from binutils 2.16.1 (got from binutils-2_16-branch), however,
issues error message:

ld: section .vect_image [00822890 -> 0082479f] overlaps section .vect [00822890 -> 0082479f]

My linker command file contains the following:

  [...]
  .vect : AT(__vect_image) {
    *(.vect)
    . = ALIGN(16);
  } > VECT
  [...]
  .vect_image : {
    __vect_image = .;
    . += SIZEOF(.vect);
  } > ROM
  [...]

Please notice that LMA of .vect matches LMA of .vect_image.

Old ld version 2.10 creates the sections as follows:

Idx Name          Size      VMA       LMA       File off  Algn  Flags
  6 .vect         00001f10  00000000  00822890  00000114  2**0  CONTENTS, ALLOC, LOAD, READONLY, CODE
 13 .vect_image   00001f10  00822890  00822890  0018c2b4  2**0  CONTENTS

that apparently leads to ignoring of .vect_image for the purposes of
overlap checking due to absence of ALLOC flag.

New ld 2.16.1, on the other hand, creates the section .vect_image in a
different manner:

Idx Name          Size      VMA       LMA       File off  Algn  Flags
13  .vect_image   00001f10  00822890  00822890  000149d8  2**0  ALLOC

i.e., it sets ALLOC flag but makes the section to be of type NOBITS that
results in considering this section for overlap checking and leads to
the error message above as LMA addresses do match.

Now, what do I do about it? Is it ld 2.16.1 flaw or should I use some
other technique in my command file to achieve the goal?

-- 
Sergei.



More information about the Binutils mailing list