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 1E8ED382AF56; Mon, 30 May 2022 10:09:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1E8ED382AF56 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 D6349668AD; Mon, 30 May 2022 06:09:35 -0400 (EDT) Message-ID: Subject: Re: [PATCH v2] libgccjit: allow common objects in $(EXTRA_GCC_OBJS) and $(EXTRA_OBJS) From: Xi Ruoyao To: Yang Yujie , gcc-patches@gcc.gnu.org, jit@gcc.gnu.org Cc: xuchenghua@loongson.cn, David Malcolm Date: Mon, 30 May 2022 18:09:33 +0800 In-Reply-To: <20220519081015.266945-1-yangyujie@loongson.cn> References: <20220519081015.266945-1-yangyujie@loongson.cn> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.2 MIME-Version: 1.0 X-Spam-Status: No, score=-2.7 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, PDS_OTHER_BAD_TLD, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: jit@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Jit mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2022 10:09:41 -0000 Ping. I'd like to see libgccjit working on LoongArch so I would be able to submit a Rust port to upstream. If the result is NACK I'd like to know alternative approaches to fix the build failure. I doubt if "jit@gcc.gnu.org" is really used, so CC'ed the JIT maintainer listed in MAINTAINERS. On Thu, 2022-05-19 at 16:10 +0800, Yang Yujie wrote: > Hello, >=20 > This patch fixes libgccjit build failure on loongarch* targets, > and could probably be useful for future ports. >=20 > For now, libgccjit is linked with objects from $(EXTRA_GCC_OBJS) and > libbackend.a, which contains object files from $(EXTRA_OBJS). >=20 > This effectively forbids any overlap between those two lists, i.e. all > target-specific shared code between the gcc driver and compiler > executables must go into gcc/common/config//-common.cc, > which feels a bit inconvenient when there are a lot of "common" stuff > that we want to put into separate source files. >=20 > By linking libgccjit with $(EXTRA_GCC_OBJS_EXCLUSIVE), which contains > all elements from $(EXTRA_GCC_OBJS) but not $(EXTRA_OBJS), this > problem > can be alleviated. >=20 > This patch does not affect any other target architecture than > loongarch, > and has been bootstrapped and regression-tested on loongarch64-linux- > gnuf64 > an x86_64-pc-linux-gnu. >=20 > Any recommendations? Please review. Thanks a lot. >=20 > Yujie >=20 > * gcc/jit/ChangeLog: >=20 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* Make-lang.in: only link= objects from $(EXTRA_GCC_OBJS) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0that's not in $(EXTRA_OBJ= S) into libgccjit. > --- > =C2=A0gcc/jit/Make-lang.in | 9 +++++++-- > =C2=A01 file changed, 7 insertions(+), 2 deletions(-) >=20 > diff --git a/gcc/jit/Make-lang.in b/gcc/jit/Make-lang.in > index 6e10abfd0ac..248ec45b729 100644 > --- a/gcc/jit/Make-lang.in > +++ b/gcc/jit/Make-lang.in > @@ -157,18 +157,23 @@ LIBGCCJIT_EXTRA_OPTS =3D > $(LIBGCCJIT_VERSION_SCRIPT_OPTION) \ > =C2=A0endif > =C2=A0endif > =C2=A0 > +# Only link objects from $(EXTRA_GCC_OBJS) that's not already > +# included in libbackend.a ($(EXTRA_OBJS)). > +EXTRA_GCC_OBJS_EXCLUSIVE =3D $(foreach _obj1, $(EXTRA_GCC_OBJS), \ > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0$(if $(filter $(_obj1), $(EXTR= A_OBJS)),, $(_obj1))) > + > =C2=A0# We avoid using $(BACKEND) from Makefile.in in order to avoid > pulling > =C2=A0# in main.o > =C2=A0$(LIBGCCJIT_FILENAME): $(jit_OBJS) \ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0libbackend.a libcommon-ta= rget.a libcommon.a \ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0$(CPPLIB) $(LIBDECNUMBER)= \ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0$(LIBDEPS) $(srcdir)/jit/= libgccjit.map \ > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0$(EXTRA_GCC_OBJS) $(jit.prev) > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0$(EXTRA_GCC_OBJS_EXCLUSIVE) $(= jit.prev) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0@$(call LINK_PROGRESS,$(I= NDEX.jit),start) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0+$(LLINKER) $(ALL_LINKERF= LAGS) $(LDFLAGS) -o $@ -shared \ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = $(jit_OBJS) libbackend.a libcommon-target.a libcommon.a \ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = $(CPPLIB) $(LIBDECNUMBER) $(EXTRA_GCC_LIBS) $(LIBS) > $(BACKENDLIBS) \ > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 $(EXT= RA_GCC_OBJS) \ > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 $(EXT= RA_GCC_OBJS_EXCLUSIVE) \ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = $(LIBGCCJIT_EXTRA_OPTS) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0@$(call LINK_PROGRESS,$(I= NDEX.jit),end) > =C2=A0 --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University