Patchwork set MULTIARCH_DIRNAME for multilib architectures

login
register
mail settings
Submitter Matthias Klose
Date June 12, 2013, 2:21 p.m.
Message ID <51B88407.9000508@ubuntu.com>
Download mbox | patch
Permalink /patch/250801/
State New
Headers show

Comments

Matthias Klose - June 12, 2013, 2:21 p.m.
[CCing port maintainers]

Currently the MULTIARCH_DIRNAME is not correctly set for the x86_64-kfreebsd-gnu
target, and is not set at all for architectures which do have multilib
configurations by default.  This patch makes sure that MULTIARCH_DIRNAME is
always set to the default multilib configuration for these multilib targets.

I am using this macro in a local patch which installs the host specific C++
headers to /usr/include/$(MULTIARCH_DIRNAME)/c++/4.x.y instead of
$(gcc_gxx_include_dir)/$(target_noncanonical).

Ok for the trunk?

  Matthias
2013-06-12  Matthias Klose  <doko@ubuntu.com>

	* config/i386/t-linux64: Set MULTIARCH_DIRNAME.
	* config/i386/t-kfreebsd: Set MULTIARCH_DIRNAME.
	* config.gcc (i[34567]86-*-linux* | x86_64-*-linux*): Prepend
	i386/t-linux to $tmake_file.
	* config/mips/t-linux64: Set MULTIARCH_DIRNAME.
	* config/rs6000/t-linux64: Set MULTIARCH_DIRNAME.
	* config/s390/t-linux64: Set MULTIARCH_DIRNAME.
	* config/sparc/t-linux64: Set MULTIARCH_DIRNAME.
Richard Sandiford - June 12, 2013, 6:20 p.m.
Matthias Klose <doko@ubuntu.com> writes:
> Index: config/mips/t-linux64
> ===================================================================
> --- config/mips/t-linux64	(revision 200012)
> +++ config/mips/t-linux64	(working copy)
> @@ -24,3 +24,13 @@
>  	../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
>  	../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
>  	../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
> +
> +ifneq (,$(findstring abin32,$(target)))
> +MULTIARCH_DIRNAME = $(call if_multiarch,mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT))
> +else
> +ifneq (,$(findstring abi64,$(target)))
> +MULTIARCH_DIRNAME = $(call if_multiarch,mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
> +else
> +MULTIARCH_DIRNAME = $(call if_multiarch,mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT))
> +endif
> +endif

findstring seems a bit fragile for a full triple.  I think it would
be better to have something similar to the current MIPS_SOFT definition:

MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft)

but for ABIs.  It could then also take with_abi into account.
Maybe something like:

MIPS_ABI = $(or $(with_abi), \
                $(if $(filter MIPS_ABI_DEFAULT=ABI_N32, \
			      $(target_cpu_default)), n32), \
                o32)

(completely untested).

Thanks,
Richard
aldot - June 13, 2013, 6:45 a.m.
On 12 June 2013 20:20:50 Richard Sandiford <rdsandiford@googlemail.com> wrote:
> Matthias Klose <doko@ubuntu.com> writes:
> > Index: config/mips/t-linux64
> > ===================================================================
> > --- config/mips/t-linux64	(revision 200012)
> > +++ config/mips/t-linux64	(working copy)
> > @@ -24,3 +24,13 @@
> >  	../lib32$(call 
> if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
> >  	../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
> >  	../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
> > +
> > +ifneq (,$(findstring abin32,$(target)))
> > +MULTIARCH_DIRNAME = $(call 
> if_multiarch,mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT))
> > +else
> > +ifneq (,$(findstring abi64,$(target)))
> > +MULTIARCH_DIRNAME = $(call 
> if_multiarch,mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
> > +else
> > +MULTIARCH_DIRNAME = $(call 
> if_multiarch,mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT))
> > +endif
> > +endif
>
> findstring seems a bit fragile for a full triple.  I think it would
> be better to have something similar to the current MIPS_SOFT definition:
>
> MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, 
> $(target_cpu_default)) $(filter soft, $(with_float))),soft)
>
> but for ABIs.  It could then also take with_abi into account.
> Maybe something like:
>
> MIPS_ABI = $(or $(with_abi), \
>                 $(if $(filter MIPS_ABI_DEFAULT=ABI_N32, \
> 			      $(target_cpu_default)), n32), \
>                 o32)
>
> (completely untested).

Bikeshedding:
Doko would know, but ISTR that $(or) did not exist in make-3.80 which is 
currently the minimum prerequisite, fwiw.


Sent with AquaMail for Android
http://www.aqua-mail.com
Richard Sandiford - June 13, 2013, 9:42 a.m.
"Bernhard Reutner-Fischer" <rep.dot.nop@gmail.com> writes:
> On 12 June 2013 20:20:50 Richard Sandiford <rdsandiford@googlemail.com> wrote:
>> Matthias Klose <doko@ubuntu.com> writes:
>> > Index: config/mips/t-linux64
>> > ===================================================================
>> > --- config/mips/t-linux64	(revision 200012)
>> > +++ config/mips/t-linux64	(working copy)
>> > @@ -24,3 +24,13 @@
>> >  	../lib32$(call 
>> if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
>> >  	../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
>> >  	../lib64$(call
>> > if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
>> > +
>> > +ifneq (,$(findstring abin32,$(target)))
>> > +MULTIARCH_DIRNAME = $(call 
>> if_multiarch,mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT))
>> > +else
>> > +ifneq (,$(findstring abi64,$(target)))
>> > +MULTIARCH_DIRNAME = $(call 
>> if_multiarch,mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
>> > +else
>> > +MULTIARCH_DIRNAME = $(call 
>> if_multiarch,mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT))
>> > +endif
>> > +endif
>>
>> findstring seems a bit fragile for a full triple.  I think it would
>> be better to have something similar to the current MIPS_SOFT definition:
>>
>> MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, 
>> $(target_cpu_default)) $(filter soft, $(with_float))),soft)
>>
>> but for ABIs.  It could then also take with_abi into account.
>> Maybe something like:
>>
>> MIPS_ABI = $(or $(with_abi), \
>>                 $(if $(filter MIPS_ABI_DEFAULT=ABI_N32, \
>> 			      $(target_cpu_default)), n32), \
>>                 o32)
>>
>> (completely untested).
>
> Bikeshedding:
> Doko would know, but ISTR that $(or) did not exist in make-3.80 which is 
> currently the minimum prerequisite, fwiw.

Gah, that's a pity.  Thanks for the catch though.  Maybe firstword
would be OK instead.

I see I also fell into the usual ABI trap.  It wouldn't have affected
the use in this patch, but the default ought to be "32" rather than "o32".

Thanks,
Richard
Matthias Klose - June 20, 2013, 12:26 p.m.
Am 13.06.2013 11:42, schrieb Richard Sandiford:
> "Bernhard Reutner-Fischer" <rep.dot.nop@gmail.com> writes:
>> On 12 June 2013 20:20:50 Richard Sandiford <rdsandiford@googlemail.com> wrote:
>>> Matthias Klose <doko@ubuntu.com> writes:
>>>> Index: config/mips/t-linux64
>>>> ===================================================================
>>>> --- config/mips/t-linux64	(revision 200012)
>>>> +++ config/mips/t-linux64	(working copy)
>>>> @@ -24,3 +24,13 @@
>>>>  	../lib32$(call 
>>> if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
>>>>  	../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
>>>>  	../lib64$(call
>>>> if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
>>>> +
>>>> +ifneq (,$(findstring abin32,$(target)))
>>>> +MULTIARCH_DIRNAME = $(call 
>>> if_multiarch,mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT))
>>>> +else
>>>> +ifneq (,$(findstring abi64,$(target)))
>>>> +MULTIARCH_DIRNAME = $(call 
>>> if_multiarch,mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
>>>> +else
>>>> +MULTIARCH_DIRNAME = $(call 
>>> if_multiarch,mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT))
>>>> +endif
>>>> +endif
>>>
>>> findstring seems a bit fragile for a full triple.  I think it would
>>> be better to have something similar to the current MIPS_SOFT definition:
>>>
>>> MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, 
>>> $(target_cpu_default)) $(filter soft, $(with_float))),soft)
>>>
>>> but for ABIs.  It could then also take with_abi into account.
>>> Maybe something like:
>>>
>>> MIPS_ABI = $(or $(with_abi), \
>>>                 $(if $(filter MIPS_ABI_DEFAULT=ABI_N32, \
>>> 			      $(target_cpu_default)), n32), \
>>>                 o32)
>>>
>>> (completely untested).
>>
>> Bikeshedding:
>> Doko would know, but ISTR that $(or) did not exist in make-3.80 which is 
>> currently the minimum prerequisite, fwiw.
> 
> Gah, that's a pity.  Thanks for the catch though.  Maybe firstword
> would be OK instead.
> 
> I see I also fell into the usual ABI trap.  It wouldn't have affected
> the use in this patch, but the default ought to be "32" rather than "o32".

the define is in tm_defines, not target_cpu_default.

MIPS_ABI = $(or $(with_abi), \
                $(if $(filter MIPS_ABI_DEFAULT=ABI_N32, \
			      $(tm_defines)), n32), \
                 32)

However I can't see yet how this should be used. Maybe Aurelian could come up
with a tested version of this patch?

  Matthias
Aurelien Jarno - June 20, 2013, 8:43 p.m.
On Thu, Jun 20, 2013 at 02:26:12PM +0200, Matthias Klose wrote:
> Am 13.06.2013 11:42, schrieb Richard Sandiford:
> > "Bernhard Reutner-Fischer" <rep.dot.nop@gmail.com> writes:
> >> On 12 June 2013 20:20:50 Richard Sandiford <rdsandiford@googlemail.com> wrote:
> >>> Matthias Klose <doko@ubuntu.com> writes:
> >>>> Index: config/mips/t-linux64
> >>>> ===================================================================
> >>>> --- config/mips/t-linux64	(revision 200012)
> >>>> +++ config/mips/t-linux64	(working copy)
> >>>> @@ -24,3 +24,13 @@
> >>>>  	../lib32$(call 
> >>> if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
> >>>>  	../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
> >>>>  	../lib64$(call
> >>>> if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
> >>>> +
> >>>> +ifneq (,$(findstring abin32,$(target)))
> >>>> +MULTIARCH_DIRNAME = $(call 
> >>> if_multiarch,mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT))
> >>>> +else
> >>>> +ifneq (,$(findstring abi64,$(target)))
> >>>> +MULTIARCH_DIRNAME = $(call 
> >>> if_multiarch,mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
> >>>> +else
> >>>> +MULTIARCH_DIRNAME = $(call 
> >>> if_multiarch,mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT))
> >>>> +endif
> >>>> +endif
> >>>
> >>> findstring seems a bit fragile for a full triple.  I think it would
> >>> be better to have something similar to the current MIPS_SOFT definition:
> >>>
> >>> MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, 
> >>> $(target_cpu_default)) $(filter soft, $(with_float))),soft)
> >>>
> >>> but for ABIs.  It could then also take with_abi into account.
> >>> Maybe something like:
> >>>
> >>> MIPS_ABI = $(or $(with_abi), \
> >>>                 $(if $(filter MIPS_ABI_DEFAULT=ABI_N32, \
> >>> 			      $(target_cpu_default)), n32), \
> >>>                 o32)
> >>>
> >>> (completely untested).
> >>
> >> Bikeshedding:
> >> Doko would know, but ISTR that $(or) did not exist in make-3.80 which is 
> >> currently the minimum prerequisite, fwiw.
> > 
> > Gah, that's a pity.  Thanks for the catch though.  Maybe firstword
> > would be OK instead.
> > 
> > I see I also fell into the usual ABI trap.  It wouldn't have affected
> > the use in this patch, but the default ought to be "32" rather than "o32".
> 
> the define is in tm_defines, not target_cpu_default.
> 
> MIPS_ABI = $(or $(with_abi), \
>                 $(if $(filter MIPS_ABI_DEFAULT=ABI_N32, \
> 			      $(tm_defines)), n32), \
>                  32)
> 
> However I can't see yet how this should be used. Maybe Aurelian could come up
> with a tested version of this patch?
> 

I don't have a lot of time right now, will look at that in details next
week.

Patch

Index: config/sparc/t-linux64
===================================================================
--- config/sparc/t-linux64	(revision 200012)
+++ config/sparc/t-linux64	(working copy)
@@ -27,3 +27,5 @@ 
 MULTILIB_DIRNAMES = 64 32
 MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:sparc64-linux-gnu)
 MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:sparc-linux-gnu)
+
+MULTIARCH_DIRNAME = $(call if_multiarch,sparc$(if $(findstring 64,$(target)),64)-linux-gnu)
Index: config/mips/t-linux64
===================================================================
--- config/mips/t-linux64	(revision 200012)
+++ config/mips/t-linux64	(working copy)
@@ -24,3 +24,13 @@ 
 	../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
 	../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
 	../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
+
+ifneq (,$(findstring abin32,$(target)))
+MULTIARCH_DIRNAME = $(call if_multiarch,mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT))
+else
+ifneq (,$(findstring abi64,$(target)))
+MULTIARCH_DIRNAME = $(call if_multiarch,mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
+else
+MULTIARCH_DIRNAME = $(call if_multiarch,mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT))
+endif
+endif
Index: config/rs6000/t-linux64
===================================================================
--- config/rs6000/t-linux64	(revision 200012)
+++ config/rs6000/t-linux64	(working copy)
@@ -30,3 +30,5 @@ 
 MULTILIB_EXTRA_OPTS     = fPIC
 MULTILIB_OSDIRNAMES	= ../lib64$(call if_multiarch,:powerpc64-linux-gnu)
 MULTILIB_OSDIRNAMES    += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
+
+MULTIARCH_DIRNAME = $(call if_multiarch,powerpc$(if $(findstring 64,$(target)),64)-linux-gnu)
Index: config/s390/t-linux64
===================================================================
--- config/s390/t-linux64	(revision 200012)
+++ config/s390/t-linux64	(working copy)
@@ -9,3 +9,5 @@ 
 MULTILIB_DIRNAMES = 64 32
 MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:s390x-linux-gnu)
 MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:s390-linux-gnu)
+
+MULTIARCH_DIRNAME = $(call if_multiarch,s390$(if $(findstring s390x,$(target)),x)-linux-gnu)
Index: config/i386/t-kfreebsd
===================================================================
--- config/i386/t-kfreebsd	(revision 200012)
+++ config/i386/t-kfreebsd	(working copy)
@@ -1,5 +1,9 @@ 
-MULTIARCH_DIRNAME = $(call if_multiarch,i386-kfreebsd-gnu)
+ifeq (,$(MULTIARCH_DIRNAME))
+  MULTIARCH_DIRNAME = $(call if_multiarch,i386-kfreebsd-gnu)
+endif
 
 # MULTILIB_OSDIRNAMES are set in t-linux64.
 KFREEBSD_OS = $(filter kfreebsd%, $(word 3, $(subst -, ,$(target))))
 MULTILIB_OSDIRNAMES := $(filter-out mx32=%,$(subst linux,$(KFREEBSD_OS),$(MULTILIB_OSDIRNAMES)))
+
+MULTIARCH_DIRNAME := $(subst linux,$(KFREEBSD_OS),$(MULTIARCH_DIRNAME))
Index: config/i386/t-linux64
===================================================================
--- config/i386/t-linux64	(revision 200012)
+++ config/i386/t-linux64	(working copy)
@@ -36,3 +36,13 @@ 
 MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
 MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
 MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
+
+ifneq (,$(findstring x86_64,$(target)))
+  ifneq (,$(findstring biarchx32.h,$(tm_include_list)))
+  MULTIARCH_DIRNAME = $(call if_multiarch,x86_64-linux-gnux32)
+  else
+  MULTIARCH_DIRNAME = $(call if_multiarch,x86_64-linux-gnu)
+  endif
+else
+  MULTIARCH_DIRNAME = $(call if_multiarch,i386-linux-gnu)
+endif
Index: config.gcc
===================================================================
--- config.gcc	(revision 200012)
+++ config.gcc	(working copy)
@@ -3738,7 +3738,7 @@ 
 	i[34567]86-*-darwin* | x86_64-*-darwin*)
 		;;
 	i[34567]86-*-linux* | x86_64-*-linux*)
-		tmake_file="$tmake_file i386/t-linux"
+		tmake_file="i386/t-linux $tmake_file"
 		;;
 	i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu)
 		tmake_file="$tmake_file i386/t-kfreebsd"