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