incorrect empty mips object detection

Nathan Sidwell nathan@codesourcery.com
Tue Feb 17 20:50:00 GMT 2004


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

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mips.diff
URL: <https://sourceware.org/pipermail/binutils/attachments/20040217/2dd3d339/attachment.ksh>


More information about the Binutils mailing list