inner workings of the C compiler

2000-03-08 Thread Oscar Bonilla
i'm working on the C library, and to make debuggin easy i've copied /usr/src/lib/libc to another directory and only build libc.a. i've also copied /usr/src/lib/csu/i386-elf to another directory and have enabled debug symbols on both csu and libc. to try things out i create a static binary and c

Re: inner workings of the C compiler

2000-03-08 Thread Alfred Perlstein
* Oscar Bonilla <[EMAIL PROTECTED]> [000308 13:37] wrote: > i'm working on the C library, and to make debuggin easy i've copied > /usr/src/lib/libc to another directory and only build libc.a. > > i've also copied /usr/src/lib/csu/i386-elf to another directory and > have enabled debug symbols on

Re: inner workings of the C compiler

2000-03-09 Thread Kris Kennaway
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 overflo

Re: inner workings of the C compiler

2000-03-10 Thread Oscar Bonilla
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

Re: inner workings of the C compiler

2000-03-10 Thread Alfred Perlstein
* Oscar Bonilla <[EMAIL PROTECTED]> [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 va

Re: inner workings of the C compiler

2000-03-10 Thread Oscar Bonilla
On Fri, Mar 10, 2000 at 03:27:37PM -0800, Alfred Perlstein wrote: > I think you'll want LD_LIBRARY_PATH to be: > /home/obonilla/freebsd/nss/libc/:/usr/lib:/usr/local/lib I don't see why since the only library I use is libc. Anyway, I tried just for kicks and still got the same error. $ echo $LD_

Re: inner workings of the C compiler

2000-03-10 Thread Chuck Robey
On Fri, 10 Mar 2000, Oscar Bonilla wrote: > $ cp Makefile.static Makefile > $ 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 > $ ./nss-test

Re: inner workings of the C compiler

2000-03-10 Thread Marco van de Voort
> to try things out i create a static binary and coerce it to use my > C library instead of the system's one. > > this is how i compile my program: > > 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 \

Re: inner workings of the C compiler

2000-03-10 Thread Alfred Perlstein
* Oscar Bonilla <[EMAIL PROTECTED]> [000310 16:00] wrote: > On Fri, Mar 10, 2000 at 03:27:37PM -0800, Alfred Perlstein wrote: > > I think you'll want LD_LIBRARY_PATH to be: > > /home/obonilla/freebsd/nss/libc/:/usr/lib:/usr/local/lib > > I don't see why since the only library I use is libc. Anywa

Re: inner workings of the C compiler

2000-03-10 Thread Oscar Bonilla
On Fri, Mar 10, 2000 at 06:51:20PM -0500, Chuck Robey wrote: > I wasn't reading this too closely, but if you're trying to hand feed in > the object files, the C startup object file *MUST* come first in the list > of object files, because it's gotta link at the lowest address ... > > Is that it?

Re: inner workings of the C compiler

2000-03-10 Thread Oscar Bonilla
On Fri, Mar 10, 2000 at 04:35:18PM -0800, Alfred Perlstein wrote: > It seems to be working just fine, I suspect that there's something wrong > with your code and you're referencing a function that somehow is not > being compiled into libc: > > ~ % nm /usr/lib/libc.a | grep nsdispatch > ~ % > >

Re: inner workings of the C compiler

2000-03-10 Thread Alfred Perlstein
* Oscar Bonilla <[EMAIL PROTECTED]> [000310 17:08] wrote: > On Fri, Mar 10, 2000 at 04:35:18PM -0800, Alfred Perlstein wrote: > > It seems to be working just fine, I suspect that there's something wrong > > with your code and you're referencing a function that somehow is not > > being compiled int

Re: inner workings of the C compiler

2000-03-10 Thread Oscar Bonilla
On Sat, Mar 11, 2000 at 12:58:13AM +0100, Marco van de Voort wrote: > > > to try things out i create a static binary and coerce it to use my > > C library instead of the system's one. > > > > this is how i compile my program: > > > > cc -g -DYP -DFreeBSD -Wall -pedantic -ansi -c -I../../libc/in

Re: inner workings of the C compiler

2000-03-10 Thread Chuck Robey
On Fri, 10 Mar 2000, Oscar Bonilla wrote: > On Fri, Mar 10, 2000 at 06:51:20PM -0500, Chuck Robey wrote: > > I wasn't reading this too closely, but if you're trying to hand feed in > > the object files, the C startup object file *MUST* come first in the list > > of object files, because it's gott

Re: inner workings of the C compiler

2000-03-10 Thread Oscar Bonilla
On Fri, Mar 10, 2000 at 07:49:32PM -0500, Chuck Robey wrote: > Notice here the order it links, and what files it links in. First, if > you're using nostdlib, then you have to call out your own libs, all of > them, and you forgot to do libgcc. I've been able to move the lib calls I don't really

Re: inner workings of the C compiler

2000-03-11 Thread Marco van de Voort
> > > to try things out i create a static binary and coerce it to use my > > > C library instead of the system's one. > > > > > > this is how i compile my program: > > > > > > cc -g -DYP -DFreeBSD -Wall -pedantic -ansi -c -I../../libc/include nss-test.c > > > cc -g -nostdlib -static -L../../lib

Re: inner workings of the C compiler

2000-03-13 Thread Oscar Bonilla
On Sat, Mar 11, 2000 at 02:30:19PM +0100, Marco van de Voort wrote: > P.s. Could you sent me a minimal C program linking to libc, and the > commandline to compile it with -nostdlib ? > > I could throw all these experiences with non standard linking in a > little tex doc. ( --nostdlib with and wit