Breaking errno

Some deluded Linux programs believe that

extern int errno;
is the correct way of referencing errno. Such things used to compile with GLIBC 2.2, but will fail to load with GLIBC 2.3.

In order to get them to load, one can try:

$ cat errno.c
int errno=0;
$ cc -c errno.c
$ cat errno.vers
GLIBC_2.0 {
$ ld -shared --version-script errno.vers -o errno.o
$ LD_PRELOAD=./ ./mad_prog

If you do not understand why the above is very silly and dangerous, do not do it. The author accepts no responsibility for any misfortune which might (and should) befall the users of this trick. If one has access to the source, one should correct the problem properly.