On Tue, 25 Feb 2014 23:12:04 +0100, Mark Wielaard wrote:
I rather not extend the libelf interface if possible. The various
implementations are already a little diverged. Lets not unnecessarily
make the divergence even bigger.
I was aware of this issue but I had no other idea.
If possible, could you mmap the file at
the offset directly and use elf_memory() instead?
No, I cannot. strace-ing eu-stack shows:
open("/proc/10797/mem", O_RDONLY) = 4
mmap(NULL, 28672, PROT_READ|PROT_WRITE, MAP_PRIVATE, 4, 0x400000) = -1 ENODEV (No such
pread(4, "\177ELF...", 64, 4194304) = 64
It is not due to a bit inappropriate PROT_WRITE there, with a standalone
testcase ENODEV is there same:
open("/proc/19126/mem", O_RDONLY) = 3
mmap(NULL, 4096, PROT_READ, MAP_PRIVATE, 3, 0x400000) = -1 ENODEV (No such device)