Date: Tue, 22 Feb 2000 09:01:42 +0100 From: Martin Cracauer <cracauer@cons.org> To: "Jordan K. Hubbard" <jkh@zippy.cdrom.com> Cc: jdp@FreeBSD.ORG, peter@FreeBSD.ORG, current@FreeBSD.ORG Subject: Re: "Interesting" failure mode for static linking with shared libs. Message-ID: <20000222090142.A29249@cons.org> In-Reply-To: <32351.951188747@zippy.cdrom.com>; from jkh@zippy.cdrom.com on Mon, Feb 21, 2000 at 07:05:47PM -0800 References: <32351.951188747@zippy.cdrom.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In <32351.951188747@zippy.cdrom.com>, 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 -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Martin Cracauer <cracauer@cons.org> http://www.cons.org/cracauer/ BSD User Group Hamburg, Germany http://www.bsdhh.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000222090142.A29249>