iOS patch no 11: Fix quirk with runtime loader
On iOS, due to a quirk, we must put references to external symbols into the data segment. If, for example, we have a declaration like this:
foreign import ccall unsafe "static stdlib.h &free"
c_free_finalizer :: FunPtr (Ptr Word8 -> IO ())
- ..then it tries to resolve the address of 'free' at runtime. The loader then attempts to write that address into the text segment. On iOS, modifying the text segment is not allowed, and so a runtime exception is thrown.
We work around this issue by fetching the reference to the external symbol from the data segment.
Trac metadata
Trac field | Value |
---|---|
Version | 7.7 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |