From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-xe2c.google.com (mail-vs1-xe2c.google.com [IPv6:2607:f8b0:4864:20::e2c]) by sourceware.org (Postfix) with ESMTPS id F1D9F3858C52 for ; Fri, 23 Sep 2022 12:35:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F1D9F3858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-vs1-xe2c.google.com with SMTP id j17so13539717vsp.5 for ; Fri, 23 Sep 2022 05:35:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date; bh=OoI3HYvJn4t99bccfyw57OFSDg/lEewfoW0sOqcHhF4=; b=LKVaG2KB8jYitsGQi8jJT5QXkQqnie9vMPtluvUv2v79gXZUloFL5uMdli98ZxHfW/ rke+CnJOGLfNJrdsgAHBz1zDnoBAAwKdwAc4Ee8IHcAvu628YLieBmutC1v+T4uVk0kR v88y0A4jI9l+nOPx6ZJsAARFimXzNp/5CGpcMdFcckUgxv8Co7BzF1r+XvsfEPLdKl6o LtJElp1Tc+7QC3av7fOouK7PpnVdqBpHvxF00nx0oQRRNVQGvSEqOr0Bxbn84U/emRWV Cw7Y300fhXEWzIh8+VTHcalaGeuykvnk6Ut5uctxI1x9aWKsj2cbLxTDAJXDhgwbZpSg c3yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date; bh=OoI3HYvJn4t99bccfyw57OFSDg/lEewfoW0sOqcHhF4=; b=MpvwNSdolSEc0xXp7Uz8k+u0vod1o2Nt2O39BToD/KJ9/kiaT8tTT9kNYlGVpJoYMZ PxD71blUuIWyUZ+2/cIBZev7Rw24TszCh5F088uyleYJzlKdLOeZ9xVG5PLIFvBkasU1 q/LuzRwswi34tcbwURIebBvIm1nVtPleUlODd+CZZ7GDDAsqSoxiNP4OozYl4yTVwTxB SyizZF6xhyTdUCMgR8Q7uhI9VsIdzi2l9382NfMQQNZkWIEYK/YUCLrhSHANtn5kQM21 4TvC4foZfpywbv/VTdP+t3uVKnuLnXboAycGp3aNic3PfRrAQ/axGvWBilRcNmYXrPw+ 4CUg== X-Gm-Message-State: ACrzQf1A/CfTjjyK7b241otuvTfi4UccbPqXTMAyeVjybKqeQobFFsjl uldNwmxKNM6puC0TAHcTP+hMewfSLV5eBL8BvFk= X-Google-Smtp-Source: AMsMyM4wj6CJ+DFgbrE7iLm3LU/z3GHhO5+Qi/Mkcw5L6ZxUzIQ1R2uSqP9uES/HOvSp46CCv5Rco5YjUEr85lvE6RE= X-Received: by 2002:a05:6102:2224:b0:390:5a5e:59a2 with SMTP id d4-20020a056102222400b003905a5e59a2mr3178159vsb.59.1663936531387; Fri, 23 Sep 2022 05:35:31 -0700 (PDT) MIME-Version: 1.0 References: <20220921113118.520824-1-yunqiang.su@cipunited.com> In-Reply-To: From: YunQiang Su Date: Fri, 23 Sep 2022 20:35:19 +0800 Message-ID: Subject: Re: [PATCH] MIPS: fix building on multiarch platform To: Xi Ruoyao Cc: YunQiang Su , apinski--- via Gcc-patches , Matthias Klose , "Maciej W. Rozycki" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP 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: Xi Ruoyao via Gcc-patches =E4=BA=8E2022=E5=B9=B49= =E6=9C=8821=E6=97=A5=E5=91=A8=E4=B8=89 23:09=E5=86=99=E9=81=93=EF=BC=9A > > 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: > > lib & lib/ for native > > lib64 for N64 on N32/O32 systems > > lib32 for N32 on N64/O32 systems > > libo32 for O32 on N64/N32 systems > > > > Thus we cannot > > #define STANDARD_STARTFILE_PREFIX_1 > > #define STANDARD_STARTFILE_PREFIX_2 > > on N32 or N64 systems, else collect2 won't look for libraries > > on /lib/. > > > > gcc/ChangeLog: > > * configure.ac: AC_DEFINE(ENABLE_MULTIARCH, 1) > > * configure: Regenerated. > > * config.in: Regenerated. > > * config/mips/mips.h: don't define STANDARD_STARTFILE_PREFIX_1 > > if ENABLE_MULTIARCH is defined. > > * config/mips/t-linux64: define correct multiarch path when > > multiarch is enabled. > > --- > > gcc/config.in | 6 ++++++ > > gcc/config/mips/mips.h | 2 ++ > > gcc/config/mips/t-linux64 | 21 ++++++++++++++++++++- > > gcc/configure | 4 ++++ > > gcc/configure.ac | 3 +++ > > 5 files changed, 35 insertions(+), 1 deletion(-) > > > > 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 @@ > > #endif > > > > > > +/* Specify if mutliarch is enabled. */ > > +#ifndef USED_FOR_TARGET > > +#undef ENABLE_MULTIARCH > > +#endif > > + > > + > > /* The size of `dev_t', as computed by sizeof. */ > > #ifndef USED_FOR_TARGET > > #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(()) machine_function { > > > > /* If we are *not* using multilibs and the default ABI is not ABI_32 > > we > > need to change these from /lib and /usr/lib. */ > > +#ifndef ENABLE_MULTIARCH > > #if MIPS_ABI_DEFAULT =3D=3D ABI_N32 > > #define STANDARD_STARTFILE_PREFIX_1 "/lib32/" > > #define STANDARD_STARTFILE_PREFIX_2 "/usr/lib32/" > > @@ -3434,6 +3435,7 @@ struct GTY(()) machine_function { > > #define STANDARD_STARTFILE_PREFIX_1 "/lib64/" > > #define STANDARD_STARTFILE_PREFIX_2 "/usr/lib64/" > > #endif > > +#endif > > Should we just remove STANDARD_STARTFILE_PREFIX_{1,2} unconditionally? > 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. > Yes. As Maciej pointed, the old mips style for MIPS filesystem hierarchy is quite quirk. This is from Irix. It does make lots of trouble for distribution makers to support multilib for mips64, since On non-multilib distributions, like OpenWrt for mips64, lib is used, and lib64 is a symlink to lib. While on multilib-enabled ports, like Fedora, the old Irix style is used. So, we should keep the code. > > /* Load store bonding is not supported by micromips and fix_24k. The > > performance can be degraded for those targets. Hence, 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 > > MULTILIB_DIRNAMES =3D n32 32 64 > > MIPS_EL =3D $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el= ) > > MIPS_SOFT =3D $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_= default)) $(filter soft, $(with_float))),soft) > > -MULTILIB_OSDIRNAMES =3D \ > > +ifeq (yes,$(enable_multiarch)) > > + ifneq (,$(findstring gnuabi64,$(target))) > > + MULTILIB_OSDIRNAMES =3D \ > > + ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(= MIPS_SOFT)) \ > > + ../libo32$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SO= FT)) \ > > + ../lib$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIP= S_SOFT)) > > + else ifneq (,$(findstring gnuabin32,$(target))) > > + MULTILIB_OSDIRNAMES =3D \ > > + ../lib$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MI= PS_SOFT)) \ > > + ../libo32$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SO= FT)) \ > > + ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(M= IPS_SOFT)) > > + else > > + MULTILIB_OSDIRNAMES =3D \ > > + ../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$(M= IPS_SOFT)) > > + endif > > +else > > + MULTILIB_OSDIRNAMES =3D \ > > ../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$(M= IPS_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. > It is not for distro: this patch try to fix the build gcc from source on De= bian. Aka, currently, gcc ftbfs on Debian MIPS with simple: ./configure && make. > 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. > > > -- > Xi Ruoyao > School of Aerospace Science and Technology, Xidian University --=20 YunQiang Su