Relinker util?

Mike Perry mikepery@fscked.org
Thu Feb 28 03:14:00 GMT 2002


Hey guys. Is there a way to add new object files into a pre-exisiting
statically linked binary? Or a way add a new .so file to the library
list of a dynamic library (by actually PERMANENTLY modifying the binary,
ie not LD_PRELOAD)?

I was thinking of hacking together a util to expand the .text segment of
a program and try to throw some code in there, but I don't wanna waste
my time if there's some obscure ld option to do this (I've looked and
there doesn't appear to be any - the closest I got was trying to rerun
collect2 without crt0, but I still ran into a redefined _DYNAMIC symbol).

What would be the best way to approach this? I was thinking of just
modifying the ELF program header by hand to expand like the last segment
in the file and throwing some code down there. Would using something like
libBFD be a better choice?

-- 
Mike Perry
Mad Computer Scientist
fscked.org enterprises, inc



More information about the Binutils mailing list