Such offsets can easily be extracted from the assembler output of the
compiler, see the Linux kernel for a good example.
Andreas, I'm not such kernel expert, could you please point me to some docs or hints how exactly this works? I'd like to make that compilation as flexible as possible.