Yes, it is for a use case inside of rustc_codegen_gcc. The compiler is structured in a way where we don't know if a global variable might be constant when it is created.
On Wed, 2024-01-24 at 10:09 -0500, David Malcolm wrote: > On Fri, 2024-01-19 at 16:57 -0500, Antoni Boucher wrote: > > Hi. > > This patch adds a new API gcc_jit_global_set_readonly: it's > > equivalent > > to having a const global variable, but it is useful in the case of > > complex compilers where it is not convenient to use const. > > Thanks for the review. > > Hi Antoni; thanks for the patch. > > Can you give an example of where/why this might be used? > Presumably this is motivated by a use case you had inside the rustc > backend? > > Thanks > Dave >