From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sender4-pp-o91.zoho.com (sender4-pp-o91.zoho.com [136.143.188.91]) by sourceware.org (Postfix) with ESMTPS id 73FFB3857C63 for ; Tue, 23 Nov 2021 14:10:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 73FFB3857C63 ARC-Seal: i=1; a=rsa-sha256; t=1637676625; cv=none; d=zohomail.com; s=zohoarc; b=MTI0dCCDP1SKdzgnQyFFZBQqWpRQNM8NrRuXGU1R6uVLEn/rj0+joSXt6gXohIuopb6cP+zCFDUIG35i09wc8owaiRnEvU2YirH0KYtnD8w8ecQH/4rdFfRrPLRc9gbhTHBqBb5JlhIuuA5K9coXzOHKaXX2dkdibevc0RBJGok= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637676625; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=yLitCN28xpsj2RZNGkwcCUDXdZP/FI1Zx0u7WnY2Ypo=; b=HHRRcX1vRTq6niaxLYLwrOC1iUOIfZ69LW6lnfN+guuPFwJlXM2ePhAXmHwNLVunypEny6bnaLczlnXO+54HBH3eukAn8WTEQy3ykLksFfmrEa9Am/iZGVoDfZ7aDIHUv+3Ddf7VNnKZ6jT2lQmAlE/pm/LSRIV7l/m6ZPqwmRw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=zoho.com; spf=pass smtp.mailfrom=bouanto@zoho.com; dmarc=pass header.from= Received: from [192.168.1.174] (38.87.11.6 [38.87.11.6]) by mx.zohomail.com with SMTPS id 1637676621406250.78347068254675; Tue, 23 Nov 2021 06:10:21 -0800 (PST) Message-ID: <5e2ae38f9cf3025551a8fe6952b61743f66477ca.camel@zoho.com> Subject: Re: SV: [PATCH] libgccjit: Add function to set the initial value of a global variable [PR96089] From: Antoni Boucher To: Petter Tomner , David Malcolm , "jit@gcc.gnu.org" Date: Tue, 23 Nov 2021 09:10:19 -0500 In-Reply-To: References: <7d6762623f658712a4b802cc3d6524c106affa2b.camel@zoho.com> <62c178b5bb0ab004def3c7869da2b03846e5134c.camel@zoho.com> , Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Tue, 23 Nov 2021 14:10:35 -0000 Le mardi 23 novembre 2021 =C3=A0 10:51 +0000, Petter Tomner a =C3=A9crit=C2= =A0: > Hi! >=20 > Does it work with pointers to other symbols and unions? I don't think > constant symbols end > up in the .rdata section unless they are marked for that. Since I don't provide a constructor for unions, it doesn't work for them. I believe it works for an address of a global variable, but I can't remember. >=20 > I did a similar patch that I just dropped in a RFC mail some time ago. > (See attachment). That looks indeed much more complete than my patch. I'm gonna try your patch for rustc_codegen_gcc when I'm back from vacation in December and tell you if it works or if it misses something. David, could you please take a look at Petter's patch? >=20 > If I remember correctly there need to be alot of folding to not > segfault deeper into gcc on > expressions that are not one literal, for e.g. pointer arithmetic. >=20 > Regards, > Petter=20 >=20 >=20 > Fr=C3=A5n: Gcc-patches = f=C3=B6r > Antoni Boucher via Gcc-patches > Skickat: den 23 november 2021 03:01 > Till: David Malcolm > Kopia: jit@gcc.gnu.org; gcc-patches@gcc.gnu.org > =C3=84mne: Re: [PATCH] libgccjit: Add function to set the initial value o= f a > global variable [PR96089] > =C2=A0=C2=A0=C2=A0=20 > Hi David! >=20 > I updated the patch to allow initializing global variables with values > of type array or struct. >=20 > I also fixed the bug I was talking in my previous message by using the > following workaround: I create a new memento for the action of setting > the global variable initial value and as such, both the global variable > and the initial value are bound to exist when setting the global > variable initializer. > Is that workaround good enough? > (I guess that workaround could be used to fix the same issue that we > have for inline assembly.) >=20 > Thanks for the review! >=20 > Le vendredi 11 juin 2021 =C3=A0 16:44 -0400, Antoni Boucher a =C3=A9crit= =C2=A0: > > David: this one wasn't reviewed yet by you, so you can review it. > >=20 > > Le jeudi 20 mai 2021 =C3=A0 21:27 -0400, Antoni Boucher a =C3=A9crit=C2= =A0: > > > Hi. > > >=20 > > > I made this patch to set an arbitrary value to a global variable. > > >=20 > > > This patch suffers from the same issue as inline assembly > > > (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100380), i.e. it > > > segfaults if the `rvalue` is created after the global variable. > > > It seems to be a design issue so I'm not sure what would be the fix > > > for > > > it and having it fixed would allow me to test this new function > > > much > > > more and see if things are missing (i.e. it might require a way to > > > create a constant struct). > > > See the link above for an explanation of this issue. > > >=20 > > > Thanks for the review. > >=20 >=20 > =C2=A0=C2=A0=C2=A0=20