From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 16891384603E for ; Mon, 6 Jun 2022 22:33:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 16891384603E Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-457-BdM4N1i1PwSxnmU8DKvHOw-1; Mon, 06 Jun 2022 18:33:08 -0400 X-MC-Unique: BdM4N1i1PwSxnmU8DKvHOw-1 Received: by mail-qv1-f70.google.com with SMTP id ke5-20020a056214300500b00461fc78b983so9656813qvb.17 for ; Mon, 06 Jun 2022 15:33:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=jaNOG80FohQWbD+YHULW9WnFYJqU0sK7WSM6s1k2QXg=; b=gOZ8dIl9ibwhYz3AII/7on10ciWz7dVmN1gUO8CtEVocd12dzEzgyE9R9B1CG+l5nm 58o4s/ukeNpm+8F2mgnp68pGUZcZgM0AvEAjDpO882tXPfmimSQrsZCoSqTFIxADJNch 9fIfjf++r16Dl+BlU+ag4mvusN38Z55yTO9/N+CFVjOH2/CqioiEX6LIOhXgxtD3YRkc fxE4y3PgITzVAA/WDbGHAwjWwAR6WFvxUJdU3h/bv4DQdrAmtwErspL1RP+1hfWbjTeX sKEKFiH3ISQKzP47QM7Z7NDgT4fZPgIfHnImBb6eRd+hIA6lJNIHjsY0Y/lsOTXS1af8 it0g== X-Gm-Message-State: AOAM530k0ZnV7NOt631FawKlGhOw1wQx61pG6Qvs1msvKCp5njITQyY4 B3Iz+CsOzhMaVfUxlEyzveXce1EJoloPlwdKBT5yb7LTXo0pLmMlc/9e3F7GdmEp2AVNc9PNil/ TtoMpamc= X-Received: by 2002:a05:6214:27ef:b0:467:ddcf:a362 with SMTP id jt15-20020a05621427ef00b00467ddcfa362mr14529937qvb.22.1654554787906; Mon, 06 Jun 2022 15:33:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/QDFwM2SxZ2JtOY7rvn1onIFf2jxsD6ffhWKV8m0yuvpeyJVDUfQ5LwyZbnM0dwzB8/xtxQ== X-Received: by 2002:a05:6214:27ef:b0:467:ddcf:a362 with SMTP id jt15-20020a05621427ef00b00467ddcfa362mr14529926qvb.22.1654554787626; Mon, 06 Jun 2022 15:33:07 -0700 (PDT) Received: from t14s.localdomain (c-73-69-212-193.hsd1.nh.comcast.net. [73.69.212.193]) by smtp.gmail.com with ESMTPSA id o17-20020ac84291000000b00304defdb1b3sm7512927qtl.85.2022.06.06.15.33.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 15:33:06 -0700 (PDT) Message-ID: Subject: Re: [PATCH v2] libgccjit: allow common objects in $(EXTRA_GCC_OBJS) and $(EXTRA_OBJS) From: David Malcolm To: Xi Ruoyao , Yang Yujie , gcc-patches@gcc.gnu.org, jit@gcc.gnu.org Cc: xuchenghua@loongson.cn Date: Mon, 06 Jun 2022 18:33:05 -0400 In-Reply-To: References: <20220519081015.266945-1-yangyujie@loongson.cn> User-Agent: Evolution 3.38.4 (3.38.4-1.fc33) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, BODY_8BITS, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, 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, 06 Jun 2022 22:33:14 -0000 On Mon, 2022-05-30 at 18:09 +0800, Xi Ruoyao wrote: > 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. Sorry about that, it turns out there's something wrong with my email filters. Unfortunately, I haven't been able to fix them, so please CC me directly on jit-related patches, and do ping me if I seem not to have seen one. Sorry again. > > On Thu, 2022-05-19 at 16:10 +0800, Yang Yujie wrote: > > Hello, > > > > This patch fixes libgccjit build failure on loongarch* targets, > > and could probably be useful for future ports. > > > > For now, libgccjit is linked with objects from $(EXTRA_GCC_OBJS) > > and > > libbackend.a, which contains object files from $(EXTRA_OBJS). > > > > 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. > > > > 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. Yujie: thanks for figuring this out, and coming up with a solution. Presumably libgccjit is the only GCC "frontend" that also has driver code directly linked into it, and thus the only one that needs this workaround. > > > > 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. > > > > Any recommendations? Please review. Thanks a lot. The patch looks good to me. Thanks. Dave > > > > Yujie > > > > * gcc/jit/ChangeLog: > > > >         * Make-lang.in: only link objects from $(EXTRA_GCC_OBJS) > >         that's not in $(EXTRA_OBJS) into libgccjit. > > --- > >  gcc/jit/Make-lang.in | 9 +++++++-- > >  1 file changed, 7 insertions(+), 2 deletions(-) > > > > 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 = > > $(LIBGCCJIT_VERSION_SCRIPT_OPTION) \ > >  endif > >  endif > >   > > +# Only link objects from $(EXTRA_GCC_OBJS) that's not already > > +# included in libbackend.a ($(EXTRA_OBJS)). > > +EXTRA_GCC_OBJS_EXCLUSIVE = $(foreach _obj1, $(EXTRA_GCC_OBJS), \ > > +       $(if $(filter $(_obj1), $(EXTRA_OBJS)),, $(_obj1))) > > + > >  # We avoid using $(BACKEND) from Makefile.in in order to avoid > > pulling > >  # in main.o > >  $(LIBGCCJIT_FILENAME): $(jit_OBJS) \ > >         libbackend.a libcommon-target.a libcommon.a \ > >         $(CPPLIB) $(LIBDECNUMBER) \ > >         $(LIBDEPS) $(srcdir)/jit/libgccjit.map \ > > -       $(EXTRA_GCC_OBJS) $(jit.prev) > > +       $(EXTRA_GCC_OBJS_EXCLUSIVE) $(jit.prev) > >         @$(call LINK_PROGRESS,$(INDEX.jit),start) > >         +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ -shared \ > >              $(jit_OBJS) libbackend.a libcommon-target.a > > libcommon.a \ > >              $(CPPLIB) $(LIBDECNUMBER) $(EXTRA_GCC_LIBS) $(LIBS) > > $(BACKENDLIBS) \ > > -            $(EXTRA_GCC_OBJS) \ > > +            $(EXTRA_GCC_OBJS_EXCLUSIVE) \ > >              $(LIBGCCJIT_EXTRA_OPTS) > >         @$(call LINK_PROGRESS,$(INDEX.jit),end) > >   >