elf: Remove legacy hwcaps support from the dynamic loader
[glibc.git] / mach / shortcut.awk
blob090da82b6a81298570be539df7e62b3ae6c5c223
1 # Icky intimate knowledge of MiG output.
3 BEGIN { print "/* This file is generated by shortcut.awk. */";
4 print "#include <mach-shortcuts-hidden.h>";
5 echo=1;
6 inproto=0; proto=""; arglist="";
9 $1 == "LINTLIBRARY" { print "#include <mach.h>"; next }
11 $1 == "weak_alias" { next }
13 # Copy the first line of the definition, but
14 # replace the function name (RPC) with CALL.
15 $NF == rpc \
17 for (i = 1; i < NF; ++i) printf "%s ", $i;
18 print call;
19 next;
22 # Collect the lines of the prototype in PROTO, and extract the parameter
23 # names into ARGLIST.
24 NF == 1 && $1 == ")" { inproto=0 }
25 inproto { proto = proto $0;
26 arg = $NF;
27 gsub(/[^a-zA-Z0-9_,]/, "", arg);
28 arglist = arglist arg;
30 NF == 1 && $1 == "(" { inproto=1 }
32 /^{$/ { echo=0; }
34 echo == 1 { print $0; }
36 /^}$/ && proto != "" \
38 print "{";
39 print " kern_return_t err;";
40 print " extern kern_return_t " syscall " (" proto ");";
41 print " extern kern_return_t " rpc " (" proto ");";
42 print " err = " syscall " (" arglist ");";
43 print " if (err == MACH_SEND_INTERRUPTED)";
44 print " err = " rpc " (" arglist ");";
45 print " return err;"
46 print "}";
47 print "weak_alias (" call ", " alias ")";
48 print "libc_hidden_def (" call ")";
49 # Declare RPC so the weak_alias that follows will work.
50 print "extern __typeof (" call ") " rpc ";";
51 echo = 1;