Patchwork support for multiarch systems

login
register
mail settings
Submitter Thomas Schwinge
Date June 6, 2012, 2:02 p.m.
Message ID <874nqomtbi.fsf@schwinge.name>
Download mbox | patch
Permalink /patch/163383/
State Superseded, archived
Headers show

Comments

Thomas Schwinge - June 6, 2012, 2:02 p.m.
Hi!

On Sat, 19 May 2012 18:05:30 +0200, I wrote:
> On Wed, 09 May 2012 02:38:11 +0200, Matthias Klose <doko@ubuntu.com> wrote:
> > ok, the attached patch includes just the support for the x86 targets, including
> > the kfreebsd and the hurd systems. The x32 multiarch tuple isn't yet defined, so
> > I'd like to keep it out of the first version.
> 
> I will test this on/for GNU/Hurd next week (hopefully)

I have now completed this testing: the patch does work correctly when
natively building i686-linux-gnu on Debian GNU/Linux as well as i686-gnu
on Debian GNU/Hurd, and also when building a i686-linux-gnu to i686-gnu
cross-compiler which is not using the Debian multiarch arrangement.

> but here are
> already two comments.
> 
> > Index: gcc/Makefile.in
> > ===================================================================
> > --- gcc/Makefile.in	(revision 187271)
> > +++ gcc/Makefile.in	(working copy)
> > @@ -350,6 +350,17 @@
> >  
> >  enable_plugin = @enable_plugin@
> >  
> > +# Multiarch support
> > +enable_multiarch = @enable_multiarch@
> > +with_float = @with_float@
> > +ifeq ($(enable_multiarch),yes)
> > +  if_multiarch = $(1)
> > +else ifeq ($(enable_multiarch),auto-detect)
> > +  if_multiarch = $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib/*/crti.o),$(1))
> > +else
> > +  if_multiarch =
> > +endif
> 
> The auto-detection won't work for cases where native_system_header_dir
> (as per config.gcc; or command-line argument) is not /usr/include.

This does not really bother me, as my GNU/Hurd configurations also use
/usr/include as opposed to /include, and the auto-detection will work for
that case.

> > Index: gcc/config.gcc
> > ===================================================================
> > --- gcc/config.gcc	(revision 187271)
> > +++ gcc/config.gcc	(working copy)
> > @@ -3472,10 +3476,14 @@
> >  
> >  	i[34567]86-*-darwin* | x86_64-*-darwin*)
> >  		;;
> > -	i[34567]86-*-linux* | x86_64-*-linux* | \
> > -	  i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu | \
> > -	  i[34567]86-*-gnu*)
> > +	i[34567]86-*-linux* | x86_64-*-linux*)
> >  		;;
> > +	i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu)
> > +		tmake_file="${tmake_file} i386/t-linux i386/t-kfreebsd"
> > +		;;
> > +	i[34567]86-*-gnu*)
> > +		tmake_file="${tmake_file} i386/t-linux i386/t-gnu"
> > +		;;
> 
> > Index: gcc/config/i386/t-linux
> > ===================================================================
> > --- gcc/config/i386/t-linux	(revision 0)
> > +++ gcc/config/i386/t-linux	(revision 0)
> > @@ -0,0 +1 @@
> > +MULTIARCH_DIRNAME = $(call if_multiarch,i386-linux-gnu)
> > Index: gcc/config/i386/t-gnu
> > ===================================================================
> > --- gcc/config/i386/t-gnu	(revision 0)
> > +++ gcc/config/i386/t-gnu	(revision 0)
> > @@ -0,0 +1 @@
> > +MULTIARCH_DIRNAME = $(call if_multiarch,i386-gnu)
> 
> > Index: gcc/config/i386/t-kfreebsd
> > ===================================================================
> > --- gcc/config/i386/t-kfreebsd	(revision 0)
> > +++ gcc/config/i386/t-kfreebsd	(revision 0)
> > @@ -0,0 +1,5 @@
> > +MULTIARCH_DIRNAME = $(call if_multiarch,i386-kfreebsd-gnu)
> > +
> > +# MULTILIB_OSDIRNAMES are set in t-linux64.
> > +KFREEBSD_OS = $(filter kfreebsd%, $(word 3, $(subst -, ,$(target))))
> > +MULTILIB_OSDIRNAMES := $(subst linux,$(KFREEBSD_OS),$(MULTILIB_OSDIRNAMES))
> 
> As of 2011-11-02 (a997b0d8a7b720578f40c0f9f7767bac02022e0b, r180767)
> there was no i386/t-linux anymore, and you're now re-introducing it, so
> you'll need to re-add it for the *-linux* cases cited above, but also
> remove it from the other *-gnu* cases.

gcc/
	* config.gcc <i[34567]86-*-linux* | x86_64-*-linux*> (tmake_file):
	Include i386/t-linux.
	<i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu> (tmake_file):
	Include i386/t-kfreebsd.
	<i[34567]86-*-gnu*> (tmake_file): Include i386/t-gnu.



Grüße,
 Thomas

Patch

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 7ec184c..39c70f2 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3481,9 +3481,14 @@  case ${target} in
 
 	i[34567]86-*-darwin* | x86_64-*-darwin*)
 		;;
-	i[34567]86-*-linux* | x86_64-*-linux* | \
-	  i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu | \
-	  i[34567]86-*-gnu*)
+	i[34567]86-*-linux* | x86_64-*-linux*)
+		tmake_file="$tmake_file i386/t-linux"
+		;;
+	i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu)
+		tmake_file="$tmake_file i386/t-kfreebsd"
+		;;
+	i[34567]86-*-gnu*)
+		tmake_file="$tmake_file i386/t-gnu"
 		;;
 	i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]*)
 		;;