This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
inet/getnetgrent_r.c relies on assumption broken by gcc CVS mainline
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: 09 Jul 2004 02:52:29 -0300
- Subject: inet/getnetgrent_r.c relies on assumption broken by gcc CVS mainline
- Organization: Red Hat Global Engineering Services Compiler Team
GCC's alias attribute wants an assembler symbol name as the target, as
evidenced by the need for supplying a mangled name when aliasing to
C++ symbols. However, for a symbol with internal linkage, such as a
static symbol, the compiler can choose whatever name it likes. In
fact, when you compile multiple source files with the -combine option,
GCC absolutely *must* rename static symbols that happen to have the
same name in different translation units.
I suggest that glibc stops relying on this assumption, otherwise it
probably won't build with the next major release of GCC. It currently
fails for the file that the patch below fixes. Ok to install?
Index: ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* inet/getnetgrent_r.c (internal_setnetgrent): Make it hidden
instead of internal-linkage, such that we can alias to it.
(internal_endnetgrent, internal_getnetgrent_r): Likewise.
Index: inet/getnetgrent_r.c
===================================================================
RCS file: /cvs/glibc/libc/inet/getnetgrent_r.c,v
retrieving revision 1.24
diff -u -p -r1.24 getnetgrent_r.c
--- inet/getnetgrent_r.c 10 Nov 2002 11:06:35 -0000 1.24
+++ inet/getnetgrent_r.c 9 Jul 2004 05:42:46 -0000
@@ -133,7 +133,10 @@ __internal_setnetgrent_reuse (const char
return status == NSS_STATUS_SUCCESS;
}
-static int
+int internal_setnetgrent (const char *group, struct __netgrent *datap);
+libc_hidden_proto (internal_setnetgrent)
+
+int
internal_setnetgrent (const char *group, struct __netgrent *datap)
{
/* Free list of all netgroup names from last run. */
@@ -141,6 +144,7 @@ internal_setnetgrent (const char *group,
return __internal_setnetgrent_reuse (group, datap, &errno);
}
+libc_hidden_def (internal_setnetgrent)
strong_alias (internal_setnetgrent, __internal_setnetgrent)
int
@@ -158,7 +162,10 @@ setnetgrent (const char *group)
}
-static void
+static void internal_endnetgrent (struct __netgrent *datap);
+libc_hidden_proto (internal_endnetgrent)
+
+void
internal_endnetgrent (struct __netgrent *datap)
{
service_user *old_nip;
@@ -186,6 +193,7 @@ internal_endnetgrent (struct __netgrent
/* Now free list of all netgroup names from last run. */
free_memory (datap);
}
+libc_hidden_def (internal_endnetgrent)
strong_alias (internal_endnetgrent, __internal_endnetgrent)
@@ -200,7 +208,12 @@ endnetgrent (void)
}
-static int
+int internal_getnetgrent_r (char **hostp, char **userp, char **domainp,
+ struct __netgrent *datap,
+ char *buffer, size_t buflen, int *errnop);
+libc_hidden_proto (internal_getnetgrent_r)
+
+int
internal_getnetgrent_r (char **hostp, char **userp, char **domainp,
struct __netgrent *datap,
char *buffer, size_t buflen, int *errnop)
@@ -286,6 +299,7 @@ internal_getnetgrent_r (char **hostp, ch
return status == NSS_STATUS_SUCCESS ? 1 : 0;
}
+libc_hidden_def (internal_getnetgrent_r)
strong_alias (internal_getnetgrent_r, __internal_getnetgrent_r)
/* The real entry point. */
--
Alexandre Oliva http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}