@@ -57,7 +57,8 @@ In-memory compilation
with a name matching `funcname` must have been created on
`result`'s context (or a parent context) via a call to
:func:`gcc_jit_context_new_function` with `kind`
- :macro:`GCC_JIT_FUNCTION_EXPORTED`:
+ :macro:`GCC_JIT_FUNCTION_EXPORTED` or
+ :macro:`GCC_JIT_FUNCTION_EXPORTED_WEAK`:
.. code-block:: c
@@ -582,6 +582,19 @@ Global variables
referring to it. Analogous to using an "extern" global from a
header file.
+ .. c:macro:: GCC_JIT_GLOBAL_EXPORTED_WEAK
+
+ Global is defined by the client code with weak linkage and is visible
+ by name outside of this JIT context via
+ :c:func:`gcc_jit_result_get_global`. Analogous to declaring a variable
+ with ``__attribute__((weak))``.
+
+ When compiled to file weak linkage allow multiple definitions
+ of the same symbol name in different files all being linked
+ together. Note that child contexts include their parent and
+ can't have more than one variable with the same name no matter
+ if weak or not.
+
.. function:: gcc_jit_lvalue *\
gcc_jit_global_set_initializer (gcc_jit_lvalue *global,\
const void *blob,\
@@ -90,9 +90,8 @@ Functions
Function is defined by the client code and visible
by name outside of the JIT.
- This value is required if you want to extract machine code
- for this function from a :type:`gcc_jit_result` via
- :func:`gcc_jit_result_get_code`.
+ With this value you can extract machine code for this function
+ from a :type:`gcc_jit_result` via :func:`gcc_jit_result_get_code`.
.. macro:: GCC_JIT_FUNCTION_INTERNAL
@@ -117,6 +116,21 @@ Functions
above 0; when optimization is off, this is essentially the
same as GCC_JIT_FUNCTION_INTERNAL.
+ .. macro:: GCC_JIT_FUNCTION_EXPORTED_WEAK
+
+ Function is defined by the client code with weak linkage and
+ is visible by name outside of the JIT. Analogous to a function
+ with ``__attribute__((weak))``.
+
+ When compiled to file weak linkage allow multiple definitions
+ of the same symbol name in different files all being linked
+ together. Note that child contexts include their parent and
+ can't have more than one function with the same name no matter
+ if weak or not.
+
+ With this value you can extract machine code for this function
+ from a :type:`gcc_jit_result` via :func:`gcc_jit_result_get_code`.
+
The parameter ``name`` must be non-NULL. The call takes a copy of the
underlying string, so it is valid to pass in a pointer to an on-stack
buffer.