Errors building GHC on iOS with LLVM >= 3.4

Hi, I am trying to help solve #9125 in which an ARM build creates binaries that mangle Float values. After a great deal of help from rwbarton (detailed in the comments) it would appear that the problem is actually in LLVM 3.0. (v3.0 is virtually insisted upon in the iOS build instructions) Building GHC 7.8.3 for the iOS simulator with LLVM 3.4 produces a compiler that creates well behaved binaries. Unfortunately, building the device version fails with several warnings along the lines of: /var/folders/02/0mv6cz6505x2xhzlr279k2340000gp/T/ghc5244_0/ghc5244_6-armv7s.s:2944:2: warning: deprecated since v7, use 'dmb' mcr p15, #0, r7, c7, c10, #5 and: libraries/ghc-prim/cbits/popcnt.c:76:38: warning: shift count >= width of type [-Wshift-count-overflow] popcount_tab[(unsigned char)(x >> 32)] + ^ ~~ before bailing with /var/folders/02/0mv6cz6505x2xhzlr279k2340000gp/T/ghc6860_0/ghc6860_6-armv7.s:3916:2: error: out of range pc-relative fixup value vldr d8, LCPI70_0 ^ /var/folders/02/0mv6cz6505x2xhzlr279k2340000gp/T/ghc6860_0/ghc6860_6-armv7s.s:3916:2: error: out of range pc-relative fixup value vldr d8, LCPI70_0 ^ Next I tried to build HEAD (plus phabricator D208) with LLVM 3.4 but got the same error. Various adventures with LLVM 3.5 ended with the same error. I am trying to educate myself in ARM assembly but in the meantime does this ring any bells for anyone? I don't see anything on the trac. Thanks, Murray Campbell

Murray Campbell
Hi,
I am trying to help solve #9125 in which an ARM build creates binaries that mangle Float values.
After a great deal of help from rwbarton (detailed in the comments) it would appear that the problem is actually in LLVM 3.0. (v3.0 is virtually insisted upon in the iOS build instructions)
Building GHC 7.8.3 for the iOS simulator with LLVM 3.4 produces a compiler that creates well behaved binaries.
Unfortunately, building the device version fails with several warnings along the lines of:
/var/folders/02/0mv6cz6505x2xhzlr279k2340000gp/T/ghc5244_0/ghc5244_6-armv7s.s:2944:2: warning: deprecated since v7, use 'dmb' mcr p15, #0, r7, c7, c10, #5
and:
libraries/ghc-prim/cbits/popcnt.c:76:38: warning: shift count >= width of type [-Wshift-count-overflow] popcount_tab[(unsigned char)(x >> 32)] + ^ ~~ This is a case of an #ifdef being inappropriately x86 specific. The 32-bit popcnt implementation should be used on ARM yet the #ifdef looks at i386_HOST_ARCH.
before bailing with
/var/folders/02/0mv6cz6505x2xhzlr279k2340000gp/T/ghc6860_0/ghc6860_6-armv7.s:3916:2: error: out of range pc-relative fixup value vldr d8, LCPI70_0 ^
/var/folders/02/0mv6cz6505x2xhzlr279k2340000gp/T/ghc6860_0/ghc6860_6-armv7s.s:3916:2: error: out of range pc-relative fixup value vldr d8, LCPI70_0 ^
Next I tried to build HEAD (plus phabricator D208) with LLVM 3.4 but got the same error.
I've never seen an error of this form. What symbol definitions does this error occur in?
Various adventures with LLVM 3.5 ended with the same error.
Be aware that LLVM 3.5 will require D155 due to changes in where LLVM aliases are accepted. Cheers, - Ben

On Sat, Oct 4, 2014 at 7:32 PM, Ben Gamari
Murray Campbell
writes:
[snip]
before bailing with
/var/folders/02/0mv6cz6505x2xhzlr279k2340000gp/T/ghc6860_0/ghc6860_6-armv7.s:3916:2: error: out of range pc-relative fixup value vldr d8, LCPI70_0 ^
/var/folders/02/0mv6cz6505x2xhzlr279k2340000gp/T/ghc6860_0/ghc6860_6-armv7s.s:3916:2: error: out of range pc-relative fixup value vldr d8, LCPI70_0 ^
Next I tried to build HEAD (plus phabricator D208) with LLVM 3.4 but got the same error.
I've never seen an error of this form. What symbol definitions does this error occur in?
I have attached a gzipped version of the *-armv7.s file. The one I attached is from a build with LLVM 3.5. I had to apply D208 & D155 to get it to compile. I also had to get the ghc-ios-scripts/arm-apple-darwin10-clang script to pick up the homebrew clang rather than the apple one to get around an 'unknown directive: .maosx_version_min' error. However, the vldr error is identical to that with LLVM 3.4 building 7.8.3. I can get a straight 7.8.3 with LLVM 3.4 version if that would help. The error in the attached file is at line 5988 just below '_c3pb_info$def: '. This is below '_integerzmsimple_GHCziIntegerziType_doubleFromPositive_info$def:' The last lines of build instructions before the error are: "inplace/bin/ghc-stage1" -hisuf hi -osuf o -hcsuf hc -static -H64m -O0 -this-package-key integ_FpVba29yPwl8vdmOmO0xMS -hide-all-packages -i -ilibraries/integer-simple/. -ilibraries/integer-simple/dist-install/build -ilibraries/integer-simple/dist-install/build/autogen -Ilibraries/integer-simple/dist-install/build -Ilibraries/integer-simple/dist-install/build/autogen -Ilibraries/integer-simple/. -optP-include -optPlibraries/integer-simple/dist-install/build/autogen/cabal_macros.h -package-key ghcpr_BE58KUgBe9ELCsPXiJ1Q2r -this-package-key integer-simple -Wall -XHaskell2010 -XCPP -XMagicHash -XBangPatterns -XUnboxedTuples -XUnliftedFFITypes -XNoImplicitPrelude -O -fllvm -no-user-package-db -rtsopts -odir libraries/integer-simple/dist-install/build -hidir libraries/integer-simple/dist-install/build -stubdir libraries/integer-simple/dist-install/build -c libraries/integer-simple/./GHC/Integer/Type.hs -o libraries/integer-simple/dist-install/build/GHC/Integer/Type.o You are using a new version of LLVM that hasn't been tested yet! We will try though... /var/folders/02/0mv6cz6505x2xhzlr279k2340000gp/T/ghc80302_0/ghc80302_6-armv7.s:5988:2: error: out of range pc-relative fixup value vldr d8, LCPI102_0 ^ /var/folders/02/0mv6cz6505x2xhzlr279k2340000gp/T/ghc80302_0/ghc80302_6-armv7s.s:5988:2: error: out of range pc-relative fixup value vldr d8, LCPI102_0 ^

If this is indeed unfamiliar, should I file a new ticket?
Murray.
On Mon, Oct 6, 2014 at 4:59 PM, Murray Campbell
On Sat, Oct 4, 2014 at 7:32 PM, Ben Gamari
wrote: Murray Campbell
writes: [snip]
before bailing with
/var/folders/02/0mv6cz6505x2xhzlr279k2340000gp/T/ghc6860_0/ghc6860_6-armv7.s:3916:2: error: out of range pc-relative fixup value vldr d8, LCPI70_0 ^
/var/folders/02/0mv6cz6505x2xhzlr279k2340000gp/T/ghc6860_0/ghc6860_6-armv7s.s:3916:2: error: out of range pc-relative fixup value vldr d8, LCPI70_0 ^
Next I tried to build HEAD (plus phabricator D208) with LLVM 3.4 but got the same error.
I've never seen an error of this form. What symbol definitions does this error occur in?
I have attached a gzipped version of the *-armv7.s file. The one I attached is from a build with LLVM 3.5. I had to apply D208 & D155 to get it to compile. I also had to get the ghc-ios-scripts/arm-apple-darwin10-clang script to pick up the homebrew clang rather than the apple one to get around an 'unknown directive: .maosx_version_min' error. However, the vldr error is identical to that with LLVM 3.4 building 7.8.3.
I can get a straight 7.8.3 with LLVM 3.4 version if that would help.
The error in the attached file is at line 5988 just below '_c3pb_info$def: '. This is below '_integerzmsimple_GHCziIntegerziType_doubleFromPositive_info$def:'
The last lines of build instructions before the error are:
"inplace/bin/ghc-stage1" -hisuf hi -osuf o -hcsuf hc -static -H64m -O0 -this-package-key integ_FpVba29yPwl8vdmOmO0xMS -hide-all-packages -i -ilibraries/integer-simple/. -ilibraries/integer-simple/dist-install/build -ilibraries/integer-simple/dist-install/build/autogen -Ilibraries/integer-simple/dist-install/build -Ilibraries/integer-simple/dist-install/build/autogen -Ilibraries/integer-simple/. -optP-include -optPlibraries/integer-simple/dist-install/build/autogen/cabal_macros.h -package-key ghcpr_BE58KUgBe9ELCsPXiJ1Q2r -this-package-key integer-simple -Wall -XHaskell2010 -XCPP -XMagicHash -XBangPatterns -XUnboxedTuples -XUnliftedFFITypes -XNoImplicitPrelude -O -fllvm -no-user-package-db -rtsopts -odir libraries/integer-simple/dist-install/build -hidir libraries/integer-simple/dist-install/build -stubdir libraries/integer-simple/dist-install/build -c libraries/integer-simple/./GHC/Integer/Type.hs -o libraries/integer-simple/dist-install/build/GHC/Integer/Type.o You are using a new version of LLVM that hasn't been tested yet! We will try though...
/var/folders/02/0mv6cz6505x2xhzlr279k2340000gp/T/ghc80302_0/ghc80302_6-armv7.s:5988:2: error: out of range pc-relative fixup value vldr d8, LCPI102_0 ^
/var/folders/02/0mv6cz6505x2xhzlr279k2340000gp/T/ghc80302_0/ghc80302_6-armv7s.s:5988:2: error: out of range pc-relative fixup value vldr d8, LCPI102_0 ^
participants (2)
-
Ben Gamari
-
Murray Campbell