Sender: rich AT phekda DOT freeserve DOT co DOT uk Message-ID: <3C00F797.88E8AA45@phekda.freeserve.co.uk> Date: Sun, 25 Nov 2001 13:52:23 +0000 From: Richard Dawe X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586) X-Accept-Language: de,fr MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: Re: Building a profiled version of libc References: <3BF97E29 DOT 39FC7C7E AT phekda DOT freeserve DOT co DOT uk> <3405-Tue20Nov2001082315+0200-eliz AT is DOT elta DOT co DOT il> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Hello. Eli Zaretskii wrote: > > Richard Dawe wrote: > > So should I add a new command to > > src/makefile.inc that defines a new XGCC - XGCC_NO_PG - to be used for > > mcount.c? > > Yes, something like that. Please put a comment there which explains > what files use this special variable, and why. Below is a diff that's tested and works for libc. If you're building more than just libc, the build fails with profiling on in src/libemu. I haven't looked at fixing that yet, but it looks like emu387.dxe should not be built against a profiling version, because profiling requires file I/O and the comments in libemu/src/emudummy.c say file I/O is not allowed in the DXE. OK to commit? Bye, Rich =] -- Richard Dawe http://www.phekda.freeserve.co.uk/richdawe/ Index: src/makefile.inc =================================================================== RCS file: /cvs/djgpp/djgpp/src/makefile.inc,v retrieving revision 1.7 diff -p -c -3 -r1.7 makefile.inc *** src/makefile.inc 2001/09/02 17:17:37 1.7 --- src/makefile.inc 2001/11/25 13:47:31 *************** *** 1,3 **** --- 1,4 ---- + # Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details # Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details # Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details # -*- makefile -*- *************** else *** 63,68 **** --- 64,77 ---- XGCC = $(CROSS_GCC) $(GCC_OPT) -I. -I- -isystem $(TOP)/../../include $(CFLAGS) XLGCC = $(CROSS_GCC) $(GCCL_OPT) -I. -I- -isystem $(TOP)/../../include $(CFLAGS) endif + + # Find the necessary gcc options for building the profiling + # support code (src/libc/crt0/mcount.c). We strip out profiling options + # from the standard gcc options file, to avoid a chicken-and-egg problem + # in a profiling version of libc (the profiling support code calling + # profiling support code). + # + XNOPGGCC = $(CROSS_GCC) $(shell sed -f $(TOP)/../noprof.sed $(TOP)/../gcc.opt) -I. -I- -isystem $(TOP)/../../include $(CFLAGS) MISC = $(TOP)/../misc.exe Index: src/noprof.sed =================================================================== RCS file: noprof.sed diff -N noprof.sed *** /dev/null Tue May 5 16:32:27 1998 --- noprof.sed Sun Nov 25 08:47:31 2001 *************** *** 0 **** --- 1,12 ---- + # For building the profiling support code (src/libc/crt0/mcount.c), + # strip out profiling options, to avoid a chicken-and-egg problem + # in a profiling version of libc (the profiling support code calling + # profiling support code). + # + s:^-a$:: + s:^-ax$:: + s:^-finstrument-functions$:: + s:^-fprofile-arcs$:: + s:^-ftest-coverage$:: + s:^-p$:: + s:^-pg$:: Index: src/libc/crt0/makefile =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/crt0/makefile,v retrieving revision 1.4 diff -p -c -3 -r1.4 makefile *** src/libc/crt0/makefile 2001/06/21 05:56:14 1.4 --- src/libc/crt0/makefile 2001/11/25 13:47:31 *************** $(LIB)/gcrt0.o : gcrt0.S crt0.S exit16.a *** 34,36 **** --- 34,39 ---- $(MISC) cp gcrt0.o $@ $(MISC) rm gcrt0.o sed 's AT gcrt0 DOT o@$(LIB)/gcrt0.o@' gcrt0.d > gcrt02.d + + mcount.o : mcount.c + $(XNOPGGCC) -c $<