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