-
-
Save zhuowei/756acee88c92f090b8cdb38ec810e986 to your computer and use it in GitHub Desktop.
Modified version of Stroughtonsmith's bitcode2intel script; doesn't work; gives"ld: in section __TEXT,__swift5_types reloc 0: X86_64_RELOC_SUBTRACTOR must have r_extern=1 file 'F31BA3F0-12EE-482A-8399-26EEA2E654DD.o' for architecture x86_64"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TARGET="$( cd "$(dirname "$1")" ; pwd -P )/$1" | |
SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk" | |
TARGET_ARCH=x86_64 | |
LLVMROOT="/Users/zhuowei/Documents/prog/clang+llvm-8.0.0-x86_64-apple-darwin" | |
export IPHONEOS_DEPLOYMENT_TARGET=12.2 | |
rm -r /tmp/bitcode2intel | |
mkdir -p /tmp/bitcode2intel | |
pushd /tmp/bitcode2intel | |
ebcutil -a arm64 -e "$TARGET" | |
echo "Starting conversion of $TARGET" | |
for f in /tmp/bitcode2intel/*; | |
do | |
"$LLVMROOT/bin/llvm-dis" -o=- "$f" | sed -e "s/call void asm .*//g" | \ | |
"$LLVMROOT/bin/llc" -mtriple=x86_64-apple-ios12.2.0-simulator -mcpu=penryn \ | |
-filetype=obj -o $f.o | |
done | |
clang -miphoneos-version-min=$IPHONEOS_DEPLOYMENT_TARGET -arch $TARGET_ARCH -fembed-bitcode -isysroot $SYSROOT *.o -o "$TARGET".intel -v | |
lipo "$TARGET" -remove $TARGET_ARCH -o "$TARGET" | |
lipo "$TARGET" -create -arch_blank $TARGET_ARCH -o "$TARGET" | |
lipo "$TARGET" -replace $TARGET_ARCH "$TARGET".intel -o "$TARGET" | |
popd | |
rm -r /tmp/bitcode2intel |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment