Thu Feb 3 10:33:26 EST 2005 rsc
I agree that the right thing to do is use
the phdr info instead of the shdr. The shdr
is only there as a courtesy, while the phdr
is required for the binary to be loaded by the OS.
However, I'd prefer not to use constant offsets
into the phdr. There are type bits in the phdr that
can be used to figure out which section is the
text, which is the data, and which is the symbols.
See http://cvs.pdos.lcs.mit.edu/cvs/plan9/src/libmach/elf.c?rev=HEAD
for how I parse the ELF files from Linux and FreeBSD.
Russ
|