Ticket #7722 (closed feature request: fixed)
iOS patch no 11: Fix quirk with runtime loader
| Reported by: | StephenBlackheath | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Compiler | Version: | 7.7 |
| Keywords: | Cc: | dterei | |
| Operating System: | Other | Architecture: | arm |
| Type of failure: | None/Unknown | Difficulty: | Unknown |
| Test Case: | Blocked By: | ||
| Blocking: | #7724 | Related Tickets: |
Description
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.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

