From owner-freebsd-hackers Fri Mar 10 14:47:34 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from voyager.fisicc-ufm.edu (ip-198-202.guate.net [209.198.197.202]) by hub.freebsd.org (Postfix) with ESMTP id B509437B8F2; Fri, 10 Mar 2000 14:47:19 -0800 (PST) (envelope-from obonilla@voyager.fisicc-ufm.edu) Received: (from obonilla@localhost) by voyager.fisicc-ufm.edu (8.9.3/8.9.3) id QAA93449; Fri, 10 Mar 2000 16:44:28 -0600 (CST) (envelope-from obonilla) Date: Fri, 10 Mar 2000 16:44:28 -0600 From: Oscar Bonilla To: Kris Kennaway Cc: Alfred Perlstein , Oscar Bonilla , freebsd-hackers@FreeBSD.ORG Subject: Re: inner workings of the C compiler Message-ID: <20000310164428.A89006@fisicc-ufm.edu> References: <20000308163057.W14279@fw.wintelcom.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre1i In-Reply-To: Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, Mar 09, 2000 at 05:20:31PM -0800, Kris Kennaway wrote: > On Wed, 8 Mar 2000, Alfred Perlstein wrote: > > > I'm pretty sure this can be done a hell of a lot easier by using shared > > libraries and using the enviornment variables LD_LIBRARY_PATH and > > LD_PRELOAD, see the rtld manpage for more help. > > Yes, I've done this when trying to track down buffer overflows in > libc..stick them in their own directory and use LD_LIBRARY_PATH, which > tells the dynamic linker where to search. > $ echo $LD_LIBRARY_PATH/ /home/obonilla/freebsd/nss/libc/ $ echo $LD_PRELOAD /home/obonilla/freebsd/nss/libc/libc.so.4 $ make cc -g -DYP -DFreeBSD -Wall -pedantic -ansi -o nss-test -I../../libc/include nss-test.c /tmp/ccy93427.o: In function `main': /home/obonilla/freebsd/nss/tests/libc/nss-test.c(.text+0xb0): undefined reference to `nsdispatch' *** Error code 1 Stop in /usr/home/obonilla/freebsd/nss/tests/libc. $ at this point I switch makefiles to use static building and... $ make cc -g -DYP -DFreeBSD -Wall -pedantic -ansi -c -I../../libc/include nss-test.c cc -g -nostdlib -static -L../../libc -o nss-test nss-test.o ../../csu/i386-elf/crt1.o ../../csu/i386-elf/crti.o -lc $ but when I run the binary... $ ./nss-test files called files called retval = 1 NS_SUCCESS Bus error (core dumped) $ am I doing something wrong? BTW... I've ported the Name Service Switch from NetBSD to FreeBSD and it's working on my laptop right now. However, I need some help moving all the get*by* functions in the C library to use the new nsdispatch function, especially for the NIS code... who should I talk to... anyone interested on seeing some patches? regards, -oscar -- pgp public key: finger obonilla@fisicc-ufm.edu pgp fingerprint: 6D 18 8C 90 4C DF F0 4B DF 35 1F 69 A1 33 C7 BC To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message