Re: [commit: ghc] master: Re-add more primops for atomic ops on byte arrays (4ee4ab0)

Hello Johan,
2014-06-30 22:13 GMT+02:00
commit 4ee4ab01c1d97845aecb7707ad2f9a80933e7a49 Author: Johan Tibell
Date: Fri Jun 27 13:48:24 2014 +0200 Re-add more primops for atomic ops on byte arrays
It seems this change breaks the build on FreeBSD/i386 [1]: "inplace/bin/ghc-stage1" -o utils/dll-split/dist-install/build/tmp/dll-split -hisuf dyn_hi -osuf dyn_o -hcsuf dyn_hc -fPIC -dynamic -H32m -O -hide-all-packages -i -iutils/dll-split/. -iutils/dll-split/dist-install/build -iutils/dll-split/dist-install/build/autogen -Iutils/dll-split/dist-install/build -Iutils/dll-split/dist-install/build/autogen -optP-include -optPutils/dll-split/dist-install/build/autogen/cabal_macros.h -package base-4.7.1.0 -package containers-0.5.5.1 -package filepath-1.3.0.2 -XHaskell2010 -no-user-package-db -rtsopts -odir utils/dll-split/dist-install/build -hidir utils/dll-split/dist-install/build -stubdir utils/dll-split/dist-install/build -optl-L'/usr/home/ghc-builder/work/builder/tempbuild/build/libraries/filepath/dist-install/build' -optl-L'/usr/home/ghc-builder/work/builder/tempbuild/build/libraries/containers/dist-install/build' -optl-L'/usr/home/ghc-builder/work/builder/tempbuild/build/libraries/deepseq/dist-install/build' -optl-L'/usr/home/ghc-builder/work/builder/tempbuild/build/libraries/array/dist-install/build' -optl-L'/usr/home/ghc-builder/work/builder/tempbuild/build/libraries/base/dist-install/build' -optl-L'/usr/local/lib' -optl-L'/usr/home/ghc-builder/work/builder/tempbuild/build/libraries/integer-gmp/dist-install/build' -optl-L'/usr/local/lib' -optl-L'/usr/home/ghc-builder/work/builder/tempbuild/build/libraries/ghc-prim/dist-install/build' -optl-L'/usr/home/ghc-builder/work/builder/tempbuild/build/rts/dist/build' -optl-liconv -optl-lcharset -optl-lgmp -optl-lm -optl-lrt -optl-lpthread -fPIC -dynamic -H32m -O -hide-all-packages -i -iutils/dll-split/. -iutils/dll-split/dist-install/build -iutils/dll-split/dist-install/build/autogen -Iutils/dll-split/dist-install/build -Iutils/dll-split/dist-install/build/autogen -optP-include -optPutils/dll-split/dist-install/build/autogen/cabal_macros.h -package base-4.7.1.0 -package containers-0.5.5.1 -package filepath-1.3.0.2 -XHaskell2010 -no-user-package-db -rtsopts -fno-use-rpaths -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../filepath-1.3.0.2' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../containers-0.5.5.1' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../deepseq-1.3.0.2' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../array-0.5.0.0' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../base-4.7.1.0' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../integer-gmp-0.5.1.0' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../ghc-prim-0.3.1.0' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../rts-1.0' -optl-Wl,-zorigin utils/dll-split/dist-install/build/Main.dyn_o /usr/home/ghc-builder/work/builder/tempbuild/build/libraries/ghc-prim/dist-install/build/libHSghc-prim-0.3.1.0-ghc7.9.20140703.so: undefined reference to `__sync_fetch_and_xor_8' /usr/home/ghc-builder/work/builder/tempbuild/build/libraries/ghc-prim/dist-install/build/libHSghc-prim-0.3.1.0-ghc7.9.20140703.so: undefined reference to `__sync_fetch_and_and_8' /usr/home/ghc-builder/work/builder/tempbuild/build/libraries/ghc-prim/dist-install/build/libHSghc-prim-0.3.1.0-ghc7.9.20140703.so: undefined reference to `__sync_fetch_and_nand_8' /usr/home/ghc-builder/work/builder/tempbuild/build/libraries/ghc-prim/dist-install/build/libHSghc-prim-0.3.1.0-ghc7.9.20140703.so: undefined reference to `__sync_val_compare_and_swap_8' /usr/home/ghc-builder/work/builder/tempbuild/build/libraries/ghc-prim/dist-install/build/libHSghc-prim-0.3.1.0-ghc7.9.20140703.so: undefined reference to `__sync_fetch_and_sub_8' /usr/home/ghc-builder/work/builder/tempbuild/build/libraries/ghc-prim/dist-install/build/libHSghc-prim-0.3.1.0-ghc7.9.20140703.so: undefined reference to `__sync_fetch_and_add_8' /usr/home/ghc-builder/work/builder/tempbuild/build/libraries/ghc-prim/dist-install/build/libHSghc-prim-0.3.1.0-ghc7.9.20140703.so: undefined reference to `__sync_fetch_and_or_8' collect2: error: ld returned 1 exit status This probably due to the strict defaults of the FreeBSD of GCC, where march=i386 is assumed, which does not support the required CMPXCHG8B instruction. One would need at least an i586 to get that. It is not observed on GNU/Linux as it allegedly defaults to i586 code generation. The trivial patch below makes this explicit so now it could build: --- ghc-prim.cabal.orig 2014-07-03 03:06:16.000000000 +0200 +++ ghc-prim.cabal 2014-07-03 20:27:49.709087595 +0200 @@ -62,3 +62,6 @@ -- We need to set the package name to ghc-prim (without a version number) -- as it's magic. ghc-options: -package-name ghc-prim + -- Due to CMPXCHG8B, we have to ask for Pentium code generation. + cc-options: -march=i586 + However, my fellow developer, Konstantin Belousov pointed out that using CMPXCHG8B would officially require checking for the corresponding CPUID bit set, because that is what truly indicates the presence of that instruction. [1] http://haskell.inf.elte.hu/builders/freebsd-i386-head/304/10.html
participants (1)
-
Páli Gábor János