4 ms·
That's interesting about jump tables in .rodata. That would break everything indeed. I really want the C compiler to do all the work. If I was to emit the mach
by secondcoming 3y ago
That's interesting about jump tables in .rodata. That would break everything indeed.
I really want the C compiler to do all the work. If I was to emit the machine code myself it would end up just being stack based anyway, I think.
- JonChesterfield 3y agoIf you want to keep the call into a C compiler, you might want to go with freestanding (no calling into glibc by accident) and position independent, see if you can get everything statically resolved. Nothing in the loader relocation tables. Then mmap the entire elf. That gives you tables of constant data and removes all the edge cases that come from carving .text out. If you're partly looking for a easy and sufficient answer, and are building an elf anyway, much like the sibling post, I'd think dlopen is probably the way to go. Beware that dlclose might be a no-op, in which case eventually the address space leak will sink you.
- noelwelsh 3y agoMaybe libgccjit, then? https://gcc.gnu.org/onlinedocs/jit/ https://gcc.gnu.org/onlinedocs/jit/