public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
* [QUESTION] Using host functions in AOT mode
@ 2021-07-14 17:32 Stephan Dollberg
  2021-08-10 22:40 ` Petter Tomner
  0 siblings, 1 reply; 3+ messages in thread
From: Stephan Dollberg @ 2021-07-14 17:32 UTC (permalink / raw)
  To: jit

Hello,

in jit compilation mode I can call functions from the host binary by
using gcc_jit_context_new_call_through_ptr.

This doesn't work in AOT mode. Is there any way to include host
functions when compiling a binary in AOT mode?

GCC_JIT_OUTPUT_KIND_EXECUTABLE mentions that there is currently no
support for linking. I could see a work around where instead you
compile to GCC_JIT_OUTPUT_KIND_OBJECT_FILE and externally invoke gcc
to link your host/runtime and AOT-compiled functions together.

Cheers,
Stephan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [QUESTION] Using host functions in AOT mode
  2021-07-14 17:32 [QUESTION] Using host functions in AOT mode Stephan Dollberg
@ 2021-08-10 22:40 ` Petter Tomner
  2021-08-11 20:11   ` Stephan Dollberg
  0 siblings, 1 reply; 3+ messages in thread
From: Petter Tomner @ 2021-08-10 22:40 UTC (permalink / raw)
  To: jit, stephan.dollberg

Hi!

The docs are not updated since gcc_jit_context_add_driver_option() was 
added in that section I believe.

You can link with anything with gcc_jit_context_add_driver_option().

E.g.
gcc_jit_context_add_driver_option(ctxt, "obj.o")
or
gcc_jit_context_add_driver_option(ctxt, "-L.")
gcc_jit_context_add_driver_option(ctxt, "-lwhatever")

Regards

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [QUESTION] Using host functions in AOT mode
  2021-08-10 22:40 ` Petter Tomner
@ 2021-08-11 20:11   ` Stephan Dollberg
  0 siblings, 0 replies; 3+ messages in thread
From: Stephan Dollberg @ 2021-08-11 20:11 UTC (permalink / raw)
  To: Petter Tomner; +Cc: jit

Hi Petter,

Thanks! That's working great.

I'd update the docs but I am not really familiar with the gcc dev flow
so sombody else could probably do it a lot quicker.

Cheers,
Stephan

On Tue, 10 Aug 2021 at 23:40, Petter Tomner <tomner@kth.se> wrote:
>
> Hi!
>
> The docs are not updated since gcc_jit_context_add_driver_option() was
> added in that section I believe.
>
> You can link with anything with gcc_jit_context_add_driver_option().
>
> E.g.
> gcc_jit_context_add_driver_option(ctxt, "obj.o")
> or
> gcc_jit_context_add_driver_option(ctxt, "-L.")
> gcc_jit_context_add_driver_option(ctxt, "-lwhatever")
>
> Regards

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-11 20:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-14 17:32 [QUESTION] Using host functions in AOT mode Stephan Dollberg
2021-08-10 22:40 ` Petter Tomner
2021-08-11 20:11   ` Stephan Dollberg

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).