This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: ld 2.18 --gc-sections bug? (with testcase)
- From: Rask Ingemann Lambertsen <rask at sygehus dot dk>
- To: binutils at sourceware dot org
- Cc: Alan Modra <amodra at bigpond dot net dot au>
- Date: Mon, 10 Dec 2007 17:11:23 +0100
- Subject: Re: ld 2.18 --gc-sections bug? (with testcase)
- References: <200709071301.32998.vda.linux@googlemail.com> <20070907131255.GA10933@lucon.org> <200709071446.22648.vda.linux@googlemail.com> <20070908110439.GG11390@bubble.grove.modra.org>
On Sat, Sep 08, 2007 at 08:34:39PM +0930, Alan Modra wrote:
> This one turns out to be nothing to do with --gc-sections, but a
> rather more serious bug. If an input section with contents is linked
> in to a bss output section, the ELF linker currently leaves the output
> section as NOBITS. File space is thus not allocated for the output
> section, but a number of places write to the file regardless,
> typically trashing the symbol table, string table, or debug sections.
[snip]
>
> Index: bfd/elf.c
> ===================================================================
> RCS file: /cvs/src/src/bfd/elf.c,v
> retrieving revision 1.413
> diff -u -p -r1.413 elf.c
> --- bfd/elf.c 25 Aug 2007 13:20:41 -0000 1.413
> +++ bfd/elf.c 8 Sep 2007 08:07:42 -0000
> @@ -2084,7 +2084,7 @@ static const struct bfd_elf_special_sect
[...]
> + this_hdr->sh_type = sh_type;
> + else if (this_hdr->sh_type == SHT_NOBITS
> + && sh_type == SHT_PROGBITS
> + && (asect->flags & SEC_ALLOC) != 0)
> + {
> + /* Warn if we are changing a NOBITS section to PROGBITS, but
> + allow the link to proceed. This can happen when users link
> + non-bss input sections to bss output sections, or emit data
> + to a bss output section via a linker script. */
> + (*_bfd_error_handler)
> + (_("section `%A' type changed to PROGBITS"), asect);
> + this_hdr->sh_type = sh_type;
> }
This triggers all the time on m32r-unknown-elf (as least with GCC
compiled programs):
ld-new: section `.sbss' type changed to PROGBITS
1) Is it something which should be fixed? If so, pointers appreciated. For
example, I can't even tell which file is causing it in spite of trying
"--verbose --print-map".
2) If it is really a warning rather than an error message, shouldn't it be
prefixed with "warning: " or so? Dejagnu currently counts it as an error.
--
Rask Ingemann Lambertsen
Danish law requires addresses in e-mail to be logged and stored for a year