static binaries and NSS

Thorsten Kukuk kukuk@suse.de
Mon Jun 16 15:15:00 GMT 2003


On Thu, Jun 12, Ulrich Drepper wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Thorsten Kukuk wrote:
> 
> > +link_warning (getgrouplist, "the `getgrouplist' function should not be used in static binaries.")
> 
> "should not be used" probably isn't the right wording, especially if the
> loading issue is resolved with Jakub's patch or something similar.  It
> might be fine, given the situation.  The actual problem should be
> described.  I probably settle for
> 
> using 'foo' in statically linked applications requires at runtime the
> NSS modules from the glibc version used for linking
> 
> 
> or something like that.  It's long but I don't think this should be a
> problem.  This is the time where native English speakers could shine.

There is now a new patch, where libc-symbols.h contains the macro
with a modified text.

  Thorsten

-- 
Thorsten Kukuk       http://www.suse.de/~kukuk/        kukuk@suse.de
SuSE Linux AG        Deutschherrnstr. 15-19        D-90429 Nuernberg
--------------------------------------------------------------------    
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B
-------------- next part --------------
2003-06-16  Thorsten Kukuk  <kukuk@suse.de>

	* include/libc-symbols.h: Add static_link_warning macro.
	* grp/initgroups.c: Print linker warning if this function   
	is called in a static linked binary.
	* nss/getXXbyYY.c: Likewise.
	* nss/getXXbyYY_r.c: Likewise.
	* nss/getXXent.c: Likewise.
	* nss/getXXent_r.c: Likewise.
	* sysdeps/posix/getaddrinfo.c: Likewise.

--- grp/initgroups.c
+++ grp/initgroups.c	2003/06/16 10:23:05
@@ -223,6 +223,8 @@
   return result;
 }
 
+static_link_warning (getgrouplist)
+
 /* Initialize the group set for the current user
    by reading the group database and using all groups
    of which USER is a member.  Also include GROUP.  */
@@ -271,3 +273,5 @@
   return result;
 #endif
 }
+
+static_link_warning (initgroups)
--- include/libc-symbols.h
+++ include/libc-symbols.h	2003/06/16 12:14:51
@@ -282,6 +282,16 @@
   link_warning (name, \
 		"warning: " #name " is not implemented and will always fail")
 
+/* Warning for linking functions calling dlopen into static binaries.  */
+#ifdef SHARED
+#define static_link_warning(name)
+#else
+#define static_link_warning(name) static_link_warning1(name)
+#define 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
 
 /* Declare SYMBOL to be TYPE (`function' or `object') and of SIZE bytes,
    when the assembler supports such declarations (such as in ELF).
--- nss/getXXbyYY.c
+++ nss/getXXbyYY.c	2003/06/16 10:23:05
@@ -162,3 +162,5 @@
 
   return result;
 }
+
+static_link_warning (FUNCTION_NAME)
--- nss/getXXbyYY_r.c
+++ nss/getXXbyYY_r.c	2003/06/16 10:23:05
@@ -289,3 +289,5 @@
   versioned_symbol (libc, real, name, version)
 do_default_symbol_version (NEW (REENTRANT_NAME),
 			   REENTRANT_NAME, GLIBC_2_1_2);
+
+static_link_warning (REENTRANT_NAME)
--- nss/getXXent.c
+++ nss/getXXent.c	2003/06/16 10:23:05
@@ -91,3 +91,5 @@
   __set_errno (save);
   return result;
 }
+
+static_link_warning (GETFUNC_NAME)
--- nss/getXXent_r.c
+++ nss/getXXent_r.c	2003/06/16 10:23:05
@@ -201,3 +201,7 @@
   versioned_symbol (libc, real, name, version)
 do_default_symbol_version (NEW (REENTRANT_GETNAME),
 			   REENTRANT_GETNAME, GLIBC_2_1_2);
+
+static_link_warning (SETFUNC_NAME)
+static_link_warning (ENDFUNC_NAME)
+static_link_warning (REENTRANT_GETNAME)
--- sysdeps/posix/getaddrinfo.c
+++ sysdeps/posix/getaddrinfo.c	2003/06/16 10:23:05
@@ -1024,6 +1024,8 @@
 }
 libc_hidden_def (getaddrinfo)
 
+static_link_warning (getaddrinfo)
+
 void
 freeaddrinfo (struct addrinfo *ai)
 {


More information about the Libc-alpha mailing list