Bug 2659

Summary: Problem with partial linking [Was: Assertion triggered in cofflink.c]
Product: binutils Reporter: Anton Korobeynikov <asl>
Component: ldAssignee: unassigned
Severity: critical CC: bug-binutils
Priority: P2    
Version: 2.20   
Target Milestone: ---   
Host: i686-pc-mingw32 Target:
Build: i686-pc-mingw32 Last reconfirmed:
Attachments: Set of object files on which link failed.
First object file
Second object file
Add check for missing aux entries
Output from the first pass
The second pass output
Improved check for missing aux entries.

Description Anton Korobeynikov 2006-05-14 08:29:36 UTC
While linking some big c++ project (Latest LLVM CVS snapshot) using mingw32's
binutils (2.16.91 20060119) I've got the folowing message:

f:\research\mingw\bin\ld.exe: BFD 2.16.91 20060119 assertion fail ../../src/bfd/

It seems, that some other projects GeOs) have just same problems. I've reduced
huge set of object files just to 2.

The same assertion is triggered with the latest binutils snapshot both on
mingw32 and cygwin platforms.
Comment 1 Anton Korobeynikov 2006-05-14 08:30:49 UTC
Created attachment 1023 [details]
Set of object files on which link failed.
Comment 2 Anton Korobeynikov 2006-05-16 19:52:02 UTC
I've digged into the problem some more deep. The main problem is in file named
LLVMSelectionDAG.o, which can be found in the prev. attach. This file was
produced as 'ld -r' output from 9 object files.

I've reduced the full set to just 2 files, running ld on which produces an

So, if I do:

ld -r -o LLVMSelectionDAG.o ScheduleDAGList.o ScheduleDAGRRList.o
ld -o LLVMSelectionDAG.o

I'm getting an assertion (even more, if I just do ld -r LLVMSelectionDAG.o -o
LLVMSelectionDAG_1.o, I'm getting an exception).

Seems, that something is broken in the partial link...
Comment 3 Anton Korobeynikov 2006-05-16 19:53:07 UTC
Created attachment 1027 [details]
First object file
Comment 4 Anton Korobeynikov 2006-05-16 19:53:37 UTC
Created attachment 1028 [details]
Second object file
Comment 5 Nick Clifton 2006-05-24 08:39:02 UTC
Created attachment 1047 [details]
Add check for missing aux entries
Comment 6 Nick Clifton 2006-05-24 08:40:30 UTC
Hi Anton,

  I think that this is a case of a missing check in bfd_coff_link_input_bfd, so
please could you try the uploaded patch and let me know if it works on a real
world test, (ie your build environment).

Comment 7 Anton Korobeynikov 2006-05-24 12:23:08 UTC
Unfortunately, patch doesn't work for me. Assertion is still triggered.

I'm attaching the file from the first linker pass (ld -r -o LLVMSelectionDAG.o
ScheduleDAGList.o ScheduleDAGRRList.o).
Comment 8 Anton Korobeynikov 2006-05-24 12:25:40 UTC
Created attachment 1048 [details]
Output from the first pass

This is the output from 'ld -r -o LLVMSelectionDAG.o ScheduleDAGList.o
Comment 9 Anton Korobeynikov 2006-05-24 12:27:12 UTC
Created attachment 1049 [details]
The second pass output

The output from the second pass: `ld -r -o LLVMSelectionDAG_1.o
LLVMSelectionDAG.o`. Assertion is triggered, but file is actually not null.
Comment 10 Nick Clifton 2006-06-23 08:45:28 UTC
Hi Anton,

  Sorry about the delay in getting back to you.  I am a bit swamped at the moment.

  I am uploading a revised patch which I think should take care of this issue
now.  The problem appears to be the fact that there are multiple defintions of a
symbol, but only one of them has an aux entry and the wrong version of the
symbol was being selecetd when the code wanted to process the aux data.

Comment 11 Nick Clifton 2006-06-23 08:46:30 UTC
Created attachment 1114 [details]
Improved check for missing aux entries.
Comment 12 Anton Korobeynikov 2006-06-24 12:15:15 UTC

Now no assertions at all. Files look fine.

However, I don't have a complete build system & sources which the attached .o
files was taken from. So I don't know the results of linking.

I'll let you know the results of linking the whole program (I hope, everything
will be ok) in 4-5 days.
Comment 13 Anton Korobeynikov 2006-07-03 07:37:40 UTC

Everything is building ok. So, this bug is definitely fixed by now. Thanks alot!
Comment 14 Nick Clifton 2006-07-05 10:22:29 UTC
Hi Anton,

  Great - I have checked the revised patch in together with this ChangeLog entry.


2006-07-05  Nick Clifton  <nickc@redhat.com>

	PR ld/2659
	* cofflink.c (_bfd_coff_link_input_bfd): Fix selection of aux
	entry when multiple definitions of a symbol are encountered.
Comment 15 Jackie Rosen 2014-02-16 19:43:20 UTC
*** Bug 260998 has been marked as a duplicate of this bug. ***
Seen from the domain http://volichat.com
Page where seen: http://volichat.com/adult-chat-rooms
Marked for reference. Resolved as fixed @bugzilla.