[PATCH] Fix genmatch linking
Richard Biener
rguenther@suse.de
Thu Oct 23 14:30:00 GMT 2014
On Thu, 23 Oct 2014, Richard Biener wrote:
> On Thu, 23 Oct 2014, Richard Biener wrote:
>
> > On Thu, 23 Oct 2014, Rainer Orth wrote:
> >
> > > Richard Biener <rguenther@suse.de> writes:
> > >
> > > > This adds a libcpp host module without NLS and ICONV support
> > > > and properly links genmatch against the build libcpp instead of
> > > > the host one.
> > > >
> > > > Bootstrap running on x86_64-unknown-linux-gnu (stage1 all-gcc
> > > > finished fine).
> > >
> > > Unfortunately, this doesn't work on i386-pc-solaris2.10:
> > >
> > > In stage1, build/genmatch is linked correctly
> > >
> > > g++ -g -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -DGENERATOR_FILE -static-libstdc++ -static-libgcc -o build/genmatch \
> > > build/genmatch.o ../build-i386-pc-solaris2.10/libcpp/libcpp.a build/errors.o build/vec.o build/hash-table.o ../build-i386-pc-solaris2.10/libiberty/libiberty.a
> > >
> > > OTOH, in stage2, I get
> > >
> > > /var/gcc/regression/trunk/10-gcc/build/./prev-gcc/xg++ -B/var/gcc/regression/trunk/10-gcc/build/./prev-gcc/ -B/vol/gcc/i386-pc-solaris2.10/bin/ -nostdinc++ -B/var/gcc/regression/trunk/10-gcc/build/prev-i386-pc-solaris2.10/libstdc++-v3/src/.libs -B/var/gcc/regression/trunk/10-gcc/build/prev-i386-pc-solaris2.10/libstdc++-v3/libsupc++/.libs -I/var/gcc/regression/trunk/10-gcc/build/prev-i386-pc-solaris2.10/libstdc++-v3/include/i386-pc-solaris2.10 -I/var/gcc/regression/trunk/10-gcc/build/prev-i386-pc-solaris2.10/libstdc++-v3/include -I/vol/gcc/src/hg/trunk/local/libstdc++-v3/libsupc++ -L/var/gcc/regression/trunk/10-gcc/build/prev-i386-pc-solaris2.10/libstdc++-v3/src/.libs -L/var/gcc/regression/trunk/10-gcc/build/prev-i386-pc-solaris2.10/libstdc++-v3/libsupc++/.libs -g -O2 -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-mac
ros -Wno-overlength-strings -Werror -fno-common -DHAVE_CONFIG_H -DGENERATOR_FILE -static-libstdc++ -static-libgcc -o build/genmatch \
> > > build/genmatch.o .././libcpp/libcpp.a build/errors.o build/vec.o build/hash-table.o .././libiberty/libiberty.a
> > > Undefined first referenced
> > > symbol in file
> > > libintl_bindtextdomain .././libcpp/libcpp.a(init.o)
> > > libintl_dgettext .././libcpp/libcpp.a(errors.o)
> > > ld: fatal: symbol referencing errors. No output written to build/genmatch
> > > collect2: error: ld returned 1 exit status
> > > make[3]: *** [build/genmatch] Error 1
> > >
> > > Diffing the stage1 and 2 gcc/Makefiles, I see
> > >
> > > --- prev-gcc/Makefile 2014-10-23 13:45:20.720460523 +0200
> > > +++ gcc/Makefile 2014-10-23 14:32:06.111476537 +0200
> > > @@ -86 +86 @@
> > > -build_libsubdir=build-i386-pc-solaris2.10
> > > +build_libsubdir=.
> >
> > Hmm, why do stage2+ use the host libraries? Ah, because they can
> > assume that host == build. Ok, so when bootstrapping you then
> > need to link libcpp dependencies as well, for stage2+. Not sure
> > how to achieve that. I guess doing sth in gcc/configure - but
> > how does that know what stage we are in?
>
> I wonder if the following works
Or this one.
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in (revision 216590)
+++ gcc/Makefile.in (working copy)
@@ -981,7 +981,14 @@ else
LIBIBERTY = ../libiberty/libiberty.a
BUILD_LIBIBERTY = $(build_libobjdir)/libiberty/libiberty.a
endif
+# For stage1 and when cross-compiling use the build libcpp which is
+# built with NLS disabled. For stage2+ use the host library and
+# its dependencies.
+ifeq ($(build_objdir),$(build_libobjdir))
BUILD_CPPLIB = $(build_libobjdir)/libcpp/libcpp.a
+else
+BUILD_CPPLIB = $(CPPLIB) $(LIBIBERTY) $(LIBINTL_DEP) $(LIBICONV_DEP)
+endif
# Dependencies on the intl and portability libraries.
LIBDEPS= libcommon.a $(CPPLIB) $(LIBIBERTY) $(LIBINTL_DEP)
$(LIBICONV_DEP) \
pre-approved if it works for you.
Richard.
> Richard.
>
> Index: gcc/Makefile.in
> ===================================================================
> --- gcc/Makefile.in (revision 216590)
> +++ gcc/Makefile.in (working copy)
> @@ -981,7 +981,15 @@ else
> LIBIBERTY = ../libiberty/libiberty.a
> BUILD_LIBIBERTY = $(build_libobjdir)/libiberty/libiberty.a
> endif
> +ifeq ($(current_stage),stage1)
> BUILD_CPPLIB = $(build_libobjdir)/libcpp/libcpp.a
> +else
> +ifeq ($(current_stage),)
> +BUILD_CPPLIB = $(build_libobjdir)/libcpp/libcpp.a
> +else
> +BUILD_CPPLIB = $(CPPLIB) $(LIBIBERTY) $(LIBINTL_DEP) ($LIBICONV_DEP)
> +endif
> +endif
>
> # Dependencies on the intl and portability libraries.
> LIBDEPS= libcommon.a $(CPPLIB) $(LIBIBERTY) $(LIBINTL_DEP) $(LIBICONV_DEP) \
--
Richard Biener <rguenther@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend"orffer
More information about the Gcc-patches
mailing list