bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: profiling


From: Roland McGrath
Subject: Re: profiling
Date: Mon, 14 May 2001 18:20:50 -0400 (EDT)

Well, I'm not quite sure how to react to this.  I'm not exactly surprised
that there is a problem.  Frankly, I'm somewhat surprised that profiling
actually does work at all, and I'm having a hard time taking this bug
report as anything but good news. :-)

> However, we don't use crt1.o for static linking, we need to use the special
> crt0.o (sysdeps/mach/hurd/i386/static_start.S and the Makefile).

Indeed, that was an oversight we made whenever it was we got profiling working.
It should be completely trivial to fix, and I've enclosed a libc patch below.
Please try this out and if it works I will check it in.

> That said, once we have gcrt0.o we also need to fix up the specs file.
> It does not work correctly with -pg.  I think we should just do what Linux
> does:  Use -pg for profiling just the program, and -profile if also libc
> should be profiled.  If I understood it correctly.

I agree.  The Linux meaning of -pg/-profile is contrary to the common
meaning of -pg on other systems, but for the Hurd I see no reason to differ
from the Linux definitions.  Most people want to profile their own programs
and not the C library.  


2001-05-14  Roland McGrath  <roland@frob.com>

            * csu/Makefile ($(objpfx)g$(start-installed-name)): Turn this
            explicit rule into a pattern rule for $(objpfx)gcrt%.o.

            * sysdeps/mach/hurd/i386/Makefile (extra-objs): Add gcrt0.o here.
            (install-lib, omit-deps): Likewise.
            (CFLAGS-initfini.s): Remove obsolete variable.


Index: csu/Makefile
===================================================================
RCS file: /cvs/glibc/libc/csu/Makefile,v
retrieving revision 1.48
diff -b -u -r1.48 Makefile
--- Makefile      2001/03/16 07:28:57   1.48
+++ Makefile      2001/05/14 22:12:46
@@ -151,8 +151,7 @@
 # The profiling startfile is made by linking together the normal
 # startfile with gmon-start.o, which defines a constructor function
 # to turn on profiling code at startup.
-$(objpfx)g$(start-installed-name): $(objpfx)$(start-installed-name) \
-
                                                                                
   $(objpfx)gmon-start.o
+$(objpfx)gcrt%.o: $(objpfx)crt%.o $(objpfx)gmon-start.o
                   $(link-relocatable)
 
 # These extra files are sometimes expected by system standard linking
Index: sysdeps/mach/hurd/i386/Makefile
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/mach/hurd/i386/Makefile,v
retrieving revision 1.4
diff -b -u -r1.4 Makefile
--- Makefile     1999/06/13 10:02:39    1.4
+++ Makefile     2001/05/14 22:12:46
@@ -2,17 +2,15 @@
 static-start-installed-name = crt0.o
 
 ifeq ($(subdir),csu)
-extra-objs += crt0.o
-install-lib += crt0.o
-omit-deps += crt0
+extra-objs += crt0.o gcrt0.o
+install-lib += crt0.o gcrt0.o
+omit-deps += crt0 gcrt0
 
+
 $(objpfx)crt0.o: $(objpfx)static-start.o $(objpfx)abi-note.o
 $(objpfx)init.o
        $(link-relocatable)
+
+# gcrt0.o is made from crt0.o by the implicit rule in csu/Makefile.
 
-# compat for libc.so.0.2 only
-# This is needed to be backward-compatible with glibc-2.0.x startup code
-# that was miscompiled so that it jumps to 0 if there is a nonzero
-# __gmon_start__ symbol, but works if there is none.
-CFLAGS-initfini.s += -DWEAK_GMON_START
 
 endif



reply via email to

[Prev in Thread] Current Thread [Next in Thread]