From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from xry111.site (xry111.site [89.208.246.23]) by sourceware.org (Postfix) with ESMTPS id 0347E385840C; Wed, 6 Sep 2023 10:38:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0347E385840C 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=1693996708; bh=jUnAOK1uoN22y9ZZeQnRwA6k5sLSgRG/ES4zx+iH0dE=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=UIBFRE7NHsufSayyM7IzGmj7nuROQaUVHOOmgxQYqcx37L5V+wTtTFh1Wmh1a5swh AO11SsxbISvTbOCTEr6GOTDLv9X0UYl79OvM10i5G/dm9d3e+qJahQWgOX4GHmghcB HEl6RPMTO1gtYooBvagm0TfYhZhdbvtrRQ4Rq8d4= 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 044916599B; Wed, 6 Sep 2023 06:38:26 -0400 (EDT) Message-ID: Subject: Re: [PATCH] LoongArch: Link c++ header directory in the default ABI to the toplevel. From: Xi Ruoyao To: Yang Yujie , gcc-patches@gcc.gnu.org Cc: richard.sandiford@arm.com, xuchenghua@loongson.cn, chenglulu@loongson.cn, libstdc++@gcc.gnu.org Date: Wed, 06 Sep 2023 18:38:25 +0800 In-Reply-To: <20230906100628.26033-1-yangyujie@loongson.cn> References: <20230906100628.26033-1-yangyujie@loongson.cn> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 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,GIT_PATCH_0,LIKELY_SPAM_FROM,SPF_HELO_PASS,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: On Wed, 2023-09-06 at 18:06 +0800, Yang Yujie wrote: > When multilib is enabled, the c++ header directory of the default multili= b > variant needs to be linked to the toplevel since g++ does not search the > toplevel in this case. >=20 > libstdc++-v3/ChangeLog: >=20 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* configure.host: Registe= r t-loongarch in tmake_file. > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* config/cpu/loongarch/t-= loongarch: New file.=C2=A0 Link c++ header > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0directory in the default = ABI to the toplevel. > --- > =C2=A0libstdc++-v3/config/cpu/loongarch/t-loongarch | 12 ++++++++++++ > =C2=A0libstdc++-v3/configure.host=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=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2= =A0 5 ++++- > =C2=A02 files changed, 16 insertions(+), 1 deletion(-) > =C2=A0create mode 100644 libstdc++-v3/config/cpu/loongarch/t-loongarch >=20 > diff --git a/libstdc++-v3/config/cpu/loongarch/t-loongarch > b/libstdc++-v3/config/cpu/loongarch/t-loongarch > new file mode 100644 > index 00000000000..942eddeb3be > --- /dev/null > +++ b/libstdc++-v3/config/cpu/loongarch/t-loongarch > @@ -0,0 +1,12 @@ > +LA_DEFAULT_MULTIDIR =3D $(shell $(CXX) --print-multi-directory) > +TOPLEV_HEADERS =3D $(DESTDIR)${gxx_include_dir}/${host_alias}/$(LA_DEFAU= LT_MULTIDIR) > + > +.PHONY: install-toplevel-link > +install: install-toplevel-link > +install-toplevel-link: > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if test x$(MULTIDO) !=3D xtrue= && \ > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 test x$(LA_DEFAUL= T_MULTIDIR) !=3D x.; then \ > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 $(MKDIR_P) = "$(dir $(TOPLEV_HEADERS))"; \ > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 rm -rf "$(T= OPLEV_HEADERS)"; \ > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 $(LN_S) ../= "$(TOPLEV_HEADERS)"; \ >From autoconf info page: -- Macro: AC_PROG_LN_S If =E2=80=98ln -s=E2=80=99 works on the current file system (the opera= ting system and file system support symbolic links), set the output variable =E2=80=98LN_S=E2=80=99 to =E2=80=98ln -s=E2=80=99; otherwise, if =E2= =80=98ln=E2=80=99 works, set =E2=80=98LN_S=E2=80=99 to =E2=80=98ln=E2=80=99= , and otherwise set it to =E2=80=98cp -pR=E2=80=99. If you make a link in a directory other than the current directory, its meaning depends on whether =E2=80=98ln=E2=80=99 or =E2=80=98ln -s= =E2=80=99 is used. To safely create links using =E2=80=98$(LN_S)=E2=80=99, either find out which fo= rm is used and adjust the arguments, or always invoke =E2=80=98ln=E2=80=99 in the= directory where the link is to be created. In other words, it does not work to do: $(LN_S) foo /x/bar Instead, do: (cd /x && $(LN_S) foo bar) But for this special case we cannot "cp -pR ../ $(TOPLEV_HEADERS)" either: $ cp ../* -pR something cp: cannot copy a directory, '../g', into itself, 'h/g' So I guess we'll need something like if ln -s ../ "$(TOPLEV_HEADERS)"; then # OK! true else # system does not support symlink :( # install another copy of toplevel headers into default multilib subdir TODO: ???????? fi And all libstdc++ patches should Cc: libstdc++@gcc.gnu.org. > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0fi > diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host > index 9e7c7f02dfd..9dc42ad3edb 100644 > --- a/libstdc++-v3/configure.host > +++ b/libstdc++-v3/configure.host > @@ -315,7 +315,10 @@ esac > =C2=A0# Set any OS-dependent and CPU-dependent bits. > =C2=A0# THIS TABLE IS SORTED.=C2=A0 KEEP IT THAT WAY. > =C2=A0case "${host}" in > -=C2=A0 *-*-linux* | *-*-uclinux*) > + loongarch*) > +=C2=A0=C2=A0=C2=A0 tmake_file=3D"cpu/loongarch/t-loongarch" > +=C2=A0=C2=A0=C2=A0 ;; > + *-*-linux* | *-*-uclinux*) > =C2=A0=C2=A0=C2=A0=C2=A0 case "${host_cpu}" in > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 i[567]86) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 abi_baseline_pair=3Di486= -linux-gnu --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University