public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
From: Petter Tomner <tomner@kth.se>
To: "jit@gcc.gnu.org" <jit@gcc.gnu.org>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: [PATCH 0/3] jit: Add support for weak linkage
Date: Sun, 8 Aug 2021 15:07:37 +0000	[thread overview]
Message-ID: <44423472d36e42f1a6e3612b704ba513@kth.se> (raw)

Hi,

To implement generics/C++ template-ish with libgccjit it would be very useful to have the possibility to declare functions and variables with weak linkage, to be able to have independent AOT compilation of object files without needing to keep track of what is "instantiated" where to prevent collisions.

I implemented this by giving 'gcc_jit_context_new_function()' and  'gcc_jit_context_new_global()' one new enum value EXPORTED_WEAK each that specifies an exported symbol with weak linkage. The variable or function is accessible from a 'result' as would it be EXPORTED.

I split the code up for it to be easier to read:

Patch 1 is the implementation.
Patch 2 is a test case.
Patch 3 is documentation updates.

I ran 'make check-jit' successfully on a x64-pc-gnu linux. I didn't make any ABI tag and the docs need regeneration in path 3.

Regards, Petter Tomner

             reply	other threads:[~2021-08-08 15:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-08 15:07 Petter Tomner [this message]
2021-08-08 15:18 ` [PATCH 1/3] " Petter Tomner
2021-08-08 15:20 ` [PATCH 2/3] " Petter Tomner
2021-08-08 15:21 ` [PATCH 3/3] " 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=44423472d36e42f1a6e3612b704ba513@kth.se \
    --to=tomner@kth.se \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jit@gcc.gnu.org \
    /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).