That's cool! I do have a habit of writing ELF post-processors as a part of the CMake build system I inevitably end up writing. There's a handy POST_BUILD you can attach to programs which I use very often for things like execute-only (XO) and apparently also to rewrite function entries for functions I can't --wrap.
chperm can change the permissions of a segment to just execute, instead of read+execute. Of course, you will need a custom linker script because the default linker scripts will merge .text and read-only data to save space.
Currently, I'm battling a Rust program that has a built-in function called __memcmpeq, which isn't a global, so I can't --wrap it.
fwsgonzo•2h ago
Example: https://github.com/varnish/libvmod-riscv/blob/main/program/c...
chperm can change the permissions of a segment to just execute, instead of read+execute. Of course, you will need a custom linker script because the default linker scripts will merge .text and read-only data to save space.
Currently, I'm battling a Rust program that has a built-in function called __memcmpeq, which isn't a global, so I can't --wrap it.