Bug 9909 - Binutils strip/ar BFD internal error
Summary: Binutils strip/ar BFD internal error
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-26 20:26 UTC by Claudius
Modified: 2009-04-17 12:11 UTC (History)
1 user (show)

See Also:
Host: windows WindowsXP-SP2 cygwin
Target:
Build: binutils-20080624-2
Last reconfirmed:


Attachments
an object file produces by g++ (94.90 KB, application/octet-stream)
2009-02-26 20:33 UTC, Claudius
Details
Allow external symbols for the section comdat symbol (502 bytes, patch)
2009-04-09 14:30 UTC, Nick Clifton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Claudius 2009-02-26 20:26:09 UTC
If stripping large object files with 'strip -x <obj.o>' the following error results:

BFD: BFD (GNU Binutils) 2.18.50.20080625 internal error, aborting at
/netrel/src/binutils-20080624-2/bfd/coffcode.h line 842 in handle_COMDAT

Sometimes, stripping works but a subsequent building of a library by 'ar -r *.o'
results in the same error:

BFD: BFD (GNU Binutils) 2.18.50.20080625 internal error, aborting at
/netrel/src/binutils-20080624-2/bfd/coffcode.h line 842 in handle_COMDAT

I can send an object file to reproduce this error (500kB), but I don't see where
to attach it here.
Comment 1 Claudius 2009-02-26 20:33:36 UTC
Created attachment 3773 [details]
an object file produces by g++

to reproduce the error by 'strip -x ipp_inst_lib-1.o':
BFD: BFD (GNU Binutils) 2.18.50.20080625 internal error, aborting at
/netrel/src/binutils-20080624-2/bfd/coffcode.h line 842 in handle_COMDAT
Comment 2 Nick Clifton 2009-04-09 14:30:36 UTC
Created attachment 3868 [details]
Allow external symbols for the section comdat symbol
Comment 3 Nick Clifton 2009-04-09 14:32:29 UTC
Hi Claudius,

  You are using a slightly out of date version of binutils (2.18 as opposed to
2.19), but the bug is present in the current sources anyway.

  Please could you try out the uploaded patch which I think will solve the problem.

Cheers
  Nick
Comment 4 Claudius 2009-04-16 23:09:06 UTC
Subject: Re:  Binutils strip/ar BFD internal error

Hello Nick,

I downloaded the cygwin package binutils-20080624-2-src.tar.bz2 and 
created strip-new.exe and ar.exe while applying your patch. Then the 
object files could be stripped and ar-chived correctly.

I couldn't figure out how to get the gcc use ld-new from the package 
above. Renaming it to ld.exe and adapting the PATH didn't work. Thus I 
couldn't create a complete test.exe based on the stripped object files 
as a final verification, but I guess that if all tools were built with 
your patch all would work fine.

Claudius

nickc at redhat dot com schrieb:
> ------- Additional Comments From nickc at redhat dot com  2009-04-09 14:32 -------
> Hi Claudius,
>
>   You are using a slightly out of date version of binutils (2.18 as opposed to
> 2.19), but the bug is present in the current sources anyway.
>
>   Please could you try out the uploaded patch which I think will solve the problem.
>
> Cheers
>   Nick
>
>
>   
Comment 5 Sourceware Commits 2009-04-17 12:08:26 UTC
Subject: Bug 9909

CVSROOT:	/cvs/src
Module name:	src
Changes by:	nickc@sourceware.org	2009-04-17 12:08:10

Modified files:
	bfd            : ChangeLog 

Log message:
	PR 9909
	* coffcode.h (handle_COMDAT): Allow for external COMDAT symbols.
	[delta to coffcode.h accidentally committed with a previous patch]

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.4558&r2=1.4559

Comment 6 Nick Clifton 2009-04-17 12:11:09 UTC
Hi Claudius,

  Thanks - I have applied the patch along with the changelog entry below.

  With regard to getting gcc to use a newly built linker you will probably find
in the gcc build directory an executable (file or script) called "collect-ld". 
Try replacing it with a symbolic link to the ld-new executable and then it
should work.

Cheers
  Nick

bfd/ChangeLog
2009-04-17  Nick Clifton  <nickc@redhat.com>

	PR 9909
	* coffcode.h (handle_COMDAT): Allow for external COMDAT symbols.