This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Overlap error not generated for sections w/o content
- From: "Galit Heller" <Galit dot Heller at nsc dot com>
- To: "Alan Modra" <amodra at bigpond dot net dot au>
- Cc: binutils at sources dot redhat dot com,"Nick Clifton" <nickc at redhat dot com>
- Date: Mon, 12 Jan 2004 11:37:06 +0200
- Subject: Re: Overlap error not generated for sections w/o content
- References: <40015A34.2B3AFA5C@nsc.com><20040112011235.GD11283@bubble.modra.org>
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.