-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-symbol-version-tests.sh
57 lines (48 loc) · 1.77 KB
/
run-symbol-version-tests.sh
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
#!/bin/sh
set -e
if [ `uname` = "SunOS" ]; then
READELF=elfdump
else
READELF=readelf
fi
echo
echo "=============================================================="
echo "Demonstration of using ELF symbol versioning to select symbols"
echo "From libOpenGL.so.1 vs libGLESv2.so.1."
echo ""
echo "The functions gl{Foo,Bar,Baz}() are implemented in each of"
echo "libOpenGL.so.1 and libGLESv2.so.1. The implementations simply"
echo "print out the function name, prepended with either \"OpenGL\""
echo "or \"GLESv2\"."
echo "=============================================================="
echo
echo "The symbol 'glFoo' in libOpenGL.so.1 has a version stamp:"
echo "\`${READELF} -s libOpenGL.so.1 | grep glFoo\`:"
${READELF} -s libOpenGL.so.1 | grep glFoo
echo
echo "The symbol 'glFoo' in libGLESv2.so.1 has a version stamp:"
echo "\`${READELF} -s libGLESv2.so.1 | grep glFoo\`:"
${READELF} -s libGLESv2.so.1 | grep glFoo
echo
echo "The undefined references to 'glFoo' are versioned:"
echo "\`${READELF} -s test-opengl | grep glFoo\`:"
${READELF} -s test-opengl | grep glFoo
echo "\`${READELF} -s test-glesv2 | grep glFoo\`:"
${READELF} -s test-glesv2 | grep glFoo
echo "\`${READELF} -s libtest-opengl.so.1 | grep glFoo\`:"
${READELF} -s libtest-opengl.so.1 | grep glFoo
echo "\`${READELF} -s libtest-glesv2.so.1 | grep glFoo\`:"
${READELF} -s libtest-glesv2.so.1 | grep glFoo
echo
echo "Testing an application that links against libOpenGL.so.1:"
echo "\`LD_LIBRARY_PATH=. ./test-opengl\`:"
LD_LIBRARY_PATH=. ./test-opengl
echo
echo "Testing an application that links against libGLESv2.so.1:"
echo "\`LD_LIBRARY_PATH=. ./test-glesv2\`:"
LD_LIBRARY_PATH=. ./test-glesv2
echo
echo "Testing an application that links against both:"
echo "\`LD_LIBRARY_PATH=. ./test-both\`:"
LD_LIBRARY_PATH=. ./test-both
echo