Hi all,

I recently had some trouble trying to compile a simple Template Haskell
program

main = putStrLn (show ($[| 20 |]))

The following output was generated:

/home/sseefried/local/lib/ghc-5.05/HSbase_cbits.o: unknown symbol
`__umoddi3'
Loading package base ... linking ... ghc-5.05: panic! (the `impossible'
happened, GHC version 5.05):
        can't load package `base'

I decided that I would attempt to fix this bug myself which I seem to have
done by adding the following lines to Linker.c

Under the lines (lines 535 - 538)
#ifdef SUPPORT_LONG_LONGS
#define RTS_LONG_LONG_SYMS                      \
      SymX(int64ToIntegerzh_fast)               \
      SymX(word64ToIntegerzh_fast)              \

I have added
      Sym(__umoddi3)  /* -= Sean Seefried */    \
      Sym(__udivdi3)  /* -= Sean Seefried */    \
      Sym(__moddi3)  /* -= Sean Seefried */     \
      Sym(__divdi3)  /* -= Sean Seefried */

I added these symbols to the RTS_LONG_LONG_SYMS because the
directory HSbase_cbits.o also contained a file called long_long.o which
also contained a reference to the symbol __umoddi3 in it.

I was wondering what everyone thought of this fix.  Should it be necessary
to do it this way?  I am aware that Template Haskell uses the dynamic
linking faclities that were first introduced with GHCi.  I believe
__umoddi3 must be required by libgmp since numbers are represented as infinite
precision numbers. Obviously statically linking to this symbol works, but
it falls down when we attempt to dynamically link to it.  (I know I am
being sloppy in my explanation here but I do not understand linking as
well as I should.)

Any input would be much appreciated.  Do people have this problem when the
compile GHC on other architectures?

Sean
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to