Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: sysdeps/unix/make-syscalls.sh

Issue 7737022: Change make-syscalls.sh to make syscall interception possible. (Closed) Base URL: http://git.chromium.org/native_client/nacl-glibc.git@master
Patch Set: base => name Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sysdeps/nacl/unsupported/call_pselect6.c ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #! /bin/sh 1 #! /bin/sh
2 2
3 # Usage: make-syscalls.sh ../sysdeps/unix/common 3 # Usage: make-syscalls.sh ../sysdeps/unix/common
4 # Expects $sysdirs in environment. 4 # Expects $sysdirs in environment.
5 5
6 ############################################################################## 6 ##############################################################################
7 7
8 # Syscall Signature Key Letters for BP Thunks: 8 # Syscall Signature Key Letters for BP Thunks:
9 # 9 #
10 # a: unchecked address (e.g., 1st arg to mmap) 10 # a: unchecked address (e.g., 1st arg to mmap)
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 esac 152 esac
153 153
154 echo " \$(common-objpfx)sysd-syscalls \\" 154 echo " \$(common-objpfx)sysd-syscalls \\"
155 echo " \$(common-objpfx)s-proto$cancellable.d" 155 echo " \$(common-objpfx)s-proto$cancellable.d"
156 case x"$callnum" in 156 case x"$callnum" in
157 x_) 157 x_)
158 echo "\ 158 echo "\
159 (echo '/* Dummy module requested by syscalls.list */'; \\" 159 (echo '/* Dummy module requested by syscalls.list */'; \\"
160 ;; 160 ;;
161 x*) 161 x*)
162 case $args in
163 *:*)
164 set `echo $args |
165 sed -e 's/^\(.\):\(.*\)/\2 \10/' \
166 -e 's/^\([^ ]\)\(.*\)/\2 \11/' \
167 -e 's/^\([^ ]\)\(.*\)/\2 \12/' \
168 -e 's/^\([^ ]\)\(.*\)/\2 \13/' \
169 -e 's/^\([^ ]\)\(.*\)/\2 \14/' \
170 -e 's/^\([^ ]\)\(.*\)/\2 \15/' \
171 -e 's/^\([^ ]\)\(.*\)/\2 \16/' \
172 -e 's/^\([^ ]\)\(.*\)/\2 \17/' \
173 -e 's/^\([^ ]\)\(.*\)/\2 \18/' \
174 -e 's/^\([^ ]\)\(.*\)/\2 \19/'`
175 ;;
176 *) set i;;
177 esac
178 rtn=$1; shift
179 case $rtn in
180 [bp]*) frtn='void *';;
181 *) frtn='int ';;
182 esac
162 echo "\ 183 echo "\
163 \$(make-target-directory) 184 \$(make-target-directory)
164 » (echo 'int __unimplemented_syscall(const char *name);'; \\ 185 » (echo '#define $strong ${strong}_RENAMED'; \\"
165 » echo 'int $strong (void);'; \\ 186 for name in $weak; do
166 » echo 'libc_hidden_proto ($strong)'; \\ 187 case $name in
167 » echo 'int $strong (void) { return __unimplemented_syscall(\"$syscall\") ; }'; \\ 188 *@@*) base=`echo $name | sed 's/@@.*//'`;;
189 *@*) base=`echo $name | sed 's/@.*//'`;;
190 *) base=$name;;
191 esac
192 echo "» echo '#define $base ${base}_RENAMED'; \\"
193 done
194 echo "\
195 » echo '#include <sysdep.h>'; \\
196 » echo '#undef $strong'; \\"
197 for name in $weak; do
198 case $name in
199 *@@*) base=`echo $name | sed 's/@@.*//'`;;
200 *@*) base=`echo $name | sed 's/@.*//'`;;
201 *) base=$name;;
202 esac
203 echo "» echo '#undef $base'; \\"
204 done
205 echo "\
206 » echo '$frtn$strong ( ); /* $args */'; \\
207 » echo 'libc_hidden_proto ($strong)'; \\"
208 echo -n "» echo '$frtn$strong ("
209 sprtr=
210 for arg; do
211 echo -n "$sprtr"
212 case $arg in
213 [abIpP]*) echo -n "void *$arg";;
214 f*) echo -n "int $arg[2]";;
215 i*) echo -n "int $arg";;
216 n*) echo -n "size_t $arg";;
217 [sS]*) echo -n "char *$arg";;
218 V*) echo -n "unsigned char *$arg";;
219 W*) echo -n "int *$arg";;
220 esac
221 sprtr=", "
222 done
223 echo ") {'; \\"
224 echo -n "» echo ' return INLINE_SYSCALL ($syscall, $nargs"
225 for arg; do
226 echo -n ", $arg"
227 done
228 echo ");'; \\
229 » echo '}'; \\
168 echo 'strong_alias ($strong, __${syscall}_nocancel)'; \\ 230 echo 'strong_alias ($strong, __${syscall}_nocancel)'; \\
169 echo 'libc_hidden_def ($strong)'; \\" 231 echo 'libc_hidden_def ($strong)'; \\"
170 ;; 232 ;;
171 esac 233 esac
172 234
173 # Append any weak aliases or versions defined for this syscall function. 235 # Append any weak aliases or versions defined for this syscall function.
174 236
175 # A shortcoming in the current gas is that it will only allow one 237 # A shortcoming in the current gas is that it will only allow one
176 # version-alias per symbol. So we create new strong aliases as needed. 238 # version-alias per symbol. So we create new strong aliases as needed.
177 vcount="" 239 vcount=""
(...skipping 25 matching lines...) Expand all
203 echo " echo 'strong_alias ($strong, $source)'; \\" 265 echo " echo 'strong_alias ($strong, $source)'; \\"
204 fi 266 fi
205 echo " echo 'symbol_version($source, $base, $ver);'; \\" 267 echo " echo 'symbol_version($source, $base, $ver);'; \\"
206 ;; 268 ;;
207 !*) 269 !*)
208 name=`echo $name | sed 's/.//'` 270 name=`echo $name | sed 's/.//'`
209 echo " echo 'strong_alias ($strong, $name)'; \\" 271 echo " echo 'strong_alias ($strong, $name)'; \\"
210 echo " echo 'libc_hidden_def ($name)'; \\" 272 echo " echo 'libc_hidden_def ($name)'; \\"
211 ;; 273 ;;
212 *) 274 *)
213 » echo "» echo 'int $name (void);'; \\" 275 » echo "» echo '$frtn$name ( );'; \\"
214 echo " echo 'libc_hidden_proto ($name)'; \\" 276 echo " echo 'libc_hidden_proto ($name)'; \\"
215 echo " echo 'weak_alias ($strong, $name)'; \\" 277 echo " echo 'weak_alias ($strong, $name)'; \\"
216 echo " echo 'libc_hidden_weak ($name)'; \\" 278 echo " echo 'libc_hidden_weak ($name)'; \\"
217 ;; 279 ;;
218 esac 280 esac
219 done 281 done
220 282
221 # And finally, pipe this all into the compiler. 283 # And finally, pipe this all into the compiler.
222 echo ' ) | $(compile-syscall) '"\ 284 echo ' ) | $(compile-syscall) '"\
223 \$(foreach p,\$(patsubst %$file,%,\$(basename \$(@F))),\$(\$(p)CPPFLAGS))" 285 \$(foreach p,\$(patsubst %$file,%,\$(basename \$(@F))),\$(\$(p)CPPFLAGS))"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 ) | \$(COMPILE.c) -x c -o \$@ -" 399 ) | \$(COMPILE.c) -x c -o \$@ -"
338 ### Use this for debugging intermediate output: 400 ### Use this for debugging intermediate output:
339 ### ) >\$(@:.ob=.c) 401 ### ) >\$(@:.ob=.c)
340 ### \$(subst -c,-E,\$(COMPILE.c)) -o \$(@:.ob=.ib) \$(@:.ob=.c) 402 ### \$(subst -c,-E,\$(COMPILE.c)) -o \$(@:.ob=.ib) \$(@:.ob=.c)
341 ### \$(COMPILE.c) -x cpp-output -o \$@ \$(@:.ob=.ib)" 403 ### \$(COMPILE.c) -x cpp-output -o \$@ \$(@:.ob=.ib)"
342 echo endif 404 echo endif
343 ;; 405 ;;
344 esac 406 esac
345 407
346 done 408 done
OLDNEW
« no previous file with comments | « sysdeps/nacl/unsupported/call_pselect6.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698