Although libgccjit is primarily aimed at just-in-time compilation, it can also be used for implementing more traditional ahead-of-time compilers, via the gcc_jit_context_compile_to_file() API entrypoint.
For linking in object files, use gcc_jit_context_add_driver_option().
Compile the gcc_jit_context * to a file of the given kind.
gcc_jit_context_compile_to_file() ignores the suffix of
output_path
, and insteads uses the given
enum gcc_jit_output_kind
to decide what to do.
|
The available kinds of output are:
Output kind | Typical suffix |
---|---|
GCC_JIT_OUTPUT_KIND_ASSEMBLER | .s |
GCC_JIT_OUTPUT_KIND_OBJECT_FILE | .o |
GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY | .so or .dll |
GCC_JIT_OUTPUT_KIND_EXECUTABLE | None, or .exe |
Compile the context to an assembler file.
Compile the context to an object file.
Compile the context to a dynamic library.
Compile the context to an executable.