Bug 233 - aborting at ../../bfd/elf32-i386.c line 2247 in elf_i386_relocate_section
Summary: aborting at ../../bfd/elf32-i386.c line 2247 in elf_i386_relocate_section
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: pre-2.15
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-25 19:12 UTC by Fabian Wenzel
Modified: 2004-10-11 13:29 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Last reconfirmed:


Attachments
Small test app which is the minimal version to reproduce the bug on my system. (270.42 KB, application/octet-stream)
2004-06-25 19:15 UTC, Fabian Wenzel
Details
Object files that reproduce the bug with binutils 2.15 (81.16 KB, application/octet-stream)
2004-06-28 09:30 UTC, Fabian Wenzel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fabian Wenzel 2004-06-25 19:12:55 UTC
In an own project which worked for years, the linker suddenly aborts with
the libbfd-error

/usr/bin/ld: BFD 2.14.90.0.7 20031029 Debian GNU/Linux internal error, aborting
at ../../bfd/elf32-i386.c line 2247 in elf_i386_relocate_section

I broke my app down to a small testcase which I will try to append to this
bugreport. My system is Debian/sid.
Comment 1 Fabian Wenzel 2004-06-25 19:15:21 UTC
Created attachment 119 [details]
Small test app which is the minimal version to reproduce the bug on my system.

Rreproduces the bug on my system.
Comment 2 Alan Modra 2004-06-26 03:00:19 UTC
I could not reproduce this problem with current mainline binutils and
gcc-3.3.3-hammer.  There have been quite a few changes to elf32-i386.c since
binutils-2.14.90.0.7 and it's likely that one of them has fixed the bug.  Please
try your testcase with a newer binutils.  If current mainline binutils fails for
you, then we need the set of object files involved in the link rather than C/C++
source files.  Compiler differences may make it impossible to reproduce.
Comment 3 Fabian Wenzel 2004-06-28 09:30:35 UTC
Created attachment 121 [details]
Object files that reproduce the bug with binutils 2.15

I updated binutils to the current mainline (2.15), but the ld-error remains. I
attached an archive with the modules which make the following line crash.

g++ -g -O2 -o test main.o  modules/.libs/libmodules.a

/usr/bin/ld: BFD 2.15 internal error, aborting at ../../bfd/elf32-i386.c line
2262 in elf_i386_relocate_section
Comment 4 Alan Modra 2004-06-28 12:04:35 UTC
This is a relocation against a local symbol in a removed linkonce section. 
Various hacks have been tried to handle such symbols and each one fails in some
cases, so I'm inclined to say this is really a problem with your c++ compiler.
HJ was the last person to touch the relevant linker code.  He might have a
better idea than I whether anything can be done with this particular testcase.
Comment 5 H.J. Lu 2004-06-28 18:50:02 UTC
I can reproduce it with gcc 3.3.5 20040627 and gcc 3.4.1 20040627.
Comment 6 H.J. Lu 2004-06-28 19:20:35 UTC
It is a nasty problem, which can only be properly solved with comdat group.
Comment 7 H.J. Lu 2004-06-29 16:14:33 UTC
Here is the linker patch

http://sources.redhat.com/ml/binutils/2004-06/msg00567.html