This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: objcopy - redefine dynamic symbols


Hi,

after several weeks of work I have given up in creating a "simple" tool
for renaming dynamic symbols. (I am very very happy that I now have
found an alternative solution to escape from this bfd/elf hell).

I attached my patch to objcopy.c from binutils-0.15, just in case
someone will try to complete that work in future...

Please do not apply this patch and expect anything to work, it still
might break a lot of things!!! It is a brute-force attempt, incomplete,
quick&dirty, with lots of memory leaks, missing sanity checks and so on.

Basically it does the following:
1. loop over .dynsym and re-create .dynstr
2. re-create the .hash table from scratch
3. calculate new lma/vma, new memory layout (.dynstr size changed!)
4. fix the contents of .dynamic, according to the new layout
5. fix .rel.dyn
6. fix .rel.plt
7. fix .dynsym again
8. write out the new section contents

In copy_section: exclude the rewritten sections from being copyied.

Currently it seems to create a syntactically valid ELF file, but as the
distance between .plt and .got changes, the relative addressing in .plt
is broken. Additionally the .got has to be fixed again. It also ignores
any "private" section data.

Might someone find a better way to do all this some day...

Thomas

Attachment: rename-dynamic.diff.gz
Description: GNU Zip compressed data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]