]>
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 regex
=$
'\nNon-fat file: .* is architecture: (.*)'
26 if [[ ${detailed} =~
${regex} ]]; then
27 archs
=(${BASH_REMATCH[1]})
30 archs
=($(echo "${detailed}" | "${sed}" -e '/^architecture / { s/^architecture //; p; }; d;'))
33 echo '#include "Trampoline.hpp"'
35 for arch
in "${archs[@]}"; do
36 if [[ "${detailed+@}" ]]; then
37 offset
=$
(echo "${detailed}" | "${sed}" -e '
38 /^architecture / { x; s/.*/0/; x; };
39 /^architecture '${arch}'$/ { x; s/.*/1/; x; };
40 x; /^1$/ { x; /^ *offset / { s/^ *offset //; p; }; x; }; x;
47 file=($
("${otool}" -arch "${arch}" -l "${object}" | "${sed}" -e '
49 /^ *fileoff / { s/^.* //; p; };
50 /^ *filesize / { s/^.* //; p; };
53 /^ *cmd LC_SEGMENT/ { x; s/.*/1/; x; };
62 echo "static const char ${name}_${arch}_data_[] = {"
64 od -v -t x1
-t c
-j "$((offset + fileoff))" -N "${filesize}" "${object}" | "${sed}" -e '
78 s/\([^,][^,]\)/0x\1/g;
80 /^,$/ ! { s/^/ /g; p; }; d;
87 entry
=$("${nm}" -arch "${arch}" "${object}" | "${sed}" -e '/ _Start$/ { s/ .*//; p; }; d;')
89 echo "static size_t ${name}_${arch}_entry_ = 0x${entry:=0};"
93 "${otool}" -vVt -arch "${arch}" "${object}"
97 echo "static Trampoline ${name}_${arch}_ = {"
98 echo " ${name}_${arch}_data_,"
99 echo " sizeof(${name}_${arch}_data_),"
100 echo " ${name}_${arch}_entry_,"