[SunHELP] How to staticaly link an ELF command ?

DAUBIGNE Sebastien - BOR sunhelp at sunhelp.org
Thu Oct 4 09:40:36 CDT 2001


Hi, 

I'm trying to put a time-stamp before each script started by /sbin/rcS, 
to figure out exactly which script is running during boot process. 

I've added this couple of lines before and after rcS launches the script :

echo `date +%Y%m%d%H%M%S`" Begin $f" 
[ ... ]
echo `date +%Y%m%d%H%M%S`" End $f" 

Unortunately, this can't work well if /usr is on a separate FS, because it
is not mounted
at the time rcS launches the early scipts, and the "date" command is on
/usr/bin. Note that
"date" is dynamically linked to some libs in /usr/lib too. 

I could copy the "date" command in /sbin, but it doesn't resolve the libs
dependencies. I found
two solutions : 

1.	Copy the 2 libs required by "date" in some directory on / FS (e.g.
/sbin/lib), and let
	LD_LIBRARY_PATH point to /sbin/lib  before calling "date" (Ugly
solution)
2.	Make a statically linked version of "date" and copy it in /sbin
(prefered solution).

Is it possible to statically link an dynamicaly linked stripped ELF
executable without the sources or object files ?
 
Any help appreciated.
---
Sebastien DAUBIGNE 
sebastien.daubigne at sema.fr <mailto:sebastien.daubigne at sema.fr>  - (+33)
(0)5.57.26.56.36
Sema Global Services - AFM/DW/Pessac



More information about the SunHELP mailing list