[GHC] #13576: Runtime crashes on arm64 (iOS)
GHC
ghc-devs at haskell.org
Fri Apr 14 17:59:50 UTC 2017
#13576: Runtime crashes on arm64 (iOS)
----------------------------------------+----------------------------------
Reporter: jp.rider63 | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version:
Keywords: | Operating System: MacOS X
Architecture: Unknown/Multiple | Type of failure: Runtime crash
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
----------------------------------------+----------------------------------
I compiled GHC from source (ff84d052850b637b0) with a few modifications to
create a cross-compiler for arm64. This was the configuration:
{{{
CC=aarch64-apple-darwin14-clang ./configure --prefix=/usr/local/ghc-ios
--target=aarch64-apple-darwin14 --disable-large-address-space --enable-
bootstrap-with-devel-snapshot
}}}
Here's my "mk/build.mk":
{{{
HADDOCK_DOCS=NO
WITH_TERMINFO=NO
DYNAMIC_BY_DEFAULT=NO
DYNAMIC_GHC_PROGRAMS=NO
DYNAMIC_TOO=NO
}}}
I used the stage1 compiler to export an arm64 library. The application
(which links the library) crashes when run on my device (iOS 10.2.1). The
application runs without issue on x86 and arm32. When I initialize with
-DS, I get the following error:
{{{
internal error: ASSERTION FAILED: file rts/sm/Sanity.c, line 88
(GHC version 8.3.20170408 for aarch64_apple_ios)
Please report this as a GHC bug:
http://www.haskell.org/ghc/reportabug
// SIGABRT at line 182 in RtsMessages.c
}}}
To narrow down the offending code, I replaced all my functions with print
statements and slowly added the functionality back until I could reproduce
the crash. It looks like the crash happens around a call to this function:
{{{
foreign export ccall hs_AAPublicKeyAlgorithm :: StablePtr AA.PublicKey ->
IO CString
hs_AAPublicKeyAlgorithm :: StablePtr AA.PublicKey -> IO CString
hs_AAPublicKeyAlgorithm = hs_toAlgorithmIdentifier
hs_toAlgorithmIdentifier :: (ToAlgorithm t a, AlgorithmId a) => StablePtr
t -> IO CString
hs_toAlgorithmIdentifier ptr = do
algId <- fmap (toAlgorithmId . toAlgorithm) $ deRefStablePtr ptr
newCString algId
}}}
Oddly, when I add print statements around this call, I get a
EXC_BREAKPOINT instead of a SIGABRT. Here's the output for this case:
{{{
****************TEST************
****************TEST************
****************TEST************
****************TEST************
v1K_FZuskg6Bkm-whFvkQ8IzHxnXDSGibCwbqZpM0fk=
here
****************TEST************
here1
here2
}}}
I've disabled dead code stripping.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13576>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list