Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Mar 2000 15:27:37 -0800
From:      Alfred Perlstein <bright@wintelcom.net>
To:        Oscar Bonilla <obonilla@fisicc-ufm.edu>
Cc:        Kris Kennaway <kris@hub.freebsd.org>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: inner workings of the C compiler
Message-ID:  <20000310152737.J14279@fw.wintelcom.net>
In-Reply-To: <20000310164428.A89006@fisicc-ufm.edu>; from obonilla@fisicc-ufm.edu on Fri, Mar 10, 2000 at 04:44:28PM -0600
References:  <20000308163057.W14279@fw.wintelcom.net> <Pine.BSF.4.21.0003091719340.82270-100000@hub.freebsd.org> <20000310164428.A89006@fisicc-ufm.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
* Oscar Bonilla <obonilla@fisicc-ufm.edu> [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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000310152737.J14279>