This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Inject so into elf
- From: "Zhenyu Guo" <guozy03 at mails dot tsinghua dot edu dot cn>
- To: "Binutils" <binutils at sources dot redhat dot com>
- Date: Fri, 10 Jun 2005 15:31:35 +0800
- Subject: Inject so into elf
Hi,
I am trying to rewrite elf so that my own dll can be loaded next
time. I've added a new Elf64_Dyn entry at the .dynamic segment, just
before the last DT_NULL entry. And, I append the dll name to the end of
the .dynstr whose attributes are designated by DT_STRTAB and DT_STRSZ.
Both the .dynamic segment and .dynstr are moved to the end of the file.
Finally, I rewrite the program header (DT_DYNAMIC), while adding a new
PT_LOAD segment to load the new .dynstr and .dynamic segments.
After all these are done, I've got msg: /lib/tls/libc.so.6.1:
version `libbetto.so' not found . (betto is my lib name)
What the things that I've missed? And is there any better way to
inject my own dll into an elf file (not a process)?
Thanks,
Zhenyu