Skip to content

Commit 0b9a391

Browse files
committed
Mention not to expect the JIT-based interpreter to work on real iPhone
1 parent e088647 commit 0b9a391

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,18 @@ Here, we copy the `LLVM-iOS-Simulator` to build the app and run it on the simula
8080

8181
Read on for details on how to create and configure your own project.
8282

83-
**Known Limitation**: For simulator, can only build **Debug** version only!
84-
The current app does not work on real device yet (UI is OK but cannot interpret)!
83+
### Known Limitation
84+
For simulator, can only build **Debug** version only!
85+
Do NOT expect the app to work on real iPhone due to iOS security preventing [Just-In-Time (JIT) Execution](https://saagarjha.com/blog/2020/02/23/jailed-just-in-time-compilation-on-ios/) that the interpreter example was doing.
86+
By pulling out the device crash logs, the reason turns out to be the fact the [code generated in-memory by LLVM/Clang wasn't signed](http://iphonedevwiki.net/index.php/Code_Signing) and so the app was terminated with SIGTERM CODESIGN.
87+
(It does work sometimes if one launches the app from Xcode though.)
88+
If there is compilation error, the error message was printed out instead of crashing as expected:
89+
90+
![Add #include non-existing header](Screenshot_Real_iPhone1.png)
91+
![Compilation error was printed out](Screenshot_Real_iPhone2.png)
92+
93+
To make the app work on real iPhone, compilation into binary, somehow sign it and use [system()](https://stackoverflow.com/questions/32439095/how-to-execute-a-command-line-in-iphone) is a possibility.
94+
Another possibility would be to use the slower LLVM bytecode interpreter instead of ORC JIT that the example was doing, as many [existing terminal apps](https://opensource.com/article/20/9/run-linux-ios) illustrated.
8595

8696
Behind the Scene: Configure iOS App Xcode Project
8797
-------------------------------------------------

Screenshot_Real_iPhone1.png

104 KB
Loading

Screenshot_Real_iPhone2.png

93.2 KB
Loading

0 commit comments

Comments
 (0)