Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 | | |
|
pasko-google - do not use
2011/09/06 14:18:56
type=`echo ...`
khim
2011/09/06 14:25:34
We need sed construct to pull other argument types
| |
| 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 int;; | |
|
pasko-google - do not use
2011/09/06 14:18:56
too many leading spaces
khim
2011/09/06 14:25:34
Done.
| |
| 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 *@@*) |
| 189 » base=`echo $name | sed 's/@@.*//'` | |
| 190 » echo "» echo '#define $base ${base}_RENAMED'; \\" | |
| 191 » ;; | |
| 192 *@*) | |
| 193 » base=`echo $name | sed 's/@.*//'` | |
| 194 » echo "» echo '#define $base ${base}_RENAMED'; \\" | |
| 195 » ;; | |
| 196 *) | |
| 197 » echo "» echo '#define $name ${name}_RENAMED'; \\" | |
|
pasko-google - do not use
2011/09/06 14:18:56
base=$name
..
esac
echo "..."
khim
2011/09/06 14:25:34
Done.
| |
| 198 » ;; | |
| 199 esac | |
| 200 done | |
| 201 echo "\ | |
| 202 » echo '#include <sysdep.h>'; \\ | |
| 203 » echo '#undef $strong'; \\" | |
| 204 for name in $weak; do | |
| 205 case $name in | |
| 206 *@@*) | |
| 207 » base=`echo $name | sed 's/@@.*//'` | |
| 208 » echo "» echo '#undef $base'; \\" | |
| 209 » ;; | |
| 210 *@*) | |
| 211 » base=`echo $name | sed 's/@.*//'` | |
| 212 » echo "» echo '#undef $base'; \\" | |
| 213 » ;; | |
| 214 *) | |
| 215 » echo "» echo '#undef $name'; \\" | |
|
pasko-google - do not use
2011/09/06 14:18:56
ditto
khim
2011/09/06 14:25:34
Done.
| |
| 216 » ;; | |
| 217 esac | |
| 218 done | |
| 219 echo "\ | |
| 220 » echo '$frtn$strong ( ); /* $args */'; \\ | |
| 221 » echo 'libc_hidden_proto ($strong)'; \\" | |
| 222 echo -n "» echo '$frtn$strong (" | |
| 223 sprtr= | |
| 224 for arg; do | |
| 225 echo -n "$sprtr" | |
| 226 case $arg in | |
| 227 [abIpP]*) echo -n "void *$arg";; | |
| 228 f*) echo -n "int $arg[2]";; | |
| 229 i*) echo -n "int $arg";; | |
| 230 n*) echo -n "size_t $arg";; | |
| 231 [sS]*) echo -n "char *$arg";; | |
| 232 V*) echo -n "unsigned char *$arg";; | |
| 233 W*) echo -n "int *$arg";; | |
| 234 esac | |
| 235 sprtr=", " | |
| 236 done | |
| 237 echo ") {'; \\" | |
| 238 echo -n "» echo ' return INLINE_SYSCALL ($syscall, $nargs" | |
| 239 for arg; do | |
| 240 echo -n ", $arg" | |
| 241 done | |
| 242 echo ");'; \\ | |
| 243 » echo '}'; \\ | |
| 168 echo 'strong_alias ($strong, __${syscall}_nocancel)'; \\ | 244 echo 'strong_alias ($strong, __${syscall}_nocancel)'; \\ |
| 169 echo 'libc_hidden_def ($strong)'; \\" | 245 echo 'libc_hidden_def ($strong)'; \\" |
| 170 ;; | 246 ;; |
| 171 esac | 247 esac |
| 172 | 248 |
| 173 # Append any weak aliases or versions defined for this syscall function. | 249 # Append any weak aliases or versions defined for this syscall function. |
| 174 | 250 |
| 175 # A shortcoming in the current gas is that it will only allow one | 251 # 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. | 252 # version-alias per symbol. So we create new strong aliases as needed. |
| 177 vcount="" | 253 vcount="" |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 203 echo " echo 'strong_alias ($strong, $source)'; \\" | 279 echo " echo 'strong_alias ($strong, $source)'; \\" |
| 204 fi | 280 fi |
| 205 echo " echo 'symbol_version($source, $base, $ver);'; \\" | 281 echo " echo 'symbol_version($source, $base, $ver);'; \\" |
| 206 ;; | 282 ;; |
| 207 !*) | 283 !*) |
| 208 name=`echo $name | sed 's/.//'` | 284 name=`echo $name | sed 's/.//'` |
| 209 echo " echo 'strong_alias ($strong, $name)'; \\" | 285 echo " echo 'strong_alias ($strong, $name)'; \\" |
| 210 echo " echo 'libc_hidden_def ($name)'; \\" | 286 echo " echo 'libc_hidden_def ($name)'; \\" |
| 211 ;; | 287 ;; |
| 212 *) | 288 *) |
| 213 » echo "» echo 'int $name (void);'; \\" | 289 » echo "» echo '$frtn$name ( );'; \\" |
| 214 echo " echo 'libc_hidden_proto ($name)'; \\" | 290 echo " echo 'libc_hidden_proto ($name)'; \\" |
| 215 echo " echo 'weak_alias ($strong, $name)'; \\" | 291 echo " echo 'weak_alias ($strong, $name)'; \\" |
| 216 echo " echo 'libc_hidden_weak ($name)'; \\" | 292 echo " echo 'libc_hidden_weak ($name)'; \\" |
| 217 ;; | 293 ;; |
| 218 esac | 294 esac |
| 219 done | 295 done |
| 220 | 296 |
| 221 # And finally, pipe this all into the compiler. | 297 # And finally, pipe this all into the compiler. |
| 222 echo ' ) | $(compile-syscall) '"\ | 298 echo ' ) | $(compile-syscall) '"\ |
| 223 \$(foreach p,\$(patsubst %$file,%,\$(basename \$(@F))),\$(\$(p)CPPFLAGS))" | 299 \$(foreach p,\$(patsubst %$file,%,\$(basename \$(@F))),\$(\$(p)CPPFLAGS))" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 337 ) | \$(COMPILE.c) -x c -o \$@ -" | 413 ) | \$(COMPILE.c) -x c -o \$@ -" |
| 338 ### Use this for debugging intermediate output: | 414 ### Use this for debugging intermediate output: |
| 339 ### ) >\$(@:.ob=.c) | 415 ### ) >\$(@:.ob=.c) |
| 340 ### \$(subst -c,-E,\$(COMPILE.c)) -o \$(@:.ob=.ib) \$(@:.ob=.c) | 416 ### \$(subst -c,-E,\$(COMPILE.c)) -o \$(@:.ob=.ib) \$(@:.ob=.c) |
| 341 ### \$(COMPILE.c) -x cpp-output -o \$@ \$(@:.ob=.ib)" | 417 ### \$(COMPILE.c) -x cpp-output -o \$@ \$(@:.ob=.ib)" |
| 342 echo endif | 418 echo endif |
| 343 ;; | 419 ;; |
| 344 esac | 420 esac |
| 345 | 421 |
| 346 done | 422 done |
| OLD | NEW |