Libgccjit.so?

I’ve been looking at libgccjit.so on Linux as a backend for compilers whose licensing might not be compatible with a normal GCC frontend. Contrary to the name, libgccjit can be used for AOT compilers as well as JITs. Its API is C-based but has a C++ wrapper. I’m hoping to avoid C++isms associated with LLVM-JIT. It didn’t show up in a HaikuPorts search. Would it be easy to add?

I guess I’ll cross that bridge as I come to it. Linux first, then port from there.

You should

  • clone the HaikuPort repo
  • study the GCC recipe and build it to get practice
  • enable libgccjit in the configure invocation
  • build locally
  • compare the generated package with the current gcc package in the repository and identify the new files. Those should be the libgccjit related files.
  • split the libgccjit related files into an own subpackage, see the fortran subpackage for example how to do it.
  • rebuild it again and again til lyou confirm the recipe and the generated packages works
  • bump the recipe REVISION
  • create a PR.

Trivial.

6 Likes

Thanks! Just what I needed to know.

Now that I’m actually getting around to building this, the --enable-host-shared option is required by the JIT to make sure that it is embedded into a shared object. The JIT Build documentation states that is because position independent code is slower than regular. Does this even apply to Haiku though? Everything on Haiku is PIC, after all. If it does make a difference, I’d better make a separate recipe for the library as the docs recommend.

Note:

I’m trying it out the easy way first but I’ll need to figure out if there is a significant speed difference before I publish my changes to HaikuPorts.

Update:

The build succeeded but the --enable-host-shared option bloated the GCC11 package so much that I will be splitting this off into a separate package. At least the build succeeded after an hour of running.