From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id 764E93858D35; Thu, 7 Sep 2023 03:09:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 764E93858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [192.168.100.1]) by gateway (Coremail) with SMTP id _____8CxNvHPPvlklgUhAA--.105S3; Thu, 07 Sep 2023 11:09:03 +0800 (CST) Received: from 3a5000 (unknown [192.168.100.1]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxiczNPvlkyOZvAA--.28009S2; Thu, 07 Sep 2023 11:09:02 +0800 (CST) Date: Thu, 7 Sep 2023 11:09:04 +0800 From: Yang Yujie To: Xi Ruoyao Cc: Yang Yujie , gcc-patches@gcc.gnu.org, richard.sandiford@arm.com, xuchenghua@loongson.cn, chenglulu@loongson.cn, libstdc++@gcc.gnu.org Subject: Re: [PATCH] LoongArch: Link c++ header directory in the default ABI to the toplevel. Message-ID: <5pbsmgaqr3wmoxcxheke6sw4rpj6t7u3wefagbuyjla7bb6sy5@idq6q7r5i2eu> References: <20230906100628.26033-1-yangyujie@loongson.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-CM-TRANSID:AQAAf8BxiczNPvlkyOZvAA--.28009S2 Authentication-Results: localhost.localdomain; spf=neutral smtp.mail=y angyujie@loongson.cn; X-CM-SenderInfo: 51dqw5pxmlvqxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBj93XoWxZw4xXFW8JrW8JF45Gw43twc_yoWrXF43pF 18CFs8JrykJFn7Jwn7Ja18Jr98AFWxKanrJr1rAFyUurs8Ar10gF4vg3s09F1xJw4xJw4j 9F18u3WUuFs8X3gCm3ZEXasCq-sJn29KB7ZKAUJUUUU8529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUkjb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx 1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1Y6r17McIj6I8E87Iv 67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IY64vIr41l42xK82IYc2Ij64 vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8G jcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2I x0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK 8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I 0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07UNvtZUUUUU= X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00,BODY_8BITS,GIT_PATCH_0,KAM_DMARC_STATUS,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: On Wed, Sep 06, 2023 at 06:38:25PM +0800, Xi Ruoyao wrote: > On Wed, 2023-09-06 at 18:06 +0800, Yang Yujie wrote: > > When multilib is enabled, the c++ header directory of the default multilib > > variant needs to be linked to the toplevel since g++ does not search the > > toplevel in this case. > > > > libstdc++-v3/ChangeLog: > > > >         * configure.host: Register t-loongarch in tmake_file. > >         * config/cpu/loongarch/t-loongarch: New file.  Link c++ header > >         directory in the default ABI to the toplevel. > > --- > >  libstdc++-v3/config/cpu/loongarch/t-loongarch | 12 ++++++++++++ > >  libstdc++-v3/configure.host                   |  5 ++++- > >  2 files changed, 16 insertions(+), 1 deletion(-) > >  create mode 100644 libstdc++-v3/config/cpu/loongarch/t-loongarch > > > > 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 = $(shell $(CXX) --print-multi-directory) > > +TOPLEV_HEADERS = $(DESTDIR)${gxx_include_dir}/${host_alias}/$(LA_DEFAULT_MULTIDIR) > > + > > +.PHONY: install-toplevel-link > > +install: install-toplevel-link > > +install-toplevel-link: > > +       if test x$(MULTIDO) != xtrue && \ > > +          test x$(LA_DEFAULT_MULTIDIR) != x.; then \ > > +           $(MKDIR_P) "$(dir $(TOPLEV_HEADERS))"; \ > > +           rm -rf "$(TOPLEV_HEADERS)"; \ > > +           $(LN_S) ../ "$(TOPLEV_HEADERS)"; \ > > From autoconf info page: > > -- Macro: AC_PROG_LN_S > If ‘ln -s’ works on the current file system (the operating system > and file system support symbolic links), set the output variable > ‘LN_S’ to ‘ln -s’; otherwise, if ‘ln’ works, set ‘LN_S’ to ‘ln’, > and otherwise set it to ‘cp -pR’. > > If you make a link in a directory other than the current directory, > its meaning depends on whether ‘ln’ or ‘ln -s’ is used. To safely > create links using ‘$(LN_S)’, either find out which form is used > and adjust the arguments, or always invoke ‘ln’ 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. > > > +       fi > > 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 > >  # Set any OS-dependent and CPU-dependent bits. > >  # THIS TABLE IS SORTED.  KEEP IT THAT WAY. > >  case "${host}" in > > -  *-*-linux* | *-*-uclinux*) > > + loongarch*) > > +    tmake_file="cpu/loongarch/t-loongarch" > > +    ;; > > + *-*-linux* | *-*-uclinux*) > >      case "${host_cpu}" in > >        i[567]86) > >          abi_baseline_pair=i486-linux-gnu > > -- > Xi Ruoyao > School of Aerospace Science and Technology, Xidian University Thanks for the review! After some tweaking, it appeared that we can simply override ${multisubdir} in configure.host and achieve the same. I will upload another patch soon. Yujie