Bug 22109 - [4.0 Regression] /home/dave/opt/gnu/bin/ld: BFD 2.16.91 20050612 internal error
Summary: [4.0 Regression] /home/dave/opt/gnu/bin/ld: BFD 2.16.91 20050612 internal error
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 4.0.1
: P2 critical
Target Milestone: 4.0.1
Assignee: Not yet assigned to anyone
URL:
Keywords: build
Depends on:
Blocks:
 
Reported: 2005-06-17 23:53 UTC by John David Anglin
Modified: 2005-08-21 18:02 UTC (History)
5 users (show)

See Also:
Host: hppa-unknown-linux-gnu
Target: hppa-unknown-linux-gnu
Build: hppa-unknown-linux-gnu
Known to work: 4.0.0
Known to fail: 4.0.1
Last reconfirmed: 2005-06-20 06:23:44


Attachments
A testcase (495 bytes, application/octet-stream)
2005-06-20 13:37 UTC, H.J. Lu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John David Anglin 2005-06-17 23:53:18 UTC
/bin/sh ../libtool --tag CXX --mode=link /home/dave/gcc-4.0/objdir/gcc/xgcc -sha
red-libgcc -B/home/dave/gcc-4.0/objdir/gcc/ -nostdinc++ -L/home/dave/gcc-4.0/obj
dir/hppa-linux/libstdc++-v3/src -L/home/dave/gcc-4.0/objdir/hppa-linux/libstdc++
-v3/src/.libs -B/home/dave/opt/gnu/gcc/gcc-4.0.0/hppa-linux/bin/ -B/home/dave/op
t/gnu/gcc/gcc-4.0.0/hppa-linux/lib/ -isystem /home/dave/opt/gnu/gcc/gcc-4.0.0/hp
pa-linux/include -isystem /home/dave/opt/gnu/gcc/gcc-4.0.0/hppa-linux/sys-includ
e -Wl,-O1   -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual  -
fdiagnostics-show-location=once  -ffunction-sections -fdata-sections   -o libstd
c++.la -rpath /home/dave/opt/gnu/gcc/gcc-4.0.0/lib -version-info 6:5:0 -Wl,--ver
sion-script=libstdc++-symbol.ver -lm  bitmap_allocator.lo pool_allocator.lo mt_a
llocator.lo codecvt.lo compatibility.lo complex_io.lo ctype.lo debug.lo debug_li
st.lo functexcept.lo globals_locale.lo globals_io.lo ios.lo ios_failure.lo ios_i
nit.lo ios_locale.lo limits.lo list.lo locale.lo locale_init.lo locale_facets.lo
 localename.lo stdexcept.lo strstream.lo tree.lo allocator-inst.lo concept-inst.
lo fstream-inst.lo ext-inst.lo io-inst.lo istream-inst.lo istream.lo locale-inst
.lo locale-misc-inst.lo misc-inst.lo ostream-inst.lo sstream-inst.lo streambuf-i
nst.lo streambuf.lo string-inst.lo valarray-inst.lo wlocale-inst.lo wstring-inst
.lo atomicity.lo codecvt_members.lo collate_members.lo ctype_members.lo messages
_members.lo monetary_members.lo numeric_members.lo time_members.lo basic_file.lo
 c++locale.lo ../libmath/libmath.la ../libsupc++/libsupc++convenience.la -lm
/home/dave/gcc-4.0/objdir/gcc/xgcc -shared-libgcc -B/home/dave/gcc-4.0/objdir/gc
c/ -nostdinc++ -L/home/dave/gcc-4.0/objdir/hppa-linux/libstdc++-v3/src -L/home/d
ave/gcc-4.0/objdir/hppa-linux/libstdc++-v3/src/.libs -B/home/dave/opt/gnu/gcc/gc
c-4.0.0/hppa-linux/bin/ -B/home/dave/opt/gnu/gcc/gcc-4.0.0/hppa-linux/lib/ -isys
tem /home/dave/opt/gnu/gcc/gcc-4.0.0/hppa-linux/include -isystem /home/dave/opt/
gnu/gcc/gcc-4.0.0/hppa-linux/sys-include -shared -nostdlib /usr/lib/crti.o /home
/dave/gcc-4.0/objdir/gcc/crtbeginS.o  .libs/bitmap_allocator.o .libs/pool_alloca
tor.o .libs/mt_allocator.o .libs/codecvt.o .libs/compatibility.o .libs/complex_i
o.o .libs/ctype.o .libs/debug.o .libs/debug_list.o .libs/functexcept.o .libs/glo
bals_locale.o .libs/globals_io.o .libs/ios.o .libs/ios_failure.o .libs/ios_init.
o .libs/ios_locale.o .libs/limits.o .libs/list.o .libs/locale.o .libs/locale_ini
t.o .libs/locale_facets.o .libs/localename.o .libs/stdexcept.o .libs/strstream.o
 .libs/tree.o .libs/allocator-inst.o .libs/concept-inst.o .libs/fstream-inst.o .
libs/ext-inst.o .libs/io-inst.o .libs/istream-inst.o .libs/istream.o .libs/local
e-inst.o .libs/locale-misc-inst.o .libs/misc-inst.o .libs/ostream-inst.o .libs/s
stream-inst.o .libs/streambuf-inst.o .libs/streambuf.o .libs/string-inst.o .libs
/valarray-inst.o .libs/wlocale-inst.o .libs/wstring-inst.o .libs/atomicity.o .li
bs/codecvt_members.o .libs/collate_members.o .libs/ctype_members.o .libs/message
s_members.o .libs/monetary_members.o .libs/numeric_members.o .libs/time_members.
o .libs/basic_file.o .libs/c++locale.o -Wl,--whole-archive ../libmath/.libs/libm
ath.a ../libsupc++/.libs/libsupc++convenience.a -Wl,--no-whole-archive  -L/home/
dave/gcc-4.0/objdir/hppa-linux/libstdc++-v3/src -L/home/dave/gcc-4.0/objdir/hppa
-linux/libstdc++-v3/src/.libs -lm ../libmath/.libs/libmath.a -lm ../libsupc++/.l
ibs/libsupc++convenience.a -lm -L/home/dave/gcc-4.0/objdir/gcc -L/home/dave/opt/
gnu/gcc/gcc-4.0.0/lib/gcc/hppa-linux/../.. -lgcc_s -lgcc -lc -lgcc_s -lm -lgcc_s
 -lgcc -lc -lgcc_s   /home/dave/gcc-4.0/objdir/gcc/crtendS.o /usr/lib/crtn.o  -W
l,-O1 -Wl,--version-script=libstdc++-symbol.ver -Wl,-soname -Wl,libstdc++.so.6 -
o .libs/libstdc++.so.6.0.5
/home/dave/opt/gnu/bin/ld: BFD 2.16.91 20050612 internal error, aborting at ../.
./src/bfd/elf32-hppa.c line 3680 in elf32_hppa_relocate_section

/home/dave/opt/gnu/bin/ld: Please report this bug.

This appears to have been introduced by the recent change to symbol
versioning.
Comment 1 Andrew Pinski 2005-06-17 23:55:36 UTC
To me this looks like a binutils bug.
Comment 2 dave 2005-06-18 00:08:05 UTC
Subject: Re:  [4.0 Regression] /home/dave/opt/gnu/bin/ld: BFD 2.16.91 20050612 internal error

> To me this looks like a binutils bug.

Quite possibly.   However, I wanted a heads up until the exact cause
of the problem is determined.  I've seen this on two different systems.
My build yesterday using the same tools was successful.

<http://gcc.gnu.org/ml/gcc-testresults/2005-06/msg00997.html>.

Dave
Comment 3 dave 2005-06-18 02:25:48 UTC
Subject: Re:  [4.0 Regression] /home/dave/opt/gnu/bin/ld: BFD 2.16.91 20050612 internal error

> > To me this looks like a binutils bug.
> 
> Quite possibly.

The link doesn't fail with binutils 2.15.

Dave
Comment 4 Benjamin Kosnik 2005-06-19 15:08:03 UTC
Dave, does the 2.15 binutils build complete without error? (And testresults are
correct?)

I have not tried this version of binutils. For what it's worth (not much)

%ld --version
GNU ld version 2.16.1

works on x86/linux

-benjamin
Comment 5 H.J. Lu 2005-06-20 00:09:47 UTC
It looks like a gcc bug. I got similar failures on both ia32 and x86_64:

http://sourceware.org/bugzilla/show_bug.cgi?id=1025

Starting program: /export/home/hjl/bugs/gcc/got/ld -shared -o foo.so
compatibility.o string-inst.o --version-script=foo.ver

Breakpoint 1, elf_i386_relocate_section (output_bfd=0x9626860, info=0x80f6e80,
    input_bfd=0x9642da0, input_section=0x96760cc,
    contents=0x9708de8
"U\211å\203ì(\213E\b\211]ô\213M\f\211uø\213u\024\211}ü\2138\213E\020è\232üÿÿ\201Ãr`",
relocs=0x9686028, local_syms=0x96f8990,
    local_sections=0x9725600)
    at /net/gnu/export/linux/src/binutils/binutils/bfd/elf32-i386.c:2394
2394                abort ();
(gdb) p *h
$2 = {root = {root = {next = 0x0,
      string = 0x963898b "_ZNSt11char_traitsIcE2eqERKcS2_@@GLIBCXX_3.4.5",
      hash = 600204418}, type = bfd_link_hash_defined, u = {undef = {
        next = 0x0, abfd = 0x963b54c, weak = 0x0}, def = {next = 0x0,
        section = 0x963b54c, value = 0}, i = {next = 0x0, link = 0x963b54c,
        warning = 0x0}, c = {next = 0x0, p = 0x963b54c, size = 0}}},
  indx = -1, dynindx = 17, got = {refcount = -1, offset = 4294967295,
    glist = 0xffffffff, plist = 0xffffffff}, plt = {refcount = -1,
    offset = 4294967295, glist = 0xffffffff, plist = 0xffffffff}, size = 22,
  type = 2, other = 0, ref_regular = 0, def_regular = 1, ref_dynamic = 0,
  def_dynamic = 0, ref_regular_nonweak = 0, dynamic_adjusted = 0,
  needs_copy = 0, needs_plt = 0, non_elf = 0, hidden = 0, forced_local = 0,
  forced_global = 0, mark = 0, non_got_ref = 0, dynamic_def = 0,
  dynamic_weak = 0, pointer_equality_needed = 0, provide = 0,
  dynstr_index = 1509, u = {weakdef = 0xe02201f, elf_hash_value = 235020319},
  verinfo = {verdef = 0x961d6d8, vertree = 0x961d6d8}, vtable = 0x0}
(gdb)
Comment 6 Andrew Pinski 2005-06-20 00:12:50 UTC
See:
http://gcc.gnu.org/ml/gcc/2005-06/msg00844.html
http://gcc.gnu.org/ml/gcc/2005-06/msg00842.html

With those two, this looks like not like a GCC bug at all.
Comment 7 H.J. Lu 2005-06-20 06:23:43 UTC
It is a linker bug. I posted a patch for ia32/x86_64:

http://sourceware.org/ml/binutils/2005-06/msg00500.html
Comment 8 Benjamin Kosnik 2005-06-20 07:04:52 UTC
We need a way to test for this in autoconf instead of just using a version number. 

Doing this seems hard. Can somebody smart figure it out while I'm sleeping?

-benjamin
Comment 9 H.J. Lu 2005-06-20 13:37:15 UTC
Created attachment 9118 [details]
A testcase

Here is a testcase in C. I verified it on ia32.
Comment 10 H.J. Lu 2005-06-20 13:40:23 UTC
I checked in the linker patch to fix it.
Comment 11 GCC Commits 2005-06-23 09:25:10 UTC
Subject: Bug 22109

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	jakub@gcc.gnu.org	2005-06-23 09:24:49

Modified files:
	libstdc++-v3   : ChangeLog acinclude.m4 configure 
	libstdc++-v3/config/abi: compatibility.h 
	libstdc++-v3/include/bits: char_traits.h 
	libstdc++-v3/src: compatibility.cc 

Log message:
	PR libstdc++/22109
	* src/compatibility.cc (_GLIBCXX_SYMVER_COMPATIBILITY): Remove.
	(istreambuf_iterator, basic_fstream, basic_ifstream, basic_ofstream,
	_M_copy, _M_move, _M_assign, _M_disjunct, _M_check_length,
	_M_set_length_and_sharable, ignore, eq): Define to XX suffixed
	variants.
	(ignore (streamsize)): Remove _W prefixed aliases.
	(_GLIBCXX_3_4_SYMVER_SPECIAL, _GLIBCXX_3_4_5_SYMVER_SPECIAL,
	_GLIBCXX_APPLY_SYMVER_SPECIAL): Remove.
	(_GLIBCXX_3_4_SYMVER, _GLIBCXX_3_4_5_SYMVER): Add XXname argument.
	Use #XXname instead of #name as the alias argument.
	* config/abi/compatibility.h: Replace uses of
	_GLIBCXX_APPLY_SYMVER_SPECIAL with _GLIBCXX_APPLY_SYMVER.  Always
	pass 2 arguments to the _GLIBCXX_APPLY_SYMVER macro.
	* include/bits/char_traits.h (char_traits::eq): Revert 2005-06-15
	change.
	* acinclude.m4: Decrease glibcxx_min_gnu_ld_version back to 21400.
	* configure: Rebuilt.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.2917.2.63&r2=1.2917.2.64
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/acinclude.m4.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.307.2.3&r2=1.307.2.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/configure.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.423.2.4&r2=1.423.2.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/config/abi/compatibility.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1.2.1&r2=1.1.2.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/char_traits.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.26.16.1&r2=1.26.16.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/src/compatibility.cc.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1.2.1&r2=1.1.2.2

Comment 12 dave 2005-06-23 15:30:59 UTC
Subject: Re:  [4.0 Regression] /home/dave/opt/gnu/bin/ld: BFD 2.16.91 20050612 internal error

> Dave, does the 2.15 binutils build complete without error? (And testresults are
> correct?)

Yes, it did.  This was the debian version, so it's been patched somewhat.

> I have not tried this version of binutils. For what it's worth (not much)
> 
> %ld --version
> GNU ld version 2.16.1

This also worked.  However, both 2.15 and 2.16.x have the problem fixed
by Lu's patch.  Thus, I don't know why they would work.

I see Jacob has applied a fix but I haven't had time to test with
an older version of binutils.

Dave
Comment 13 GCC Commits 2005-06-23 16:49:18 UTC
Subject: Bug 22109

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jakub@gcc.gnu.org	2005-06-23 16:49:00

Modified files:
	libstdc++-v3   : ChangeLog acinclude.m4 configure 
	libstdc++-v3/config/abi: compatibility.h 
	libstdc++-v3/include/bits: char_traits.h 
	libstdc++-v3/src: compatibility.cc 

Log message:
	PR libstdc++/22109
	* src/compatibility.cc (_GLIBCXX_SYMVER_COMPATIBILITY): Remove.
	(istreambuf_iterator, basic_fstream, basic_ifstream, basic_ofstream,
	_M_copy, _M_move, _M_assign, _M_disjunct, _M_check_length,
	_M_set_length_and_sharable, ignore, eq): Define to XX suffixed
	variants.
	(ignore (streamsize)): Remove _W prefixed aliases.
	(_GLIBCXX_3_4_SYMVER_SPECIAL, _GLIBCXX_3_4_5_SYMVER_SPECIAL,
	_GLIBCXX_APPLY_SYMVER_SPECIAL): Remove.
	(_GLIBCXX_3_4_SYMVER, _GLIBCXX_3_4_5_SYMVER): Add XXname argument.
	Use #XXname instead of #name as the alias argument.
	* config/abi/compatibility.h: Replace uses of
	_GLIBCXX_APPLY_SYMVER_SPECIAL with _GLIBCXX_APPLY_SYMVER.  Always
	pass 2 arguments to the _GLIBCXX_APPLY_SYMVER macro.
	* include/bits/char_traits.h (char_traits::eq): Revert 2005-06-15
	change.
	* acinclude.m4: Decrease glibcxx_min_gnu_ld_version back to 21400.
	* configure: Rebuilt.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.3043&r2=1.3044
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/acinclude.m4.diff?cvsroot=gcc&r1=1.318&r2=1.319
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/configure.diff?cvsroot=gcc&r1=1.444&r2=1.445
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/config/abi/compatibility.h.diff?cvsroot=gcc&r1=1.2&r2=1.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/char_traits.h.diff?cvsroot=gcc&r1=1.27&r2=1.28
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/src/compatibility.cc.diff?cvsroot=gcc&r1=1.2&r2=1.3

Comment 14 H.J. Lu 2005-08-21 18:02:35 UTC
*** Bug 22185 has been marked as a duplicate of this bug. ***