Open xry111 opened 3 months ago
There is an example [1] to enable relax under ORC by generating orc info with symbol reloc rather than sec+offset reloc.
For jump table, (usually c jump table), the a direct way to get it is record the order of instructions execution. When encounter jr reg
, backwards search the jump table. But it is complex to implement.
The second way is add reloc at jr reg
by gcc, (or some other info, not need the reloc form). I tried set reloc info indicate the begin and len of jump table long time ago, it is effective, unfortunately except goto table
. See goto table
in ___bpf_prog_run
. It is difficult for me to add the jump table info to gototable in gcc.
Besides, the asm jump table is as important as c jump table. I noticed LoongArch marked losts of STACK_FRAME_NON_STANDARD
in *.S, actually it is not correct because we should have probabilities to do backtrace from __clear_user_fast
, __memcpy_small
and others. They should also be handled in some way.
Look to the future of objtool, I think generating ORC info by SFrame
is possible. SFrame
is an interesting object.
[1] https://github.com/MQ-mengqing/linux/commit/a26d48bdd2d210c6aad4abf2d1bcad6b07f46b3d
Add jump tables and relaxation support to objtool so we don't need to pessimize the code with
-fno-jump-tables
and-mno-relax
.