Bug 24044 - FTB with GCC libiberty: binutils/stabs.c:3042: undefined reference to `cplus_mangle_opname'
Summary: FTB with GCC libiberty: binutils/stabs.c:3042: undefined reference to `cplus_...
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.32
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-29 17:08 UTC by Jozef Lawrynowicz
Modified: 2019-01-08 16:54 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jozef Lawrynowicz 2018-12-29 17:08:36 UTC
When building GCC trunk in a unified source tree with binutils, the build of binutils fails as support for some old demangling functions have been removed from GCC's libiberty (see r267363 https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=267363).

> /bin/bash ./libtool  --tag=CC   --mode=link gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -I../../binutils/../zlib -g  -static-libstdc++ -static-libgcc  -o objdump objdump.o dwarf.o prdbg.o rddbg.o debug.o stabs.o rdcoff.o bucomm.o version.o filemode.o elfcomm.o  ../opcodes/libopcodes.la ../bfd/libbfd.la ../libiberty/libiberty.a  -ldl 
> libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -I../../binutils/../zlib -g -static-libstdc++ -static-libgcc -o objdump objdump.o dwarf.o prdbg.o rddbg.o debug.o stabs.o rdcoff.o bucomm.o version.o filemode.o elfcomm.o  ../opcodes/.libs/libopcodes.a ../bfd/.libs/libbfd.a -Lzlib -lz ../libiberty/libiberty.a -ldl
> stabs.o: In function `parse_stab_argtypes':
> binutils/stabs.c:3042: undefined reference to `cplus_mangle_opname'
> collect2: error: ld returned 1 exit status
> Makefile:912: recipe for target 'objdump' failed

I suppose this "bug" is only valid if the latest binutils is expected to always successfully build with the latest libiberty from GCC, or if the libiberty included with binutils is the only version expected to always work.
Comment 1 cvs-commit@gcc.gnu.org 2019-01-07 13:20:23 UTC
The master branch has been updated by Nick Clifton <nickc@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=053af8c9034f92d6e36a1180655ba22a65c56437

commit 053af8c9034f92d6e36a1180655ba22a65c56437
Author: Nick Clifton <nickc@redhat.com>
Date:   Mon Jan 7 13:18:53 2019 +0000

    Sync libiberty sources with master version in gcc repository.  Updated stabs demangling and cxxfilt tests to match.
    
    	PR 24044
    	* stabs.c (parse_stab_argtypes): Remove call to
    	cplus_mangle_opcode.
    	* testsuite/binutils-all/cxxfilt.exp: Replace tests of v2 encoding
    	with v3 encoding.  Add escape for known failures.
Comment 2 Nick Clifton 2019-01-07 13:23:15 UTC
Hi Jozef,

  Strictly speaking the version of libiberty that is included with the
  binutils sources is the only version that is expected to work.

  But having said that, we do try to keep the binutils sources in sync
  with the gcc version, and since a release branch is coming soon, now
  seems to be a good time to perform another merge.  Since this did
  expose the problem you encountered, I also took the time to fix that
  as well.

Cheers
  Nick
Comment 3 Christophe Lyon 2019-01-07 15:19:21 UTC
Hi Nick,

This patch causes a regression on arm-pe:
FAIL: cxxfilt: demangling _Z14int_if_addableI1YERiP1AIXszpldecvPT_Li0EdecvS4_Li0EEE
FAIL: cxxfilt: demangling _Z1fIvJiELb0EEvPDOT1_EFT_DpT0_E
Comment 4 Alan Modra 2019-01-07 23:25:07 UTC
Nick, I think you need to copy over include/demangle.h from gcc too.
Comment 5 Alan Modra 2019-01-08 03:31:19 UTC
The testsuite regressions happen on targets that prepend underscores to symbols (and thus c++filt has strip_underscore set by default).  The new tests need --no-strip-underscores.
Comment 6 Nick Clifton 2019-01-08 11:09:33 UTC
Hi Alan,

> (and thus c++filt has strip_underscore set by default).  The new tests need
> --no-strip-underscores.

Doh!  That was what I was missing.  Thanks for pointing this out.

Cheers
  Nick
Comment 7 cvs-commit@gcc.gnu.org 2019-01-08 16:54:25 UTC
The master branch has been updated by Nick Clifton <nickc@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=236f4ebe3ac7e8f94184fdcc39c70d74cc62b82a

commit 236f4ebe3ac7e8f94184fdcc39c70d74cc62b82a
Author: Nick Clifton <nickc@redhat.com>
Date:   Tue Jan 8 16:53:02 2019 +0000

    Remove support for old gnu v2 name mangling.
    
    	PR 24044
    	* cxxfilt.c (hp_symbol_characters): Delete.
    	(main): Remove depcreated demangling styles.
    	* stabs.c (parse_stab_argtypes): Remove support for old gnu v2
    	demangling opnames.
    	* testsuite/binutils-all/cxxfilt.exp: Use the
    	--no-strip-underscore option for targets that do prefix their
    	symbols with underscores.
    	Update tests to elimiate those that use gnu v2 encoding.