This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
incorrect empty mips object detection
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: binutils at sources dot redhat dot com
- Date: Tue, 17 Feb 2004 20:49:47 +0000
- Subject: incorrect empty mips object detection
- Organization: Codesourcery LLC
Hi,
elfxx-mips.c has this in it
/* Ignore synthetic sections and empty .text, .data and .bss sections
which are automatically generated by gas. */
if (strcmp (sec->name, ".reginfo")
&& strcmp (sec->name, ".mdebug")
&& ((!strcmp (sec->name, ".text")
|| !strcmp (sec->name, ".data")
|| !strcmp (sec->name, ".bss"))
&& sec->_raw_size != 0))
As you can see, the comment makes sense, but does not match what the code
is doing. The code triggers on
not .reginfo
and not .mdebug
and any of .text .data .bss
and size non-zero
This patch implements what the comment says, namely
not .reginfo
and not .mdebug
and (size non-zero or not any of .text, .data .bss)
without the patch, I happily got ld to link mips1 and mips3 object files
that happened to place all their code in a section called 'random'. With
the patch, ld complained that
./ld-new: mips-64.o: linking 32-bit code with 64-bit code
Bad value: failed to merge target specific data of file mips-64.o
ok?
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
2004-02-17 Nathan Sidwell <nathan@codesourcery.com>
* elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Correct
logic for null_input_bfd detection.
Index: bfd/elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.90
diff -c -3 -p -r1.90 elfxx-mips.c
*** bfd/elfxx-mips.c 17 Feb 2004 10:19:23 -0000 1.90
--- bfd/elfxx-mips.c 17 Feb 2004 20:30:35 -0000
*************** _bfd_mips_elf_merge_private_bfd_data (bf
*** 9030,9039 ****
which are automatically generated by gas. */
if (strcmp (sec->name, ".reginfo")
&& strcmp (sec->name, ".mdebug")
! && ((!strcmp (sec->name, ".text")
! || !strcmp (sec->name, ".data")
! || !strcmp (sec->name, ".bss"))
! && sec->_raw_size != 0))
{
null_input_bfd = FALSE;
break;
--- 9030,9039 ----
which are automatically generated by gas. */
if (strcmp (sec->name, ".reginfo")
&& strcmp (sec->name, ".mdebug")
! && (sec->_raw_size != 0
! || (strcmp (sec->name, ".text")
! && strcmp (sec->name, ".data")
! && strcmp (sec->name, ".bss"))))
{
null_input_bfd = FALSE;
break;