This is the mail archive of the binutils@sourceware.org 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: ld 2.18 --gc-sections bug? (with testcase)


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


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