On Mon, 2025-06-16 at 15:29 +0200, m...@rochus-keller.ch wrote: > (second attempt, this time text-only, sorry)
Hi R.K. > I consider using libgccjit as a backend for my forthcoming Micron > compiler. The compiler is supposed to be able to generate code for > different bare-metal targets like Raspi Pico, Raspi Zero, ESP32 > Xtensa or Risc-V etc. > > From what I understand so far I would have to build a separate > instance of libgccjit for each target. This results in quite a lot of > large binaries with a lot of redundancy. You are correct. Unfortunately gcc's code assumes a specific target chosen when gcc is configured. There have been some attempts at fixing this, see e.g. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44566 but it would be a huge amount of work and isn't something that's going to be doable any time soon; sorry. > > Is it possible to build libgccjit with all the mentioned targets > included and then select via API for which target code should be > generated? Assume there is already a separate assembler and linker > für each target available. I can imagine something that implements the libgccjit API and then proxies the calls to different underlying target support libraries, but that doesn't exist yet, and wouldn't you save any space on disk or build times, alas. > > Is it possible to build a version of libgccjit which includes all > required GCC libraries so that only one shared library has to be > deployed? Not without a huge amount of work, as noted above. > > Are there already projects where libgccjit is used like this? Not to my knowledge. Sorry about this; hope this answer is helpful. Dave