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] Suppress incorrect link warnings for NSS symbols


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

	* include/libc-symbols.h (dlopen_static_link_warning): Provide new
	macro for use with dlopen and dlmopen.
	* include/libc-symbols.h (static_link_warning): [DO_STATIC_NSS]:
	Define macro as empty.
	* dlfcn/dlopen.c (dlopen): Use new dlopen_static_link_warning macro.
	* dlfcn/dlmopen.c (dlmopen): 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, but keep it for dlopen/dlmopen, by
providing an alternate macro explicitly for those symbols.
---
 dlfcn/dlmopen.c        |    2 +-
 dlfcn/dlopen.c         |    2 +-
 include/libc-symbols.h |   14 +++++++++++---
 4 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/dlfcn/dlmopen.c b/dlfcn/dlmopen.c
index a411cd8..add6576 100644
--- a/dlfcn/dlmopen.c
+++ b/dlfcn/dlmopen.c
@@ -30,7 +30,7 @@ dlmopen (Lmid_t nsid, const char *file, int mode)
 {
   return __dlmopen (nsid, file, mode, RETURN_ADDRESS (0));
 }
-static_link_warning (dlmopen)
+dlopen_static_link_warning (dlmopen)
 
 #else
 
diff --git a/dlfcn/dlopen.c b/dlfcn/dlopen.c
index 4b55177..ce029b1 100644
--- a/dlfcn/dlopen.c
+++ b/dlfcn/dlopen.c
@@ -29,7 +29,7 @@ dlopen (const char *file, int mode)
 {
   return __dlopen (file, mode, RETURN_ADDRESS (0));
 }
-static_link_warning (dlopen)
+dlopen_static_link_warning (dlopen)
 
 #else
 
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index a626d59..9d9d245 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -233,15 +233,23 @@
 
 /* Warning for linking functions calling dlopen into static binaries.  */
 #ifdef SHARED
-#define static_link_warning(name)
+#define dlopen_static_link_warning(name)
 #else
-#define static_link_warning(name) static_link_warning1(name)
-#define static_link_warning1(name) \
+#define dlopen_static_link_warning(name) dlopen_static_link_warning1(name)
+#define dlopen_static_link_warning1(name) \
   link_warning(name, "Using '" #name "' in statically linked applications \
 requires at runtime the shared libraries from the glibc version used \
 for linking")
 #endif
 
+/* Warning for NSS functions, which don't require dlopen if glibc
+   was built with --enable-static-nss.  */
+#ifdef DO_STATIC_NSS
+#define static_link_warning(name)
+#else
+#define static_link_warning(name) dlopen_static_link_warning(name)
+#endif
+
 /* Declare SYMBOL to be TYPE (`function' or `object') of SIZE bytes
    alias to ORIGINAL, when the assembler supports such declarations
    (such as in ELF).
-- 
1.7.10.3


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