ffi 1.14: #objc_call OS-gating cross-compiles cleanly to Android
109/109 host tests pass; tests/cross_compile.sh's first real tuple
(`android | examples/ffi-objc-call-10-os-gate.sx`) compiles
through `sx build --target android` without finding any
`@objc_msgSend` / `@sel_registerName` symbols in the output —
the `inline if OS == .ios { #objc_call(...) }` arm is stripped
at sx compile time before emit_llvm runs, so the Android
toolchain (Bionic + libGLESv3 / NDK linker) doesn't see the
Obj-C runtime references that would otherwise be undefined.
Host (macOS): the example prints "host stripped both" — the iOS
arm is stripped (we're not iOS) AND the Android arm is stripped
(we're not Android), confirming `inline if OS == { case }`
symmetric strip-and-render works around `#objc_call` sites.
The example carries a 3-line `android_main` trampoline so the
NDK linker's `-u ANativeActivity_onCreate` / entry-point
discovery is satisfied — pattern shared with chess + the other
android examples.
This commit is contained in:
@@ -22,9 +22,12 @@ TMP_DIR="${TMPDIR:-/tmp}/sx-cross-compile"
|
||||
mkdir -p "$TMP_DIR"
|
||||
|
||||
# Tuple format: "<target>|<example_path>"
|
||||
# Add entries as cross-only examples land. Empty for now — Phase 0 only
|
||||
# lays down the runner; baselines live in tests/run_examples.sh territory.
|
||||
TUPLES=()
|
||||
# Add entries as cross-only examples land. Verifies the example
|
||||
# compiles cleanly for the target's NDK / SDK without needing the
|
||||
# host to actually run it.
|
||||
TUPLES=(
|
||||
"android|examples/ffi-objc-call-10-os-gate.sx"
|
||||
)
|
||||
|
||||
PASS=0
|
||||
FAIL=0
|
||||
|
||||
1
tests/expected/ffi-objc-call-10-os-gate.exit
Normal file
1
tests/expected/ffi-objc-call-10-os-gate.exit
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
1
tests/expected/ffi-objc-call-10-os-gate.txt
Normal file
1
tests/expected/ffi-objc-call-10-os-gate.txt
Normal file
@@ -0,0 +1 @@
|
||||
host stripped both
|
||||
Reference in New Issue
Block a user