i need to calculate statically the address of the first page that contains the text segment of an elf, in order to use mprotect()
and make the text segment writable.
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
..
[14] .text PROGBITS 08048380 000380 0002e0 00 AX 0 0 128
Any ideas?
How about this program, which compiles normally and does not crash.
I've used
__executable_start
and__etext
, but you might be better seeing if you can get these to work, which are at least documented in man pages: