diff mbox

Fix in-tree gmp/mpfr/mpc generation (PR 67728)

Message ID AM4PR07MB15712B7588FA90C7CE5930D5E4860@AM4PR07MB1571.eurprd07.prod.outlook.com
State New
Headers show

Commit Message

Bernd Edlinger March 28, 2016, 12:44 p.m. UTC
Hi,

as described in the tracker we have bootstrap problems with in-tree gmp-6.1.0
on certain targets, and also a linker issue with check-mpc due to the changed
mpfr library path.

These are triggered by overriding CFLAGS and LDFLAGS in in-tree builds.
It did not happen with the gmp/mpfr/mpc versions that download_prerequisites
installs, but the currently latest version of these libraries use CFLAGS to pass
-DNO_ASM which is overridden by gcc and causes the gmp-6.1.0 to be
mis-compiled.  And the mpc issue is triggered by overriding LDFLAGS
and the changed mpfr library path.  So this started with mpfr v3.1.0 which
moved the sources into a src sub-directory.

The proposed patch fixes these problems by passing -DNO_ASM in AM_CFLAGS,
and adding both possible mpfr library paths to HOST_LIB_PATH_mpfr.
I've also adjusted HOST_LIB_PATH_mpc although it did not yet create problems.

Boot-strapped and regression tested on x86_64-pc-linux-gnu, with different
gmp versions including the latest snapshot.
I have additionally built arm cross compilers, which was not working before.

Is this OK for trunk?


Thanks
Bernd.
2016-03-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	PR bootstrap/67728
	* Makefile.def (gmp): Explicitly disable assembler.
	(mpfr): Add src/.libs to lib_path2.
	(mpc): Adjust lib_path.
	* Makefile.tpi (HOST_LIB_PATH_): Use lib_path2 if defined.
	* Makefile.in: Regenerated.

Comments

Richard Biener March 29, 2016, 8:32 a.m. UTC | #1
On Mon, Mar 28, 2016 at 2:44 PM, Bernd Edlinger
<bernd.edlinger@hotmail.de> wrote:
>
> Hi,
>
> as described in the tracker we have bootstrap problems with in-tree gmp-6.1.0
> on certain targets, and also a linker issue with check-mpc due to the changed
> mpfr library path.

Hum, in-tree gmp 6.1.0 is not supported (only the version downloaded by
download_prerequesites is).

> These are triggered by overriding CFLAGS and LDFLAGS in in-tree builds.
> It did not happen with the gmp/mpfr/mpc versions that download_prerequisites
> installs, but the currently latest version of these libraries use CFLAGS to pass
> -DNO_ASM which is overridden by gcc and causes the gmp-6.1.0 to be
> mis-compiled.

So you pass down AM_CFLAGS=-DNO_ASM but how does that reliably work
for all gmp versions?

>  And the mpc issue is triggered by overriding LDFLAGS
> and the changed mpfr library path.  So this started with mpfr v3.1.0 which
> moved the sources into a src sub-directory.
>
> The proposed patch fixes these problems by passing -DNO_ASM in AM_CFLAGS,
> and adding both possible mpfr library paths to HOST_LIB_PATH_mpfr.
> I've also adjusted HOST_LIB_PATH_mpc although it did not yet create problems.

But you remove a possibly good .libs lib_path.

> Boot-strapped and regression tested on x86_64-pc-linux-gnu, with different
> gmp versions including the latest snapshot.
> I have additionally built arm cross compilers, which was not working before.
>
> Is this OK for trunk?

I don't think so.  Supporting an arbitrary mix of in-tree versions is
a nightmare.

If you really want to go down this route see @extra_mpc_gmp_configure_flags@
and add a variant for the lib-paths.  I don't have a good answer for -DNO_ASM
than to fix gmp/mpfr to not pass down this kind of configuation via CFLAGs.

Please instead do the testing required to ensure bumping the versions downloaded
by download_prerequesite works during next stage1.

Richard.

>
> Thanks
> Bernd.
Bernd Edlinger March 29, 2016, 9:52 a.m. UTC | #2
On 29.03.2016 at 10:32, Richard Biener wrote:
> On Mon, Mar 28, 2016 at 2:44 PM, Bernd Edlinger

> <bernd.edlinger@hotmail.de> wrote:

>>

>> Hi,

>>

>> as described in the tracker we have bootstrap problems with in-tree gmp-6.1.0

>> on certain targets, and also a linker issue with check-mpc due to the changed

>> mpfr library path.

>

> Hum, in-tree gmp 6.1.0 is not supported (only the version downloaded by

> download_prerequesites is).

>


Yes, that is what I thought too, but people out there expect something
different, and run into problems.

>> These are triggered by overriding CFLAGS and LDFLAGS in in-tree builds.

>> It did not happen with the gmp/mpfr/mpc versions that download_prerequisites

>> installs, but the currently latest version of these libraries use CFLAGS to pass

>> -DNO_ASM which is overridden by gcc and causes the gmp-6.1.0 to be

>> mis-compiled.

>

> So you pass down AM_CFLAGS=-DNO_ASM but how does that reliably work

> for all gmp versions?

>


gmp-4.3.2 did use CPPFLAGS=-DNO_ASM, that is not overridden by the build
machinery, when I pass AM_CFLAGS=-DNO_ASM it is simply defined twice.
gmp-6.1.0 did add -DNO_ASM to CFLAGS, and we break it by overriding
CFLAGS.  By passing -DNO_ASM in AM_CFLAGS we would un-break this
version.
Mark Glisse moved recently the -DNO_ASM from CFLAGS to config.h,
so that version is immune against overriding CFLAGS and defining
AM_CFLAGS=-DNO_ASM is redundant, and does nothing.

>>   And the mpc issue is triggered by overriding LDFLAGS

>> and the changed mpfr library path.  So this started with mpfr v3.1.0 which

>> moved the sources into a src sub-directory.

>>

>> The proposed patch fixes these problems by passing -DNO_ASM in AM_CFLAGS,

>> and adding both possible mpfr library paths to HOST_LIB_PATH_mpfr.

>> I've also adjusted HOST_LIB_PATH_mpc although it did not yet create problems.

>

> But you remove a possibly good .libs lib_path.


No .libs was always wrong as it looks.
At least mpc-0.8.1 and mpc-1.0.3 use src/.libs
However we do not use that path to link mpc, instead we use:

HOST_GMPLIBS = -L$$r/$(HOST_SUBDIR)/gmp/.libs 
-L$$r/$(HOST_SUBDIR)/mpfr/.libs -L$$r/$(HOST_SUBDIR)/mpc/src/.libs -lmpc 
-lmpfr -lgmp

which does it right.


>

>> Boot-strapped and regression tested on x86_64-pc-linux-gnu, with different

>> gmp versions including the latest snapshot.

>> I have additionally built arm cross compilers, which was not working before.

>>

>> Is this OK for trunk?

>

> I don't think so.  Supporting an arbitrary mix of in-tree versions is

> a nightmare.

>

> If you really want to go down this route see @extra_mpc_gmp_configure_flags@

> and add a variant for the lib-paths.  I don't have a good answer for -DNO_ASM

> than to fix gmp/mpfr to not pass down this kind of configuation via CFLAGs.

>


I am afraid, I don't have the power to do that.
gmp-6.2.0 will not be affected, but is not yet released.
All versions of mpc did pass the configure --with-mpfr-lib option
to LDFLAGS which was broken in-tree, but did still work before
mpfr 3.1.0 because the LD_LIBRARY_PATH contained mfr/.libs

> Please instead do the testing required to ensure bumping the versions downloaded

> by download_prerequesite works during next stage1.

>


Sure if we only have to support a single gmp-version that would allow us
to remove a lot of kludges that are only necessary for gmp-4.3.2 or
mpfr before 3.1.0 instead of adding new ones.

But which versions will that be?

gmp-6.1.0 or gmp-6.2.0 (not yet released) ?
mpfr-3.1.4 ?
mpc-1.0.3 ?


Bernd.

> Richard.

>

>>

>> Thanks

>> Bernd.
Richard Biener March 29, 2016, 12:18 p.m. UTC | #3
On Tue, 29 Mar 2016, Bernd Edlinger wrote:

> On 29.03.2016 at 10:32, Richard Biener wrote:
> > On Mon, Mar 28, 2016 at 2:44 PM, Bernd Edlinger
> > <bernd.edlinger@hotmail.de> wrote:
> >>
> >> Hi,
> >>
> >> as described in the tracker we have bootstrap problems with in-tree gmp-6.1.0
> >> on certain targets, and also a linker issue with check-mpc due to the changed
> >> mpfr library path.
> >
> > Hum, in-tree gmp 6.1.0 is not supported (only the version downloaded by
> > download_prerequesites is).
> >
> 
> Yes, that is what I thought too, but people out there expect something
> different, and run into problems.
> 
> >> These are triggered by overriding CFLAGS and LDFLAGS in in-tree builds.
> >> It did not happen with the gmp/mpfr/mpc versions that download_prerequisites
> >> installs, but the currently latest version of these libraries use CFLAGS to pass
> >> -DNO_ASM which is overridden by gcc and causes the gmp-6.1.0 to be
> >> mis-compiled.
> >
> > So you pass down AM_CFLAGS=-DNO_ASM but how does that reliably work
> > for all gmp versions?
> >
> 
> gmp-4.3.2 did use CPPFLAGS=-DNO_ASM, that is not overridden by the build
> machinery, when I pass AM_CFLAGS=-DNO_ASM it is simply defined twice.
> gmp-6.1.0 did add -DNO_ASM to CFLAGS, and we break it by overriding
> CFLAGS.  By passing -DNO_ASM in AM_CFLAGS we would un-break this
> version.
> Mark Glisse moved recently the -DNO_ASM from CFLAGS to config.h,
> so that version is immune against overriding CFLAGS and defining
> AM_CFLAGS=-DNO_ASM is redundant, and does nothing.
> 
> >>   And the mpc issue is triggered by overriding LDFLAGS
> >> and the changed mpfr library path.  So this started with mpfr v3.1.0 which
> >> moved the sources into a src sub-directory.
> >>
> >> The proposed patch fixes these problems by passing -DNO_ASM in AM_CFLAGS,
> >> and adding both possible mpfr library paths to HOST_LIB_PATH_mpfr.
> >> I've also adjusted HOST_LIB_PATH_mpc although it did not yet create problems.
> >
> > But you remove a possibly good .libs lib_path.
> 
> No .libs was always wrong as it looks.
> At least mpc-0.8.1 and mpc-1.0.3 use src/.libs
> However we do not use that path to link mpc, instead we use:
> 
> HOST_GMPLIBS = -L$$r/$(HOST_SUBDIR)/gmp/.libs 
> -L$$r/$(HOST_SUBDIR)/mpfr/.libs -L$$r/$(HOST_SUBDIR)/mpc/src/.libs -lmpc 
> -lmpfr -lgmp
> 
> which does it right.
> 
> 
> >
> >> Boot-strapped and regression tested on x86_64-pc-linux-gnu, with different
> >> gmp versions including the latest snapshot.
> >> I have additionally built arm cross compilers, which was not working before.
> >>
> >> Is this OK for trunk?
> >
> > I don't think so.  Supporting an arbitrary mix of in-tree versions is
> > a nightmare.
> >
> > If you really want to go down this route see @extra_mpc_gmp_configure_flags@
> > and add a variant for the lib-paths.  I don't have a good answer for -DNO_ASM
> > than to fix gmp/mpfr to not pass down this kind of configuation via CFLAGs.
> >
> 
> I am afraid, I don't have the power to do that.
> gmp-6.2.0 will not be affected, but is not yet released.
> All versions of mpc did pass the configure --with-mpfr-lib option
> to LDFLAGS which was broken in-tree, but did still work before
> mpfr 3.1.0 because the LD_LIBRARY_PATH contained mfr/.libs
> 
> > Please instead do the testing required to ensure bumping the versions downloaded
> > by download_prerequesite works during next stage1.
> >
> 
> Sure if we only have to support a single gmp-version that would allow us
> to remove a lot of kludges that are only necessary for gmp-4.3.2 or
> mpfr before 3.1.0 instead of adding new ones.

in-tree builds are already "kludges" itself and I don't see the need
to support a variety of versions people want to put in there.  So maybe
this is simply a documentation issue.

We _do_ support build against a variety of installed versions.

We don't necessarily need to support building with in-tree gmp but not 
mpfr or mpc, etc. (I think we do, at least kind-of, but these libs
have requirements on their versions as well)

> But which versions will that be?
> 
> gmp-6.1.0 or gmp-6.2.0 (not yet released) ?
> mpfr-3.1.4 ?
> mpc-1.0.3 ?

Very simple - any set of versions that fulfill our needs in
passing in-tree builds for all primary and secondary targets
(crosses where those are not platforms used as hosts).

Of course choosing the "latest" when changing versions makes sense
(unless they broke things too badly).  Note that in theory we
can also put slightly modified versions in infrastructure/ or
download a patch in addition to a tarball which we can apply
(like moving NO_ASM to config.h).

Richard.
diff mbox

Patch

Index: Makefile.def
===================================================================
--- Makefile.def	(revision 234490)
+++ Makefile.def	(working copy)
@@ -50,6 +50,7 @@  host_modules= { module= gcc; bootstrap=true;
 host_modules= { module= gmp; lib_path=.libs; bootstrap=true;
 		// Work around in-tree gmp configure bug with missing flex.
 		extra_configure_flags='--disable-shared LEX="touch lex.yy.c"';
+		extra_make_flags='AM_CFLAGS="-DNO_ASM"';
 		no_install= true;
 		// none-*-* disables asm optimizations, bootstrap-testing
 		// the compiler more thoroughly.
@@ -57,11 +58,11 @@  host_modules= { module= gmp; lib_path=.libs; boots
 		// gmp's configure will complain if given anything
 		// different from host for target.
 	        target="none-${host_vendor}-${host_os}"; };
-host_modules= { module= mpfr; lib_path=.libs; bootstrap=true;
+host_modules= { module= mpfr; lib_path=.libs; lib_path2=src/.libs; bootstrap=true;
 		extra_configure_flags='--disable-shared @extra_mpfr_configure_flags@';
 		extra_make_flags='AM_CFLAGS="-DNO_ASM"';
 		no_install= true; };
-host_modules= { module= mpc; lib_path=.libs; bootstrap=true;
+host_modules= { module= mpc; lib_path=src/.libs; bootstrap=true;
 		extra_configure_flags='--disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@';
 		no_install= true; };
 host_modules= { module= isl; lib_path=.libs; bootstrap=true;
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 234490)
+++ Makefile.in	(working copy)
@@ -639,12 +639,12 @@  HOST_LIB_PATH_gmp = \
 
 @if mpfr
 HOST_LIB_PATH_mpfr = \
-  $$r/$(HOST_SUBDIR)/mpfr/.libs:$$r/$(HOST_SUBDIR)/prev-mpfr/.libs:
+  $$r/$(HOST_SUBDIR)/mpfr/src/.libs:$$r/$(HOST_SUBDIR)/mpfr/.libs:$$r/$(HOST_SUBDIR)/prev-mpfr/.libs:
 @endif mpfr
 
 @if mpc
 HOST_LIB_PATH_mpc = \
-  $$r/$(HOST_SUBDIR)/mpc/.libs:$$r/$(HOST_SUBDIR)/prev-mpc/.libs:
+  $$r/$(HOST_SUBDIR)/mpc/src/.libs:$$r/$(HOST_SUBDIR)/prev-mpc/src/.libs:
 @endif mpc
 
 @if isl
@@ -11299,7 +11299,7 @@  all-gmp: configure-gmp
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/gmp && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS) AM_CFLAGS="-DNO_ASM" \
 		$(TARGET-gmp))
 @endif gmp
 
@@ -11328,7 +11328,7 @@  all-stage1-gmp: configure-stage1-gmp
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
 		$(EXTRA_HOST_FLAGS)  \
-		$(STAGE1_FLAGS_TO_PASS)  \
+		$(STAGE1_FLAGS_TO_PASS) AM_CFLAGS="-DNO_ASM" \
 		TFLAGS="$(STAGE1_TFLAGS)" \
 		$(TARGET-stage1-gmp)
 
@@ -11343,7 +11343,7 @@  clean-stage1-gmp:
 	fi; \
 	cd $(HOST_SUBDIR)/gmp && \
 	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-	$(STAGE1_FLAGS_TO_PASS)  clean
+	$(STAGE1_FLAGS_TO_PASS) AM_CFLAGS="-DNO_ASM" clean
 @endif gmp-bootstrap
 
 
@@ -11370,7 +11370,7 @@  all-stage2-gmp: configure-stage2-gmp
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) AM_CFLAGS="-DNO_ASM" \
 		TFLAGS="$(STAGE2_TFLAGS)" \
 		$(TARGET-stage2-gmp)
 
@@ -11384,7 +11384,7 @@  clean-stage2-gmp:
 	  $(MAKE) stage2-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gmp && \
-	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) AM_CFLAGS="-DNO_ASM" clean
 @endif gmp-bootstrap
 
 
@@ -11411,7 +11411,7 @@  all-stage3-gmp: configure-stage3-gmp
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) AM_CFLAGS="-DNO_ASM" \
 		TFLAGS="$(STAGE3_TFLAGS)" \
 		$(TARGET-stage3-gmp)
 
@@ -11425,7 +11425,7 @@  clean-stage3-gmp:
 	  $(MAKE) stage3-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gmp && \
-	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) AM_CFLAGS="-DNO_ASM" clean
 @endif gmp-bootstrap
 
 
@@ -11452,7 +11452,7 @@  all-stage4-gmp: configure-stage4-gmp
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) AM_CFLAGS="-DNO_ASM" \
 		TFLAGS="$(STAGE4_TFLAGS)" \
 		$(TARGET-stage4-gmp)
 
@@ -11466,7 +11466,7 @@  clean-stage4-gmp:
 	  $(MAKE) stage4-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gmp && \
-	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) AM_CFLAGS="-DNO_ASM" clean
 @endif gmp-bootstrap
 
 
@@ -11493,7 +11493,7 @@  all-stageprofile-gmp: configure-stageprofile-gmp
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) AM_CFLAGS="-DNO_ASM" \
 		TFLAGS="$(STAGEprofile_TFLAGS)" \
 		$(TARGET-stageprofile-gmp)
 
@@ -11507,7 +11507,7 @@  clean-stageprofile-gmp:
 	  $(MAKE) stageprofile-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gmp && \
-	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) AM_CFLAGS="-DNO_ASM" clean
 @endif gmp-bootstrap
 
 
@@ -11534,7 +11534,7 @@  all-stagefeedback-gmp: configure-stagefeedback-gmp
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) AM_CFLAGS="-DNO_ASM" \
 		TFLAGS="$(STAGEfeedback_TFLAGS)" \
 		$(TARGET-stagefeedback-gmp)
 
@@ -11548,7 +11548,7 @@  clean-stagefeedback-gmp:
 	  $(MAKE) stagefeedback-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gmp && \
-	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) AM_CFLAGS="-DNO_ASM" clean
 @endif gmp-bootstrap
 
 
@@ -11566,7 +11566,7 @@  check-gmp:
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
 	(cd $(HOST_SUBDIR)/gmp && \
-	  $(MAKE) $(FLAGS_TO_PASS)  $(EXTRA_BOOTSTRAP_FLAGS) check)
+	  $(MAKE) $(FLAGS_TO_PASS) AM_CFLAGS="-DNO_ASM" $(EXTRA_BOOTSTRAP_FLAGS) check)
 
 @endif gmp
 
@@ -11601,7 +11601,7 @@  info-gmp: \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) AM_CFLAGS="-DNO_ASM"; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing info in gmp"; \
@@ -11626,7 +11626,7 @@  dvi-gmp: \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) AM_CFLAGS="-DNO_ASM"; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing dvi in gmp"; \
@@ -11651,7 +11651,7 @@  pdf-gmp: \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) AM_CFLAGS="-DNO_ASM"; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing pdf in gmp"; \
@@ -11676,7 +11676,7 @@  html-gmp: \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) AM_CFLAGS="-DNO_ASM"; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing html in gmp"; \
@@ -11701,7 +11701,7 @@  TAGS-gmp: \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) AM_CFLAGS="-DNO_ASM"; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing TAGS in gmp"; \
@@ -11727,7 +11727,7 @@  install-info-gmp: \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) AM_CFLAGS="-DNO_ASM"; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing install-info in gmp"; \
@@ -11753,7 +11753,7 @@  install-pdf-gmp: \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) AM_CFLAGS="-DNO_ASM"; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing install-pdf in gmp"; \
@@ -11779,7 +11779,7 @@  install-html-gmp: \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) AM_CFLAGS="-DNO_ASM"; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing install-html in gmp"; \
@@ -11804,7 +11804,7 @@  installcheck-gmp: \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) AM_CFLAGS="-DNO_ASM"; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing installcheck in gmp"; \
@@ -11828,7 +11828,7 @@  mostlyclean-gmp:
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) AM_CFLAGS="-DNO_ASM"; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing mostlyclean in gmp"; \
@@ -11852,7 +11852,7 @@  clean-gmp:
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) AM_CFLAGS="-DNO_ASM"; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing clean in gmp"; \
@@ -11876,7 +11876,7 @@  distclean-gmp:
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) AM_CFLAGS="-DNO_ASM"; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing distclean in gmp"; \
@@ -11900,7 +11900,7 @@  maintainer-clean-gmp:
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) AM_CFLAGS="-DNO_ASM"; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing maintainer-clean in gmp"; \
Index: Makefile.tpl
===================================================================
--- Makefile.tpl	(revision 234490)
+++ Makefile.tpl	(working copy)
@@ -555,7 +555,8 @@  HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc$(GCC_SH
 [+ FOR host_modules +][+ IF lib_path +]
 @if [+module+]
 HOST_LIB_PATH_[+module+] = \
-  $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap
+  [+ IF lib_path2 +]$$r/$(HOST_SUBDIR)/[+module+]/[+lib_path2+]:[+ ENDIF
+  lib_path2 +]$$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap
   +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +]
 @endif [+module+]
 [+ ENDIF lib_path +][+ ENDFOR host_modules +]