Files
chanora/apps/chanora_flutter/ios
Edison Jwa 1bc2fccd0a fix(ios,macos): add -u force-undefined linker flags for @_cdecl symbols
Oracle re-review on PR #26 flagged that the Swift-side
`_ = unsafeBitCast(fn as @convention(c) ...)` static references in
ChanoraSileroSelfTest.run() are not a robust anti-dead-strip guarantee
under WMO + LTO. The optimizer can prove the discarded result has no
side effects and eliminate the address-taken reference.

The load-bearing fix is a second linker flag per symbol:

  -u _sym                forces the symbol as undefined at link time,
                         preventing the object that defines it from
                         being dropped and stopping -dead_strip from
                         removing the definition.
  -exported_symbol _sym  was already present; re-exports the symbol
                         in the binary's dynamic symbol table so the
                         Rust framework's dlsym(RTLD_DEFAULT) can find
                         it. This flag alone does NOT prevent dead-
                         strip; it only controls the export list
                         applied AFTER dead-strip.

Both flags now appear per symbol on both iOS and macOS Release
xcconfigs. The Swift-side static references stay as defense-in-depth
but are no longer the load-bearing guarantee.
2026-06-07 23:12:07 +09:00
..