Look at the end of http://cboard.cprogramming.com/showthread.php?t=101632 for the origin of this question.
Well, on old programs, one often meets
symbol errno, version GLIBC_2.0 not defined in file libc.so.6 with link time reference
error, so I made a little library with
and preload this library with LD_PRELOAD. This library defines the errno function and allows me to use olds programs like Maple 5 or 7 on recent linux (Debian Etch for instance).Code:extern int (* __errno_location); int errno() { return(*__errno_location); }
This work well with libc6 on debian etch (libc <= 2.3)
But since libc 2.7 there is errors at compilation. if I try to change the code in
good compilation using gcc -O2 -c -o lib-errno.o lib-errno.c butCode:extern int *__errno_location (void) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); int errno () { return((*__errno_location ())); }
giveCode:$ gcc -shared -Wl,-soname,lib-errno -o lib-errno.so lib-errno.o
errno: TLS definition in /lib/libc.so.6 section .tbss mismatches non-TLS definition in lib-errno.o section .tex
How can I make a little shared library define the errno function and so allows me to run olds programs?