Opened 16 years ago

Closed 23 months ago

#545 closed feature request (fixed)

GHCi + profiling doesn't work

Reported by: nilsanders Owned by: simonmar
Priority: normal Milestone: 8.0.1
Component: GHCi Version: 5.0
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by simonmar)


module Main where

main = putStrLn "Hi!"

Compile this with profiling turned on:

> ghc -prof -auto-all -o hello --make Main.hs
ghc-5.00: chasing modules from: Main.hs
Compiling Main             ( Main.hs, ./Main.o )
ghc: linking ...

Try to load the file with GHCi:

> ghci Main 
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version
5.00, For Haskell 98.
/ /_\\/ __  / /___| |
\____/\/ /_/\____/|_|      Type :? for help.

Loading package std ... linking ... done.
Skipping  Main             ( Main.hs, ./Main.o )
ghc-5.00: fatal error: do_Elf32_Rel_relocations: 
./Main.o: unknown symbol `CC_LIST'

Change History (5)

comment:1 Changed 16 years ago by simonmar

Status: assignedclosed
Logged In: YES 

If you had run GHCi with the -prof flag, it would have 
emitted the following error message:

     --interactive can't be used with -prof, -ticky, -unreg 
or -smp

But you tried to load a profiled .o file into GHCi without 
giving it any flags.  The normal GHC would have also failed 
with a link error in this situation, so I don't consider it 
a bug.

Perhaps profiled object files should be called .p_o instead 
of plain .o (there are arguments both ways), and/or perhaps 
we should re-instate the object consistency checking that 
GHC had some time ago.  Feel free to submit a feature 
request :-)

comment:2 Changed 2 years ago by simonmar

Architecture: Unknown/Multiple
Component: CompilerGHCi
Description: modified (diff)
Milestone: 8.0.1
Operating System: Unknown/Multiple
Owner: nobody deleted
Resolution: Wont Fix
Status: closednew
Type: bugfeature request
Type of failure: None/Unknown

comment:3 Changed 2 years ago by simonmar

Owner: set to simonmar

comment:4 Changed 23 months ago by Simon Marlow <marlowsd@…>

In ce1f1607/ghc:

Make GHCi & TH work when the compiler is built with -prof

Amazingly, there were zero changes to the byte code generator and very
few changes to the interpreter - mainly because we've used good
abstractions that hide the differences between profiling and
non-profiling.  So that bit was pleasantly straightforward, but there
were a pile of other wibbles to get the whole test suite through.

Note that a compiler built with -prof is now like one built with
-dynamic, in that to use TH you have to build the code the same way.
For dynamic, we automatically enable -dynamic-too when TH is required,
but we don't have anything equivalent for profiling, so you have to
explicitly use -prof when building code that uses TH with a profiled
compiler.  For this reason Cabal won't work with TH.  We don't expect
to ship a profiled compiler, so I think that's OK.

Test Plan: validate with GhcProfiled=YES in

Reviewers: goldfire, bgamari, rwbarton, austin, hvr, erikd, ezyang

Reviewed By: ezyang

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #4837, #545

comment:5 Changed 23 months ago by simonmar

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.