Actually, this is a (minor) bug in binutils (see patch below): ELF
interpreteu is defined as /usr/lib/libc.so.1 rather than
(here) /usr/libexec/ld-elf.so.1 

On Tue, 22 Feb 2000, Martin Cracauer wrote:

> In <[EMAIL PROTECTED]>, Jordan K. Hubbard wrote: 
> > root@zippy-> cc -fPIC -c stub.c
> > root@zippy-> ld -shared -o stub.so stub.o
> > root@zippy-> cc -static test.c -o test stub.so
> > root@zippy-> ./test 
> > ELF interpreter /usr/lib/libc.so.1 not found
> > Abort trap
> > root@zippy-> cc -static test.c -o test stub.o
> > root@zippy-> ./test 
> > Now in the client, calling doit()
> > You have reached the stub.  Please leave a message.
> 
> As a workaround for a static binary, you should be able to use
>   -Xlinker -Bstatic
> instead of
>   -static
> 
> -static links the libs statically and also leaves out the dynamic
> loading code from the binary.
> 
> The former leaves the dynamic loading code in the binary, but links
> the libs statically. You have a slightly bigger binary, but you don't
> need the libs at runtime and you are resistent against changed/faked
> libs, which might do the job you want static linking for.
> 
> Martin
> 

Regards,
Vladimir

--- /usr/src/contrib/binutils/bfd/elf32-i386.c.orig     Tue Feb  9 21:57:33 1999
+++ /usr/src/contrib/binutils/bfd/elf32-i386.c  Tue Feb  9 21:55:53 1999
@@ -249,7 +249,7 @@
 /* The name of the dynamic interpreter.  This is put in the .interp
    section.  */
 
-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/libc.so.1"
+#define ELF_DYNAMIC_INTERPRETER "/usr/libexec/ld-elf.so.1"
 
 /* The size in bytes of an entry in the procedure linkage table.  */
 
--- /usr/src/contrib/binutils/bfd/elf64-alpha.c.orig    Wed Feb 10 00:39:39 1999
+++ /usr/src/contrib/binutils/bfd/elf64-alpha.c Wed Feb 10 00:40:05 1999
@@ -1018,7 +1018,7 @@
 
 #define MAX_GOT_ENTRIES                (64*1024 / 8)
 
-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so"
+#define ELF_DYNAMIC_INTERPRETER "/usr/libexec/ld-elf.so.1"
 
 /* Handle an Alpha specific section when reading an object file.  This
    is called when elfcode.h finds a section with an unknown type.
-- 

===========================|=======================
 Vladimir Kushnir          |    
 [EMAIL PROTECTED]      |    Powered by FreeBSD
 [EMAIL PROTECTED]  |



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to