public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* target/5212: profiling support for i386-gnu specs file
@ 2001-12-28 10:56 Marcus Brinkmann
  0 siblings, 0 replies; 3+ messages in thread
From: Marcus Brinkmann @ 2001-12-28 10:56 UTC (permalink / raw)
  To: gcc-gnats, debian-gcc


>Number:         5212
>Category:       target
>Synopsis:       profiling support for i386-gnu specs file
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 28 10:56:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Marcus Brinkmann
>Release:        3.0.2 (Debian) (Debian testing/unstable)
>Organization:
To organize is to destroy.
>Environment:
System: GNU/Hurd ulysses 2.4.0-test9 #1 Mon Okt 30 20:36:05 CET 2000 i686 unknown
Architecture: i686

	
host: i386-pc-gnu
build: i386-pc-gnu
target: i386-pc-gnu
configured with: ../src/configure -v --enable-languages=c,c++,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --with-cpp-install-dir=bin --enable-objc-gc i386-gnu
>Description:
I fixed the Hurd specs file to support profiling (which was broken
for statically linked programs).  The specs file I successfully used
is attached, an analysis of what it does (or should do) is in the
table below.  The only relevant part of the specs file (the only
parts which I changed) are "cc1" and "startfile".

The Hurd has the i386-gnu architecture.

To profile the program only:
$ gcc -o main main.c -pg
$ ./main
$ gprof main gmon.out

To profile the program and the C library:
$ gcc -o main main.c -profile
$ ./main
$ gprof main gmon.out

The specs file implement the following option combinations:
Notes: -shared overrides (and prevents) profiling options at the linking
stage
       -profile forces to link the profiling C library statically
       -pg/-p does link to the normal C library (dynamically or statically)

The cc1 option -p is added for all of -p/-pg/-profile (for the first
two automatically, for the third there is a rule in the specs file).

static  shared  pg      p       profile =>lib
Y/N     N       Y/N     Y/N     N       -lc
N       Y       Y/N     Y/N     Y/N     -lc

Y/N     N       Y/N     Y/N     Y       -lc_p

static  shared  pg      p       profile =>startfile
N       N       N       N       N       crt1.o crti.o crtbegin.o
Y       N       N       N       N       crt0.o crti.o crtbegin.o
N       Y       Y/N     Y/N     Y/N     crti.o crtbeginS.o

N       N       Y/N     Y/N     Y       gcrt0.o crti.o crtbegin.o
Y       N       Y/N     Y/N     Y/N     gcrt0.o crti.o crtbegin.o
                ^^^^^^^^^^^^^^^^^^^ at least one Y

N       N       Y/N     Y/N     N       gcrt1.o crti.o crtbegin.o
                ^^^^^^^^^^^ at least one Y
>How-To-Repeat:
	
>Fix:
--- specs.old	Fri Dec 28 19:49:19 2001
+++ specs	Fri Dec 28 19:49:15 2001
@@ -21,7 +21,7 @@
 %{traditional|ftraditional|traditional-cpp:trad}cpp0
 
 *cc1:
-%(cc1_cpu)
+%(cc1_cpu) %{profile:-p}
 
 *cc1_options:
 %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}} %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*} %{g*} %{O*} %{W*} %{w} %{pedantic*} %{std*} %{ansi} %{traditional} %{v:-version} %{pg:-p} %{p} %{f*} %{Qn:-fno-ident} %{--help:--help} %{--target-help:--target-help} %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}} %{fsyntax-only:-o %j} %{-param*}
@@ -36,13 +36,13 @@
 -m elf_i386 %{shared:-shared}   %{!shared:     %{!static:       %{rdynamic:-export-dynamic}       %{!dynamic-linker:-dynamic-linker /lib/ld.so}}     %{static:-static}}
 
 *lib:
-%{bsd:-lbsd-compat} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}
+%{bsd:-lbsd-compat} %{shared:-lc}%{!shared:%{profile:-lc_p}%{!profile:-lc}}
 
 *libgcc:
 %{shared-libgcc:-lgcc_s%M -lgcc}%{static-libgcc:-lgcc}%{!shared-libgcc:%{!static-libgcc:%{shared:-lgcc_s%M -lgcc}}}%{!shared-libgcc:%{!static-libgcc:%{!shared:-lgcc}}}
 
 *startfile:
-%{!shared:      %{!static:        %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}      %{static:crt0.o%s}}    crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}
+%{!shared: %{!static: %{profile:gcrt0.o%s} %{!profile:%{pg:gcrt1.o%s}%{!pg:%{p:gcrt1.o%s}%{!p:crt1.o%s}}}}    %{static:  %{profile:gcrt0.o%s} %{!profile:%{pg:gcrt0.o%s}%{!pg:%{p:gcrt0.o%s}%{!p:crt0.o%s}}}}} crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}
 
 *switches_need_spaces:
 
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: target/5212: profiling support for i386-gnu specs file
@ 2002-01-05 13:06 Craig Rodrigues
  0 siblings, 0 replies; 3+ messages in thread
From: Craig Rodrigues @ 2002-01-05 13:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR target/5212; it has been noted by GNATS.

From: Craig Rodrigues <rodrigc@mediaone.net>
To: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org,
   marcus.brinkmann@ruhr-uni-bochum.de, gcc-bugs@gcc.gnu.org,
   nobody@gcc.gnu.org
Cc:  
Subject: Re: target/5212: profiling support for i386-gnu specs file
Date: Sat, 05 Jan 2002 16:02:21 -0500

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5212
 
 The following was submitted by dan@debian.org.
 Do not modify the subject line when CC:'ing gcc-gnats@gcc.gnu.org
 
 ==================================================================================
 
  On Fri, Dec 28, 2001 at 07:53:31PM +0100, Marcus Brinkmann wrote:
  > >Description:
  > I fixed the Hurd specs file to support profiling (which was broken
  > for statically linked programs).  The specs file I successfully used
  > is attached, an analysis of what it does (or should do) is in the
  > table below.  The only relevant part of the specs file (the only
  > parts which I changed) are "cc1" and "startfile".
  >
  > The Hurd has the i386-gnu architecture.
  >
  > To profile the program only:
  > $ gcc -o main main.c -pg
  > $ ./main
  > $ gprof main gmon.out
  >
  > To profile the program and the C library:
  > $ gcc -o main main.c -profile
  > $ ./main
  > $ gprof main gmon.out
  >
  > The specs file implement the following option combinations:
  > Notes: -shared overrides (and prevents) profiling options at the
 linking
  > stage
  >        -profile forces to link the profiling C library statically
  >        -pg/-p does link to the normal C library (dynamically or
 statically)
  >
  > The cc1 option -p is added for all of -p/-pg/-profile (for the first
  > two automatically, for the third there is a rule in the specs file).
 
  This is inconsistent with the behavior of (the undocumented) -profile
  on Linux, IIRC; there it links in -lc_p but does not imply -pg.  Of
  course, perhaps that should just be fixed too :)  This option really
  should be added to the documentation.
 
  --
  Daniel Jacobowitz                           Carnegie Mellon University
  MontaVista Software                         Debian GNU/Linux Developer
 
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: target/5212: profiling support for i386-gnu specs file
@ 2002-01-05 13:06 Craig Rodrigues
  0 siblings, 0 replies; 3+ messages in thread
From: Craig Rodrigues @ 2002-01-05 13:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR target/5212; it has been noted by GNATS.

From: Craig Rodrigues <rodrigc@mediaone.net>
To: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org,
   marcus.brinkmann@ruhr-uni-bochum.de, gcc-bugs@gcc.gnu.org,
   nobody@gcc.gnu.org
Cc:  
Subject: Re: target/5212: profiling support for i386-gnu specs file
Date: Sat, 05 Jan 2002 16:05:25 -0500

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5212
 
 The following was submitted by Marcus.Brinkmann@ruhr-uni-bochum.de.
 Do not modify the subject line when CC:'ing gcc-gnats@gcc.gnu.org
 =============================================
  On Sat, Dec 29, 2001 at 12:02:07AM -0500, Daniel Jacobowitz wrote:
  > This is inconsistent with the behavior of (the undocumented) -profile
 
  > on Linux, IIRC; there it links in -lc_p but does not imply -pg.  Of
  > course, perhaps that should just be fixed too :)  This option really
  > should be added to the documentation.
 
  I think you are incorrect.  At the time I made the changes (it's a long
 time
  ago), I made sure it was functionally equivalent to what happens on
 Linux
  (at least that was the intention :)
 
  Anyway:
 
  ulysses:/tmp# gcc -v -profile  main.c
  [...]
   /usr/lib/gcc-lib/i386-linux/2.95.4/cc1 /tmp/cckmOJdI.i \
   -p -quiet -dumpbase main.c -version -o /tmp/cc67Kisl.s
  [...]
   /usr/lib/gcc-lib/i386-linux/2.95.4/collect2 -m elf_i386 \
   -dynamic-linker /lib/ld-linux.so.2 /usr/lib/gcrt1.o \
   /usr/lib/crti.o /usr/lib/gcc-lib/i386-linux/2.95.4/crtbegin.o \
   -L/usr/lib/gcc-lib/i386-linux/2.95.4 /tmp/ccvFo8bW.o -lgcc \
   -lc_p -lgcc /usr/lib/gcc-lib/i386-linux/2.95.4/crtend.o
 /usr/lib/crtn.o
 
  As you can see, it has -p at compilation and -lc_p at linking.
  I don't know where this rule comes from, it is not in the specs file.
 
  If you add -profile -pg, you will get two -p's at compilation. Hehe.
 
  Thanks,
  Marcus
 
  --
  `Rhubarb is no Egyptian god.' Debian http://www.debian.org
 brinkmd@debian.org
  Marcus Brinkmann              GNU    http://www.gnu.org
 marcus@gnu.org
  Marcus.Brinkmann@ruhr-uni-bochum.de
  http://www.marcus-brinkmann.de
 
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-01-05 21:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-28 10:56 target/5212: profiling support for i386-gnu specs file Marcus Brinkmann
2002-01-05 13:06 Craig Rodrigues
2002-01-05 13:06 Craig Rodrigues

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).