https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101843
Bug ID: 101843
Summary: Build of binutils-2.37 with gcc-11.2.0 fails due to
change to libiberty/hashtab.c
Product: gcc
Version: 11.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
Assignee: unassigned at gcc dot gnu.org
Reporter: mailboxnotfound at yahoo dot com
Target Milestone: ---
SUMMARY
Building binutils along with GCC is a documented method,
but it fails for gcc-11.2.0 with binutils-2.37 because
libiberty/hashtab.c
differs between gcc-11.2.0 and binutils-2.37
I have heard that hashtab.c has been updated in GCC master,
presumably fixing this problem (I have not verified this assertion).
It would be useful to include a fix in at least GCC 11,
and perhaps for other still-supported GCC version.
DETAIL
According to
https://gcc.gnu.org/install/download.html
it is acceptable to build binutils at the same time that one builds GCC.
However, if one does so by this method:
cd gcc-11.2.0
for dir in ../binutils-2.37/*
if dir does not exist in this gcc tree
ln -s $dir
then the following directories that already exist in the GCC tree are NOT
replaced by directories from the binutils-2.37 tree
config/ include/ intl/ libiberty/ zlib/
leading to this failure [white space adjusted] (*)
libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes
-Wshadow -I/data1/gcc/build/gcc-11.2.0/binutils/../zlib -g
-o strip-new objcopy.o is-strip.o rename.o rddbg.o debug.o
stabs.o rdcoff.o wrstabs.o bucomm.o version.o filemode.o
../bfd/.libs/libbfd.a
-L/data1/gcc/build/Linux-x86_64-gcc-build-11.2.0/zlib
-lz ../libiberty/libiberty.a -ldl
objcopy.o: In function `create_symbol_htab':
/data1/gcc/build/gcc-11.2.0/binutils/objcopy.c:1031: undefined reference to
'htab_eq_string'
The missing symbol, htab_eq_string, is defined in
../binutils-2.37/libiberty/hashtab.c and ../binutils-2.37/include/hashtab.h
(*) There may be other failures; I did not attempt to do anything resembling
make --keep-going
WORKAROUND
Building gcc-11.2.0 with binutils-2.36 works.
NOT A WORKAROUND
Note that this fails:
$ cd gcc-11.2.0/libiberty/
$ mv hashtab.c hashtab.c.orig; cp -p ../../binutils-2.37/libiberty/hashtab.c
.
$ cd ../include
$ mv hashtab.h hashtab.h.orig; cp -p ../../binutils-2.37/include/hashtab.h .
The above fails for module gensupport:
gcc-11.2.0/gcc/gensupport.c:2328:47: error: int htab_eq_string(const void*,
const void*) was declared 'extern' and later 'static'
RECOMMENDATION
Given that the documentation says that building binutils in your GCC tree
should work,
and given the existence of user habits (various google tracks for this
method),
it would be useful if at least GCC 11 (and maybe the other still-supported
GCC versions)
were fixed such that in-tree builds of binutils-2.37 would work.