LT.old: Make errno_location thread safe

[summary: Get rid of libc alias __GI___errno_location]

It seems with Linuxthreads.old (yet to confirm NPTL) errno is not thread
safe.

A simple pthread linked test program (at the bottom) which makes a
failing syscall e.g. open("/not-exist") fails to observe the right errno
in the thread (main is OK)

Conceptually uClibc defines weak __errno_location() while libpthread
defines astrong variant. This arrangement shd work when using -pthread
links. The spoil sport is __GI___errno_location, intended to bypass PLT
for intra-libc callers. It gets called even in case of LT.old links
given the syscall wrappers in  libpthread (LT.old). e.g.

open [ in libpthread ]
  pthreadsetcanceltype()
   __libc_open()
      __GI__open()
           ...
-           __GI___errno_location    [ existing ]
+           __errno_location         [ intended ]
   ....
  pthreadsetcanceltype()

So the solution is to get rid of GI alias for errno_location
altogether.

I tested this on master for ARC as well as an ARMv7 buildroot LT.old
build (daily snapshot of uClibc) and fix works on both.

-------- before ------->8----------

[Main thread] Initial errno = 99
errno @b6f6c338 = 2 (OK)

[Child Thread] Initial errno = 0
errno @be1ffee8 = 0 (BROKEN)
Errno in main after child 4

------- after ----->8------------------

[Main thread] Initial errno = 99
errno @b6f9a338 = 2 (OK)

[Child Thread] Initial errno = 0
errno @be1ffee8 = 2 (OK)
Errno in main after child 4

============Test case ===================
/* $CROSS-gcc -o errno-arc -lpthread */

void *th(void *str)
{
	int fd;
	printf("\n[%s] Initial errno = %d\n", (char *)str, errno);

	fd = open("/nothing", O_RDONLY);
	if (fd >= 0) {
		close(fd);
		//printf("success\n");
	} else
		printf("errno @%x = %d (%s)\n", &errno, errno, errno ?  "OK" : "BROKEN");

	errno = 66;

	return NULL;
}

int main(void)
{
	pthread_t t;
	void *r;
	int err;

	errno = 99;
	th("Main thread");

	err = pthread_create(&t, NULL, th, "Child Thread");
	if (err) {
		fprintf(stderr, "could not spawn thread: %s\n", strerror(err));
		return 1;
	}
	pthread_join(t, &r);

	printf("Errno in main after child %d\n", errno);
	return 0;
}

Cc: Christian Ruppert <christian.ruppert@abilis.com>
CC: Francois Bedard <Francois.Bedard@synopsys.com>
Cc: Joern Rennecke  <joern.rennecke@embecosm.com>
Cc: Jeremy Bennett <jeremy.bennett@embecosm.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
ARC: Make vfork weak in libc

Anton reported:

------------------->8---------------------
Package iperf cannot be built in Buildroot due to following error:

/home/akolesov/env/autobuild/tmp/host/usr/bin/arc-buildroot-linux-uclibc-g++
-Wall -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-pipe -Os    --static -o iperf -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64  -pipe -Os   -pthread  -DHAVE_CONFIG_H Client.o
Extractor.o Launch.o List.o Listener.o Locale.o PerfSocket.o ReportCSV.o
ReportDefault.o Reporter.o Server.o Settings.o SocketAddr.o gnu_getopt.o
gnu_getopt_long.o main.o service.o sockets.o stdio.o tcp_window_size.o
../compat/libcompat.a
/home/akolesov/env/autobuild/tmp/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/lib/libc.a(vfork.os):
In function `vfork':
(.text+0x0): multiple definition of `vfork'
/home/akolesov/env/autobuild/tmp/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/lib/libpthread.a(ptfork.os):ptfork.c:(.text+0xc0):
first defined here
collect2: error: ld returned 1 exit status
------------------->8---------------------

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Anton Kolesov <Anton.Kolesov@synopsys.com>
Cc: Francois Bedard <Francois.Bedard@synopsys.com>