From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from xry111.site (xry111.site [IPv6:2001:470:683e::1]) by sourceware.org (Postfix) with ESMTPS id 92DA03857426 for ; Wed, 21 Sep 2022 15:08:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 92DA03857426 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xry111.site DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1663772934; bh=U+qVyBs8hFEvhuC59xbaCGnaVFlH799IcOmQhjuNT/o=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=h0HcrFIS3wO0V8ceqi/kpzv0z0oUJouLnqphT4rPXTJ0c8W0UgSfTzf+mqTF0bSUl outdhEOAMePjmCgw6oO/RDMsAf63NKSXOREF5bNLIvaq0NyB1/2ngk2qXu154eCnne tZGgg80SbP+P69QJm2AmHfetYNyWRTjow5IWypTU= Received: from localhost.localdomain (xry111.site [IPv6:2001:470:683e::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 71DE7667D5; Wed, 21 Sep 2022 11:08:53 -0400 (EDT) Message-ID: Subject: Re: [PATCH] MIPS: fix building on multiarch platform From: Xi Ruoyao To: YunQiang Su , gcc-patches@gcc.gnu.org Cc: macro@orcam.me.uk, doko@debian.org, jeffreyalaw@gmail.com Date: Wed, 21 Sep 2022 23:08:51 +0800 In-Reply-To: <20220921113118.520824-1-yunqiang.su@cipunited.com> References: <20220921113118.520824-1-yunqiang.su@cipunited.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.0 MIME-Version: 1.0 X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FROM_SUSPICIOUS_NTLD,GIT_PATCH_0,LIKELY_SPAM_FROM,SPF_HELO_PASS,SPF_PASS,TXREP,T_PDS_OTHER_BAD_TLD autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, 2022-09-21 at 11:31 +0000, YunQiang Su wrote: > On platforms that support multiarch, such as Debian, > the filesystem hierarchy doesn't fellow the old Irix style: > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0lib & lib/ for= native > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0lib64 for N64 on N32/O32 = systems > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0lib32 for N32 on N64/O32 = systems > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0libo32 for O32 on N64/N32= systems >=20 > Thus we cannot > =C2=A0#define STANDARD_STARTFILE_PREFIX_1 > =C2=A0#define STANDARD_STARTFILE_PREFIX_2 > on N32 or N64 systems, else collect2 won't look for libraries > on /lib/. >=20 > gcc/ChangeLog: > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* configure.ac: AC_DEFINE= (ENABLE_MULTIARCH, 1) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* configure: Regenerated. > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* config.in: Regenerated. > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* config/mips/mips.h: don= 't define STANDARD_STARTFILE_PREFIX_1 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if ENABLE_MULTIARC= H is defined. > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* config/mips/t-linux64: = define correct multiarch path when > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 multiarch is enabl= ed. > --- > =C2=A0gcc/config.in=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 |=C2=A0 6 ++++++ > =C2=A0gcc/config/mips/mips.h=C2=A0=C2=A0=C2=A0 |=C2=A0 2 ++ > =C2=A0gcc/config/mips/t-linux64 | 21 ++++++++++++++++++++- > =C2=A0gcc/configure=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 |=C2=A0 4 ++++ > =C2=A0gcc/configure.ac=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 |=C2=A0 3 +++ > =C2=A05 files changed, 35 insertions(+), 1 deletion(-) >=20 > diff --git a/gcc/config.in b/gcc/config.in > index 6ac17be189e..b2ce6361327 100644 > --- a/gcc/config.in > +++ b/gcc/config.in > @@ -2312,6 +2312,12 @@ > =C2=A0#endif > =C2=A0 > =C2=A0 > +/* Specify if mutliarch is enabled. */ > +#ifndef USED_FOR_TARGET > +#undef ENABLE_MULTIARCH > +#endif > + > + > =C2=A0/* The size of `dev_t', as computed by sizeof. */ > =C2=A0#ifndef USED_FOR_TARGET > =C2=A0#undef SIZEOF_DEV_T > diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h > index 74b6e11aabb..fe7f5b274b9 100644 > --- a/gcc/config/mips/mips.h > +++ b/gcc/config/mips/mips.h > @@ -3427,6 +3427,7 @@ struct GTY(())=C2=A0 machine_function { > =C2=A0 > =C2=A0/* If we are *not* using multilibs and the default ABI is not ABI_3= 2 > we > =C2=A0=C2=A0=C2=A0 need to change these from /lib and /usr/lib.=C2=A0 */ > +#ifndef ENABLE_MULTIARCH > =C2=A0#if MIPS_ABI_DEFAULT =3D=3D ABI_N32 > =C2=A0#define STANDARD_STARTFILE_PREFIX_1 "/lib32/" > =C2=A0#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib32/" > @@ -3434,6 +3435,7 @@ struct GTY(())=C2=A0 machine_function { > =C2=A0#define STANDARD_STARTFILE_PREFIX_1 "/lib64/" > =C2=A0#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib64/" > =C2=A0#endif > +#endif Should we just remove STANDARD_STARTFILE_PREFIX_{1,2} unconditionally?=20 I just took a look and the only Linux ports using these macros are MIPS and LoongArch (borrowed these macros from MIPS, I guess). On a non- multilib distro /usr/lib is likely used, and on multilib distros the macros are not used anyway. > =C2=A0/* Load store bonding is not supported by micromips and fix_24k.=C2= =A0 The > =C2=A0=C2=A0=C2=A0 performance can be degraded for those targets.=C2=A0 H= ence, do not bond for > diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64 > index 2fdd8e00407..37d176ea309 100644 > --- a/gcc/config/mips/t-linux64 > +++ b/gcc/config/mips/t-linux64 > @@ -20,7 +20,26 @@ MULTILIB_OPTIONS =3D mabi=3Dn32/mabi=3D32/mabi=3D64 > =C2=A0MULTILIB_DIRNAMES =3D n32 32 64 > =C2=A0MIPS_EL =3D $(if $(filter %el, $(firstword $(subst -, ,$(target))))= ,el) > =C2=A0MIPS_SOFT =3D $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_c= pu_default)) $(filter soft, $(with_float))),soft) > -MULTILIB_OSDIRNAMES =3D \ > +ifeq (yes,$(enable_multiarch)) > +=C2=A0 ifneq (,$(findstring gnuabi64,$(target))) > +=C2=A0=C2=A0=C2=A0 MULTILIB_OSDIRNAMES =3D \ > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0../lib32$(call if_multiarch,:m= ips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \ > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0../libo32$(call if_multiarch,:= mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \ > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0../lib$(call if_multiarch,:mip= s64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT)) > +=C2=A0 else ifneq (,$(findstring gnuabin32,$(target))) > +=C2=A0=C2=A0=C2=A0 MULTILIB_OSDIRNAMES =3D \ > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0../lib$(call if_multiarch,:mip= s64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \ > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0../libo32$(call if_multiarch,:= mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \ > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0../lib64$(call if_multiarch,:m= ips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT)) > +=C2=A0 else > +=C2=A0=C2=A0=C2=A0 MULTILIB_OSDIRNAMES =3D \ > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0../lib32$(call if_multiarch,:m= ips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \ > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0../lib$(call if_multiarch,:mip= s$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \ > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0../lib64$(call if_multiarch,:m= ips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT)) > +=C2=A0 endif > +else > +=C2=A0 MULTILIB_OSDIRNAMES =3D \ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0../lib32$(call if_multiar= ch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0../lib$(call if_multiarch= ,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0../lib64$(call if_multiar= ch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT)) > +endif Hmm, I don't think we should touch this. The default setting of MULTILIB_OSDIRNAMES is simply not designed to suit all distros (at least for now) and many distros are patching it. Change it here won't give the distro maintainers any benefit, but will force them to rebase the patch. If we want to make the distro maintainers' life easier we'd make a global decision (for all ports) and maybe add some configuration options for MULTILIB_OSDIRNAMES. --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University