From owner-freebsd-hackers Fri Mar 10 16:44:59 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 DBFB637BB60 for ; Fri, 10 Mar 2000 16:44:47 -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 SAA94618; Fri, 10 Mar 2000 18:43:46 -0600 (CST) (envelope-from obonilla) Date: Fri, 10 Mar 2000 18:43:46 -0600 From: Oscar Bonilla To: Marco van de Voort Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: inner workings of the C compiler Message-ID: <20000310184346.B94441@fisicc-ufm.edu> References: <20000308150327.A77039@fisicc-ufm.edu> <20000311000014.920E62E802@hermes.tue.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre1i In-Reply-To: <20000311000014.920E62E802@hermes.tue.nl> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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/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 > > I'm no expert, but I tried something like this a few weeks back(to totally link without > libc), and I was wondering, aren't you missing crtbegin and crtend ? > YES! that took care of the double calling of the first function of the first file... I still get the bus error at the end of my program in the atexit() call. this is because _fini is invalid. do you know the exact order in which I should link the objects? 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