summaryrefslogtreecommitdiff
path: root/src/generate-gl-glue.sh
blob: b5ba95175bac992bc12da76e7136d69c09a8e9ed (plain)
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
#!/bin/sh

base="/Users/pixel/sources/Mesa-7.2/include/GL"

files="gl.h glu.h"

os=`uname`

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

echo ".text"

if [ "$os" == "Darwin" ] ; then
cat tmp-symbol-list.txt | while read symbol ; do
    echo ".globl _m$symbol"
    echo "_m$symbol:"
    echo "jmp L_$symbol\$stub"
done

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"

else 

cat tmp-symbol-list.txt | while read symbol ; do
    echo ".globl m$symbol"
    echo ".type m$symbol, @function"
    echo "jmp $symbol"
    echo ".size m$symbol, .-m$symbol"
done

fi

rm tmp-symbol-list.txt