gmp3 with 4.08.x
Wed, 25 Apr 2001 00:11:53 +0200
On Tue, Apr 24, 2001 at 15:55:59 +0000, Marcin 'Qrczak' Kowalczyk wrote:
> Tue, 24 Apr 2001 17:34:20 +0200, Michael Weber <email@example.com> pisze:
> > Using it with -Onot doesn't expose an error (as you explained), and
> > using it with -O is not possible. It automatically reverts to
> > compiling via C:
> Use -O -fasm
Option order matters?!?! That's evil!
> (I think that lots of code would break this way. Not all primops are
> implemented in the NCG.)
Well, if I take it as a bug, that "-O -fasm-x86" /= "-fasm-x86 -O",
then ghc4 does work with libgmp3.
If not, well, here's a workaround:
% /usr/lib/ghc-4.08.1/bin/ghc -O -fasm-x86 foo.hs
foo.o: In function `c2E7_ret':
foo.o(.text+0xb5): undefined reference to `mpz_get_si'
collect2: ld returned 1 exit status
% cat foo.hs
module Main(main) where
main = do
let bigInt = 100000000009999999999900000000 :: Integer
print $ (fromIntegral bigInt :: Int)
% /usr/lib/ghc-4.08.1/bin/ghc -O -S -fasm-x86 foo.hs
% mv foo.s foo.S
% gcc -o foo.o -c -I. -imacros /usr/include/gmp.h -I/usr/lib/ghc-4.08.1/includes foo.S
% /usr/lib/ghc-4.08.1/bin/ghc -O -fasm-x86 foo.o
% nm foo.o | grep mpz
The trick is using the -imacros option and .S
/~\ ASCII ribbon | "i have decided to release the first 24GB of my genetic
\ / campaign | code under the Artistic License. since this is DFSG
X against | compatible, could it go in main?"
/ \ HTML mail | -- debian-devel <20000417013615.E1735@megabite.net>