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?


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


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