[Template-haskell] Profiling with Template Haskell (continued)

Sean Seefried sseefried@cse.unsw.EDU.AU
Sat, 19 Jul 2003 12:33:07 +1000 (EST)


Hi all,

I've been thinking about the profiling problem a little bit during the
night and I've come up with some ideas and queries.

I wish to clarify the following. There are three forms of a
standard library aren't there?

a) static library without profiling (e.g. libHSbase.a)
b) static library with profiling    (e.g. libHSbase_p.a)
c) an equivalent object file for including the library in GHCi and during
splicing in Template Haskell.       (e.g. HSbase.o)

When a module that contains splicing is compiled it seems to me that
the third type of library is linked in (if it exists), followed by a
an attempt to link in in a shared library. (e.g. libHSbase.so).

Say we have a file Main.hs which includes splices from Splices.hs.
Say we are just about to compile Main.hs and Splices.o exists. Then
the symbols from Splices.o will be linked in during the splicing
process right?

But this is going to fail if Splices.hs was compiled with profiling
on. And why is this?

Splices.o will contain the undefined symbol '_CCS' if it is compiled with
'-prof'.  So when we link it in during the splicing process we are
going to need this symbol to be defined somewhere.  Well, I've had a
brief look at the standard libraries that come with GHC and none of the
.o forms of the libraries (type c above) has this symbol defined in
them, but the symbol _is_ defined in all the static libraries that we
built with profiling on (type b above).

It seems to me that we require two types of .o library - one in which
profiling was included and one it which it was not. Otherwise how can
we compile programs using Template Haskell using the '-prof' option?

Sean