1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
#!/bin/sh
base=`pwd`/../Mesa-7.4.4/include/GL
files="gl.h glu.h"
arch=i386
if [ "$1" != "" ] ; then
os=$1
fi
if [ "$os" == "" ] ; then
os=`uname`
fi
if [ "$2" != "" ] ; then
arch=$2
fi
for f in $files ; do cat $base/$f ; done |
grep ^GLAPI.*ENTRY |
sed 's/GLAPI\ .*\ .*ENTRY\ \([^\ ]*\)\ *(.*/\1/' |
grep -v MESA\$ |
grep -v ATI\$ |
grep -v EXT\$ |
sort -u > tmp-symbol-list.txt
if [ "$arch" == "ppc" ] || [ "$arch" == "ppc64" ] ; then
echo ".section __TEXT,__text,regular,pure_instructions"
echo ".section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32"
if [ "$arch" == "ppc" ] ; then
echo ".machine ppc7400"
else
echo ".machine ppc64"
fi
fi
echo ".text"
if [ "$os" == "Darwin" ] ; then
if [ "$arch" == "ppc" ] || [ "$arch" == "ppc64" ] ; then
echo ".p2align 4,,15"
fi
cat tmp-symbol-list.txt | while read symbol ; do
if [ "$arch" != "i386" ] ; then
echo ".globl _$symbol"
fi
echo ".globl _m$symbol"
echo "_m$symbol:"
case "$arch" in
x86_64)
echo "jmp _$symbol"
;;
i386)
echo "jmp L_$symbol\$stub"
;;
*)
echo "b _$symbol"
esac
done
if [ "$arch" == "i386" ] ; then
echo ".section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5"
cat tmp-symbol-list.txt | while read symbol ; do
echo "L_$symbol\$stub:"
echo ".indirect_symbol _$symbol"
echo "hlt; hlt; hlt; hlt; hlt;"
done
echo ".subsections_via_symbols"
fi
elif [ "$os" == "Linux" ] ; then
cat tmp-symbol-list.txt | while read symbol ; do
echo ".globl m$symbol"
echo ".type m$symbol, @function"
echo "m$symbol:"
echo "jmp $symbol"
echo ".size m$symbol, .-m$symbol"
done
elif [ "$os" == "mingw32" ] ; then
cat tmp-symbol-list.txt | while read symbol ; do
echo ".globl _m$symbol"
echo ".def _m$symbol; .scl 2; .type 32; .endef;"
echo "_m$symbol:"
echo "jmp _$symbol"
done
cat tmp-symbol-list.txt | while read symbol ; do
echo ".def _$symbol; .scl 2; .type 32; .endef;"
done
fi
rm tmp-symbol-list.txt
|