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
Code:
extern int (* __errno_location);
int errno()
{
  return(*__errno_location);
    }
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).
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
Code:
extern int *__errno_location (void) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
int errno ()
{
  return((*__errno_location ()));
    }
good compilation using gcc -O2 -c -o lib-errno.o lib-errno.c but
Code:
$ gcc -shared -Wl,-soname,lib-errno -o lib-errno.so lib-errno.o
give
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?