Skip to content
This repository was archived by the owner on Jun 11, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/xcodebuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@ on:
- 'InterposeKit.xcodeproj/**'
- 'Sources/**/*.[ch]'
- 'Sources/**/*.swift'
- 'Example/**'
- 'Tests/**/*.swift'
- 'Tests/verify_release_linking.sh'
- '!Tests/LinuxMain.swift'
pull_request:
paths:
- '.github/workflows/xcodebuild.yml'
- 'InterposeKit.xcodeproj/**'
- 'Sources/**/*.[ch]'
- 'Sources/**/*.swift'
- 'Example/**'
- 'Tests/**/*.swift'
- 'Tests/verify_release_linking.sh'
- '!Tests/LinuxMain.swift'
workflow_dispatch:

Expand All @@ -32,6 +36,8 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: xcodebuild -version
- name: Release device app preserves object-hook helper
run: bash Tests/verify_release_linking.sh
- name: macOS with UTF16
if: always()
run: YAMS_DEFAULT_ENCODING=UTF16 xcodebuild ${{ matrix.xcode_flags }} ${{ matrix.flags_for_test }} -destination "platform=macOS,arch=$(uname -m)" test | xcpretty
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
##### Bug Fixes

* Preserve trampoline argument registers in code-coverage builds.
* Preserve object-hook super trampolines in optimized Release builds, fixing https://github.com/steipete/InterposeKit/issues/29. Thanks to [@Thomvis](https://github.com/Thomvis).

## 0.01

Expand Down
3 changes: 2 additions & 1 deletion Sources/SuperBuilder/src/ITKSuperBuilder.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ static IMP ITKGetTrampolineForTypeEncoding(__unused const char *typeEncoding) {
return requiresStructDispatch ? (IMP)msgSendSuperStretTrampoline : (IMP)msgSendSuperTrampoline;
}

// Helper for binding with Swift
// Keep the helper available for Swift's runtime lookup in optimized application binaries.
__attribute__((__used__))
BOOL IKTAddSuperImplementationToClass(Class originalClass, SEL selector, NSError **error);
BOOL IKTAddSuperImplementationToClass(Class originalClass, SEL selector, NSError **error) {
return [SuperBuilder addSuperInstanceMethodToClass:originalClass selector:selector error:error];
Expand Down
25 changes: 25 additions & 0 deletions Tests/verify_release_linking.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

set -euo pipefail

derived_data="$(mktemp -d "${TMPDIR:-/tmp}/InterposeKitReleaseLinking.XXXXXX")"

xcodebuild \
-project Example/InterposeExample.xcodeproj \
-scheme InterposeExample \
-configuration Release \
-sdk iphoneos \
-destination "generic/platform=iOS" \
-derivedDataPath "$derived_data" \
CODE_SIGNING_ALLOWED=NO \
build \
-quiet

binary="$derived_data/Build/Products/Release-iphoneos/InterposeExample.app/InterposeExample"

if ! xcrun nm -a "$binary" | grep -E '[[:space:]]T[[:space:]]_IKTAddSuperImplementationToClass$' >/dev/null; then
echo "IKTAddSuperImplementationToClass was stripped from the optimized app binary." >&2
exit 1
fi

echo "Verified IKTAddSuperImplementationToClass in the optimized app binary."
Loading