Opened 3 years ago

Closed 2 years ago

#5554 closed bug (fixed)

Strange interaction between "-osuf", profiling and TemplateHaskell

Reported by: iustin Owned by:
Priority: normal Milestone: 7.4.1
Component: Template Haskell Version: 7.2.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

I see a strange behaviour of profiling + TemplateHaskell and the -osuf option.

I'm trying to compile (any) TemplateHaskell code with profiling in the following way:

$ ghc --make -O example

[1 of 2] Compiling Th               ( Th.hs, Th.o )
[2 of 2] Compiling Main             ( example.hs, example.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.3.0.0 ... linking ... done.
Loading package containers-0.3.0.0 ... linking ... done.
Loading package pretty-1.0.1.1 ... linking ... done.
Loading package template-haskell ... linking ... done.
Linking example ...

$ ghc --make -O -prof -auto-all -osuf .prof.o example
[1 of 2] Compiling Th               ( Th.hs, Th.prof.o )
[2 of 2] Compiling Main             ( example.hs, example.prof.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.3.0.0 ... linking ... done.
Loading package containers-0.3.0.0 ... linking ... done.
Loading package pretty-1.0.1.1 ... linking ... done.
Loading package template-haskell ... linking ... done.
ghc: ./Th.prof.o: unknown symbol `CCCS'

However, if in the second invocation the -osuf .prof.o is changed to -osuf prof_o, then everything works fine:

$ ghc --make -O -prof -auto-all -osuf .prof_o example
[1 of 2] Compiling Th               ( Th.hs, Th.prof_o )
[2 of 2] Compiling Main             ( example.hs, example.prof_o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.3.0.0 ... linking ... done.
Loading package containers-0.3.0.0 ... linking ... done.
Loading package pretty-1.0.1.1 ... linking ... done.
Loading package template-haskell ... linking ... done.
Linking example ...

Sadly I don't know how to debug this, but it should be reproduceable with any TH code, with all of 6.12, 7.0.3 and 7.2.1.

If the .o suffix is speciall (even in the form of .prof.o), then it would be good to document this; the GHC doc says right now “you can choose any suffix that isn't the normal object suffix here”.

Change History (2)

comment:1 Changed 2 years ago by marlowsd@…

commit c489af738b4a4999ca0000110fe5dcf7944d119f

Author: Simon Marlow <marlowsd@gmail.com>
Date:   Tue Oct 18 13:23:29 2011 +0100

    fix the object suffix when using TH with profiling (#5554)

 compiler/ghci/Linker.lhs |   49 +++++++++++++++++++++++++--------------------
 1 files changed, 27 insertions(+), 22 deletions(-)

comment:2 Changed 2 years ago by simonmar

  • Milestone set to 7.4.1
  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.