This is the mail archive of the binutils@sources.redhat.com 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]

Relinker util?


Mike Perry <mikepery@fscked.org> asked:
> Is there a way to add new object files into a pre-exisiting
> statically linked binary?

In most Elf ET_EXEC, you can add bytes from the end of the first
PT_LOAD up to a page boundary, and from the begnning of the second
PT_LOAD down to a page boundary, by adding one page in the middle
of the file, and adjusting .p_offset etc.  In rare cases (1/4096)
this fails because the PT_LOADs abut exactly in the address space.

Another way to get space is to steal it from DT_HASH by reducing
the number of bucket headers: you get 8 bytes per bucket.  See
http://www.BitWagon.com/elfvector.html for some code that does this.

But I have not figured out how to get ld [bfd] to _input_ an ET_EXEC
file (elf32-i386 format) and obey the obvious placement restrictions
on the ensuing elf32-i386 output.

-- 
John Reiser, jreiser@BitWagon.com


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