This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


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

[PATCH v2] Suppress incorrect link warnings for NSS symbols


2012-10-29  Chris Metcalf  <cmetcalf@tilera.com>

	* nss/nsswitch.h (nss_interface_function): Provide new
	macro for use with NSS functions.
	* grp/initgroups.c: use new macro.
	* nss/getXXbyYY.c: Likewise.
	* nss/getXXbyYY_r.c: Likewise.
	* nss/getXXent.c: Likewise.
	* nss/getXXent_r.c: Likewise.
	* sysdeps/posix/getaddrinfo.c: Likewise.

When glibc is built with --enable-static-nss, the warning that
using NSS symbols requires the nss shared objects to be present
is no longer true, as those symbols are built into libc.  Suppress
the warning for those symbols by providing a new macro
(nss_interface_function) for the NSS functions that is defined as
static_link_warning in the normal case, and empty for static NSS.
---
 grp/initgroups.c            |    4 ++--
 nss/getXXbyYY.c             |    2 +-
 nss/getXXbyYY_r.c           |    2 +-
 nss/getXXent.c              |    2 +-
 nss/getXXent_r.c            |    6 +++---
 nss/nsswitch.h              |    8 ++++++++
 sysdeps/posix/getaddrinfo.c |    2 +-
 8 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/grp/initgroups.c b/grp/initgroups.c
index 62fd1fc..fad30a7 100644
--- a/grp/initgroups.c
+++ b/grp/initgroups.c
@@ -180,7 +180,7 @@ getgrouplist (const char *user, gid_t group, gid_t *groups, int *ngroups)
   return retval;
 }
 
-static_link_warning (getgrouplist)
+nss_interface_function (getgrouplist)
 
 /* Initialize the group set for the current user
    by reading the group database and using all groups
@@ -230,4 +230,4 @@ initgroups (const char *user, gid_t group)
 #endif
 }
 
-static_link_warning (initgroups)
+nss_interface_function (initgroups)
diff --git a/nss/getXXbyYY.c b/nss/getXXbyYY.c
index 336676a..c308a70 100644
--- a/nss/getXXbyYY.c
+++ b/nss/getXXbyYY.c
@@ -151,4 +151,4 @@ done:
   return result;
 }
 
-static_link_warning (FUNCTION_NAME)
+nss_interface_function (FUNCTION_NAME)
diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c
index f296ed1..8b3b61b 100644
--- a/nss/getXXbyYY_r.c
+++ b/nss/getXXbyYY_r.c
@@ -349,4 +349,4 @@ do_default_symbol_version (NEW (REENTRANT_NAME),
 			   REENTRANT_NAME, GLIBC_2_1_2);
 #endif
 
-static_link_warning (REENTRANT_NAME)
+nss_interface_function (REENTRANT_NAME)
diff --git a/nss/getXXent.c b/nss/getXXent.c
index 008851e..152798f 100644
--- a/nss/getXXent.c
+++ b/nss/getXXent.c
@@ -91,4 +91,4 @@ GETFUNC_NAME (void)
   return result;
 }
 
-static_link_warning (GETFUNC_NAME)
+nss_interface_function (GETFUNC_NAME)
diff --git a/nss/getXXent_r.c b/nss/getXXent_r.c
index f103605..6c52d27 100644
--- a/nss/getXXent_r.c
+++ b/nss/getXXent_r.c
@@ -207,6 +207,6 @@ do_default_symbol_version (NEW (REENTRANT_GETNAME),
 			   REENTRANT_GETNAME, GLIBC_2_1_2);
 #endif
 
-static_link_warning (SETFUNC_NAME)
-static_link_warning (ENDFUNC_NAME)
-static_link_warning (REENTRANT_GETNAME)
+nss_interface_function (SETFUNC_NAME)
+nss_interface_function (ENDFUNC_NAME)
+nss_interface_function (REENTRANT_GETNAME)
diff --git a/nss/nsswitch.h b/nss/nsswitch.h
index 047a9e5..b36fa37 100644
--- a/nss/nsswitch.h
+++ b/nss/nsswitch.h
@@ -107,6 +107,14 @@ enum
 /* Flags whether custom rules for database is set.  */
 extern bool __nss_database_custom[NSS_DBSIDX_max];
 
+/* Warning for NSS functions, which don't require dlopen if glibc
+   was built with --enable-static-nss.  */
+#ifdef DO_STATIC_NSS
+#define nss_interface_function(name)
+#else
+#define nss_interface_function(name) static_link_warning(name)
+#endif
+
 
 /* Interface functions for NSS.  */
 
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 672571e..3cc244b 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -2672,7 +2672,7 @@ getaddrinfo (const char *name, const char *service,
 }
 libc_hidden_def (getaddrinfo)
 
-static_link_warning (getaddrinfo)
+nss_interface_function (getaddrinfo)
 
 void
 freeaddrinfo (struct addrinfo *ai)
-- 
1.7.10.3


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