From: Antoni Boucher <bouanto@zoho.com>
To: Petter Tomner <tomner@kth.se>,
David Malcolm <dmalcolm@redhat.com>,
"jit@gcc.gnu.org" <jit@gcc.gnu.org>
Subject: Re: SV: [PATCH] libgccjit: Add function to set the initial value of a global variable [PR96089]
Date: Tue, 23 Nov 2021 09:10:19 -0500 [thread overview]
Message-ID: <5e2ae38f9cf3025551a8fe6952b61743f66477ca.camel@zoho.com> (raw)
In-Reply-To: <ac3bb1dcaf524ec6892c03526b3e4503@kth.se>
Le mardi 23 novembre 2021 à 10:51 +0000, Petter Tomner a écrit :
> Hi!
>
> 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.
>
> 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?
>
> 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.
>
> Regards,
> Petter
>
>
> Från: Gcc-patches <gcc-patches-bounces+tomner=kth.se@gcc.gnu.org> för
> Antoni Boucher via Gcc-patches <gcc-patches@gcc.gnu.org>
> Skickat: den 23 november 2021 03:01
> Till: David Malcolm
> Kopia: jit@gcc.gnu.org; gcc-patches@gcc.gnu.org
> Ämne: Re: [PATCH] libgccjit: Add function to set the initial value of a
> global variable [PR96089]
>
> Hi David!
>
> I updated the patch to allow initializing global variables with values
> of type array or struct.
>
> 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.)
>
> Thanks for the review!
>
> Le vendredi 11 juin 2021 à 16:44 -0400, Antoni Boucher a écrit :
> > David: this one wasn't reviewed yet by you, so you can review it.
> >
> > Le jeudi 20 mai 2021 à 21:27 -0400, Antoni Boucher a écrit :
> > > Hi.
> > >
> > > I made this patch to set an arbitrary value to a global variable.
> > >
> > > This patch suffers from the same issue as inline assembly
> > > (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100380), 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.
> > >
> > > Thanks for the review.
> >
>
>
next prev parent reply other threads:[~2021-11-23 14:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-21 1:27 Antoni Boucher
2021-06-11 20:44 ` Antoni Boucher
2021-11-23 2:01 ` Antoni Boucher
2021-11-23 10:51 ` SV: " Petter Tomner
2021-11-23 14:10 ` Antoni Boucher [this message]
2021-11-24 13:38 ` SV: " Petter Tomner
2021-11-30 1:34 ` David Malcolm
2021-11-30 14:37 ` SV: " Petter Tomner
2021-12-02 0:07 ` David Malcolm
2021-12-02 22:58 ` Antoni Boucher
2021-12-06 10:56 ` SV: " Petter Tomner
2021-12-06 10:51 ` Petter Tomner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5e2ae38f9cf3025551a8fe6952b61743f66477ca.camel@zoho.com \
--to=bouanto@zoho.com \
--cc=dmalcolm@redhat.com \
--cc=jit@gcc.gnu.org \
--cc=tomner@kth.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).