2 . `dirname $0`/functions.sh
3 # First check if __thread is supported by ld.so/gcc/ld/as:
5 echo '__thread int a; int main (void) { return a; }' \
6 | $CC -xc - -o tlstest > /dev/null 2>&1 || exit 77
7 ( ./tlstest || { rm -f tlstest; exit 77; } ) 2>/dev/null || exit 77
8 rm -f tls6 tls6lib*.so tls6.log
10 echo 'int tls6;' | $CC -shared -O2 -fpic -xc - -o tls6lib3.so
11 $CC -shared -O2 -fpic -o tls6lib1.so $srcdir/tls6lib1.c tls6lib3.so
12 $CC -shared -O2 -fpic -o tls6lib2.so $srcdir/tls1lib2.c \
13 -Wl,--rpath-link,. tls6lib1.so
15 LIBS="tls6lib1.so tls6lib2.so tls6lib3.so"
16 $CCLINK -o tls6 $srcdir/tls2.c -Wl,--rpath-link,. tls6lib2.so
18 echo $PRELINK ${PRELINK_OPTS--vm} ./tls6 > tls6.log
19 $PRELINK ${PRELINK_OPTS--vm} ./tls6 >> tls6.log 2>&1 || exit 1
20 grep -v 'has undefined non-weak symbols' tls6.log \
21 | grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` && exit 2
22 LD_LIBRARY_PATH=. ./tls6 || exit 3
23 $PRELINK -u tls6lib3.so || exit 4
24 echo $PRELINK ${PRELINK_OPTS--vm} ./tls6 >> tls6.log
25 $PRELINK ${PRELINK_OPTS--vm} ./tls6 >> tls6.log 2>&1 || exit 5
26 grep -v 'has undefined non-weak symbols' tls6.log \
27 | grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` && exit 6
28 LD_LIBRARY_PATH=. ./tls6 || exit 7
29 readelf -a ./tls6 >> tls6.log 2>&1 || exit 8
30 # So that it is not prelinked again
32 comparelibs >> tls6.log 2>&1 || exit 9