This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Aliases ...


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

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]