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]

How to relink an executable to be static?


Hi,

I'm the author of the Disk Encryption HOWTO and I'm getting ready to
write a significant update.  I'm looking for a tool to make the
encryption process as smooth as possible for my readers.

I've searched for a tool to suit my needs and so far haven't found one,
though I have found other people asking for it.  I've searched the
archive of this list and read the man pages of ld and gcc.  I'm open to
the idea that the answer is staring me in the face but I'm just too
dense to see it. :)

I want a tool that takes a dynamically linked executable and produces a
static version, e.g.:

	staticify /sbin/init /mnt/initrd/sbin/init

would take the libraries init depends on (/lib/tls/libc.so.6 &
/lib/ld-linux.so.2) and compile them into a standalone version of init
on the initial RAM disk.

I can recompile init from source and pass the -static flag, but I want
to be able to do this without requiring the source.  It seems to me this
should be easily achievable because staticify would have all the
information it needs.

I looked at prelink, which looks close to what I want, but not quite.

Is there a tool to do this?  Can I use an existing tool such as ld (or
set of tools such as binutils) to do this with appropriate flags?

David



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