This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Overlap error not generated for sections w/o content


Hi Alan,

On Mon, Jan 12, 2004 at  11:42:35 +1030 Alan Modra wrote:
> 
> On Sun, Jan 11, 2004 at 04:14:12PM +0200, Galit Heller wrote:
> > If the linker script is erroneously written, so that the .stack load
> > address is set to a value which overlaps that of another output section,
> > no error is generated, since the SEC_ALLOC flag isn't set for .stack. E.g.
> 
> I think that's a linker bug.  Clearly, addresses of SEC_ALLOC sections
> matter whether they are SEC_LOAD or not.  Hmm, looking at ChangeLog
> entries, I see Nick made some changes in this area back in 1999.
> http://sources.redhat.com/ml/binutils/1999-11/msg00137.html
> 
> Possibly the following is a better patch to fix the problem Nick found.
> Nick, how's your memory?
> 
>       * ldlang.c (IGNORE_SECTION): Don't ignore SEC_ALLOC && !SEC_LOAD
>       sections.  Do ignore SEC_NEVER_LOAD sections.
>       (lang_size_sections_1): Remove test made redundant with the above.

This patch is certainly beneficial, in that error is reported when e.g.
a .bss section causes overlap. Without the patch there is no indication of
this situation.

However, the case which originally triggered my question still stands:

when an output section is created via the statement:

.section_name : { . += 600; }

then .section_name does not have SEC_ALLOC flag set (and thus no overlap
error is reported for this section).

This could be considered unintuitive, since the only obvious reason for a
statement in which dot is incremented, and nothing else happens, would be
to allocate space for the specified output section. Since there isn't an
"ALLOC" output section type in the linker script syntax, the user cannot
indicate that this section should indeed be taken into account when
allocating memory and reporting overlap.

Thanks,
Galit.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]