2.1.5.4 Additional command-line options

C Function: void gcc_jit_context_add_command_line_option (gcc_jit_context *ctxt, const char *optname)

Add an arbitrary gcc command-line option to the context, for use by gcc_jit_context_compile() and gcc_jit_context_compile_to_file().

The parameter optname must be non-NULL. The underlying buffer is copied, so that it does not need to outlive the call.

Extra options added by gcc_jit_context_add_command_line_option are applied `after' the regular options above, potentially overriding them. Options from parent contexts are inherited by child contexts; options from the parent are applied `before' those from the child.

For example:

gcc_jit_context_add_command_line_option (ctxt, "-ffast-math");
gcc_jit_context_add_command_line_option (ctxt, "-fverbose-asm");

Note that only some options are likely to be meaningful; there is no “frontend” within libgccjit, so typically only those affecting optimization and code-generation are likely to be useful.

This entrypoint was added in LIBGCCJIT_ABI_1; you can test for its presence using

#ifdef LIBGCCJIT_HAVE_gcc_jit_context_add_command_line_option
C Function: void gcc_jit_context_add_driver_option (gcc_jit_context *ctxt, const char *optname)

Add an arbitrary gcc driver option to the context, for use by gcc_jit_context_compile() and gcc_jit_context_compile_to_file().

The parameter optname must be non-NULL. The underlying buffer is copied, so that it does not need to outlive the call.

Extra options added by gcc_jit_context_add_driver_option are applied `after' all other options potentially overriding them. Options from parent contexts are inherited by child contexts; options from the parent are applied `before' those from the child.

For example:

gcc_jit_context_add_driver_option (ctxt, "-lm");
gcc_jit_context_add_driver_option (ctxt, "-fuse-linker-plugin");

gcc_jit_context_add_driver_option (ctxt, "obj.o");

gcc_jit_context_add_driver_option (ctxt, "-L.");
gcc_jit_context_add_driver_option (ctxt, "-lwhatever");

Note that only some options are likely to be meaningful; there is no “frontend” within libgccjit, so typically only those affecting assembler and linker are likely to be useful.

This entrypoint was added in LIBGCCJIT_ABI_11; you can test for its presence using

#ifdef LIBGCCJIT_HAVE_gcc_jit_context_add_driver_option