From owner-freebsd-hackers Fri Mar 10 14:56: 6 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id B164C37BB08; Fri, 10 Mar 2000 14:55:58 -0800 (PST) (envelope-from bright@fw.wintelcom.net) Received: (from bright@localhost) by fw.wintelcom.net (8.9.3/8.9.3) id PAA23042; Fri, 10 Mar 2000 15:27:37 -0800 (PST) Date: Fri, 10 Mar 2000 15:27:37 -0800 From: Alfred Perlstein To: Oscar Bonilla Cc: Kris Kennaway , freebsd-hackers@FreeBSD.ORG Subject: Re: inner workings of the C compiler Message-ID: <20000310152737.J14279@fw.wintelcom.net> References: <20000308163057.W14279@fw.wintelcom.net> <20000310164428.A89006@fisicc-ufm.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: <20000310164428.A89006@fisicc-ufm.edu>; from obonilla@fisicc-ufm.edu on Fri, Mar 10, 2000 at 04:44:28PM -0600 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * Oscar Bonilla [000310 15:19] wrote: > 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/ I think you'll want LD_LIBRARY_PATH to be: /home/obonilla/freebsd/nss/libc/:/usr/lib:/usr/local/lib > $ 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... please use the dynamic, it's a hell of a lot easier. > > $ 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? probably, but without a traceback it's going to be hard to find out exactly what. > > 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? Of course we are, please file a PR when you think it's pretty much completed or email -hackers if you need/want advice. :) -- -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message