]>
git.saurik.com Git - cycript.git/blob - trampoline.sh
15 #set /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 -I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk/usr/include "$@"
19 detailed
=$(lipo -detailed_info "${object}")
23 echo '#include "Trampoline.hpp"'
25 for arch
in $(echo "${detailed}" | "${sed}" -e '/^architecture / { s/^architecture //; p; }; d;'); do
26 offset
=$
(echo "${detailed}" | "${sed}" -e '
27 /^architecture / { x; s/.*/0/; x; };
28 /^architecture '${arch}'$/ { x; s/.*/1/; x; };
29 x; /^1$/ { x; /^ *offset / { s/^ *offset //; p; }; x; }; x;
33 file=($
("${otool}" -arch "${arch}" -l "${object}" | "${sed}" -e '
35 /^ *fileoff / { s/^.* //; p; };
36 /^ *filesize / { s/^.* //; p; };
39 /^ *cmd LC_SEGMENT/ { x; s/.*/1/; x; };
48 echo "static const char ${name}_${arch}_data_[] = {"
50 od -v -t x1
-t c
-j "$((offset + fileoff))" -N "${filesize}" "${object}" | "${sed}" -e '
64 s/\([^,][^,]\)/0x\1/g;
66 /^,$/ ! { s/^/ /g; p; }; d;
73 entry
=$("${nm}" -arch "${arch}" "${object}" | "${sed}" -e '/ _Start$/ { s/ .*//; p; }; d;')
75 echo "static size_t ${name}_${arch}_entry_ = 0x${entry:=0};"
79 "${otool}" -vVt -arch "${arch}" "${object}"
83 echo "static Trampoline ${name}_${arch}_ = {"
84 echo " ${name}_${arch}_data_,"
85 echo " sizeof(${name}_${arch}_data_),"
86 echo " ${name}_${arch}_entry_,"