delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/10/22:25:18

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Problems linking for gprof...
Date: Thu, 10 Oct 1996 20:56:21 -0700
Organization: Three pounds of chaos and a pinch of salt
Lines: 37
Message-ID: <325DC565.2E76@cs.com>
References: <53jo5s$7ne AT news1 DOT inlink DOT com>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp211.cs.com
Mime-Version: 1.0
To: vecna <vecna AT inlink DOT com>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

vecna wrote:
> 
> Alright, I want to profile my game. So, I looked up in the FAQ, how to use
> gprof. It told me I needed to compile and link with the -pg option, then run
> the program through gprof. Fine, I can do that...
> 
> So I compile with -pg perfectly, but...when I try to link it with that it
> tells me that -pg is an unknown option! Obviously, gprof did not work.
> 
> So... what's the deal? Do I have a terribly outdated version of the linker?
> It's the standard DJGPP v.2.0 distribution. I'm using DOS 6.2, not running
> from windows, using RHIDE. There may be a newer version of rhide, but a ld -h
> confirmed that -pg was not in it's vocabulary. What should I do? Please,
> respond promptly, I'm on a time table.. :( Thanks in advance,

Nay, nay, nay!  You have to invoke 'ld' through gcc for the '-pg' option
to work.  Profiling is accomplished by means of linking with a special
version of the djgpp startup code, not by anything specific that the
linker does.  You can, I suppose, study the linker scripts in
'lib/specs', or study the output of 'gcc -v -pg ...' to see how the
linker pass can be invoked manually, but it's far easier to invoke gcc
itself for the link stage.

For example:

% gcc -g -O -Wall -pg -c *.c
% gcc -pg -o main.exe *.o

Or something like that.  Unless you are doing something _really_ wierd,
there should never be any need to manually call the linker.

-- 
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I  |        fighteer AT cs DOT com         |
| Plan:  To find ANYONE willing to |   http://www.cs.com/fighteer   |
| play Descent 2 on DWANGO!        | Tagline: <this space for rent> |
---------------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019