Aliases ...

Andreas Jaeger aj@suse.de
Fri Jan 14 08:54:00 GMT 2005


Richard Henderson <rth@redhat.com> writes:

> On Sun, Jan 09, 2005 at 10:00:25PM +0100, Andreas Jaeger wrote:
>> One testcase is: 
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
>> int errno; 
>> extern  int __libc_errno __attribute__ ((alias ("errno"))); 
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ...
>> So, what shall we do with glibc?
>
> For this case, either initialize the variable, or use -fno-common.

Here's a patch to initialize it - it removes the warning.

Ok to commit?

Andreas

2005-01-14  Andreas Jaeger  <aj@suse.de>

	* sysdeps/generic/errno.c: Initialize errno.

============================================================
Index: sysdeps/generic/errno.c
--- sysdeps/generic/errno.c	4 Oct 2004 20:59:41 -0000	1.7
+++ sysdeps/generic/errno.c	14 Jan 2005 08:52:47 -0000
@@ -1,5 +1,5 @@
 /* Definition of `errno' variable.  Canonical version.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -29,7 +29,9 @@ int rtld_errno attribute_hidden;
 
 #elif USE___THREAD
 
-__thread int errno;
+/* We have to initialize errno, since aliasing of a common symbol does
+   not work.  */
+__thread int errno = 0;
 extern __thread int __libc_errno __attribute__ ((alias ("errno")))
   attribute_hidden;
 

-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SUSE Linux Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-hacker/attachments/20050114/90059d7f/attachment.sig>


More information about the Libc-hacker mailing list