[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [patches] NSSWITCH build failure.
- To: Steve Papacharalambous <stevep@xxxxxxxxxxxxx>
- Subject: Re: [patches] NSSWITCH build failure.
- From: Jim Blandy <jimb@xxxxxxxxxxxxxxxx>
- Date: Mon, 29 Oct 2007 14:29:24 -0700
Steve Papacharalambous <stevep at freescale.com> writes:
> When the NSSWITCH option group is disabled eglibc fails to build. I am
> using eglibc svn version r3767, and the contents of the
> option-groups.config file is:
Hi, Steve. I've committed the following, which I believe should
address the build failures you encountered with
OPTION_EGLIBC_NSSWITCH. Let me know how it goes.
ChangeLog.eglibc:
2007-10-29 Jim Blandy <jimb@xxxxxxxxxxxxxxxx>
* nss/gen-fixed-nsswitch.c: Don't #include "nsswitch.h". Instead,
make our own copies of the datatype and enum definitions. Do
#include "nss.h".
(lookup_actions, service_library, known_function, service_user)
(name_database_entry, name_database): Copy definitions from
nsswitch.c.
* grp/Makefile (LDLIBS-testgrp): Link against the libraries listed
in nss/fixed-nsswitch-libs when OPTION_EGLIBC_NSSWITCH is
disabled.
* posix/Makefile (LDLIBS-globtest): Same.
* option-groups.def (OPTION_EGLIBC_NSSWITCH): Doc fix.
Index: nss/gen-fixed-nsswitch.c
===================================================================
--- nss/gen-fixed-nsswitch.c (revision 4012)
+++ nss/gen-fixed-nsswitch.c (revision 4013)
@@ -27,10 +27,8 @@
#include <assert.h>
#include <ctype.h>
-#define libc_hidden_proto(func)
-
-#include "nsswitch.h"
#include "gnu/lib-names.h"
+#include "nss.h"
/* Simple utilities. */
@@ -82,6 +80,95 @@
+/* Data structures representing the configuration file in memory. */
+
+/* These are copied from nsswitch.h.
+
+ We could simply #include that file, but this program runs on the
+ build machine and links against the build machine's libraries,
+ whereas that header is meant for use by target code; it uses
+ 'libc_hidden_proto', 'internal_function', and related hair. Since
+ we've copied the parsing code, we might as well copy the data
+ structure definitions as well. */
+
+/* Actions performed after lookup finished. */
+typedef enum
+{
+ NSS_ACTION_CONTINUE,
+ NSS_ACTION_RETURN
+} lookup_actions;
+
+
+typedef struct service_library
+{
+ /* Name of service (`files', `dns', `nis', ...). */
+ const char *name;
+ /* Pointer to the loaded shared library. */
+ void *lib_handle;
+ /* And the link to the next entry. */
+ struct service_library *next;
+} service_library;
+
+
+/* For mapping a function name to a function pointer. It is known in
+ nsswitch.c:nss_lookup_function that a string pointer for the lookup key
+ is the first member. */
+typedef struct
+{
+ const char *fct_name;
+ void *fct_ptr;
+} known_function;
+
+
+typedef struct service_user
+{
+ /* And the link to the next entry. */
+ struct service_user *next;
+ /* Action according to result. */
+ lookup_actions actions[5];
+ /* Link to the underlying library object. */
+ service_library *library;
+ /* Collection of known functions.
+
+ With OPTION_EGLIBC_NSSWITCH enabled, this is the root of a
+ 'tsearch'-style tree.
+
+ With OPTION_EGLIBC_NSSWITCH disabled, this is an array of
+ pointers to known_function structures, NULL-terminated. */
+ union
+ {
+ void *tree;
+ const known_function **array;
+ } known;
+ /* Name of the service (`files', `dns', `nis', ...). */
+ const char *name;
+} service_user;
+
+/* To access the action based on the status value use this macro. */
+#define nss_next_action(ni, status) ((ni)->actions[2 + status])
+
+
+typedef struct name_database_entry
+{
+ /* And the link to the next entry. */
+ struct name_database_entry *next;
+ /* List of service to be used. */
+ service_user *service;
+ /* Name of the database. */
+ const char *name;
+} name_database_entry;
+
+
+typedef struct name_database
+{
+ /* List of all known databases. */
+ name_database_entry *entry;
+ /* List of libraries with service implementation. */
+ service_library *library;
+} name_database;
+
+
+
/* Gathering the contents of the FIXED_FUNCTIONS file. */
/* It should be possible to generate this list automatically by
@@ -659,7 +746,7 @@
{
if (printed_any)
putc (' ', out);
- fprintf (out, "libnss_%s.so%s",
+ fprintf (out, "-lnss_%s",
functions[i].service,
nss_shlib_revision);
printed_any = 1;
Index: grp/Makefile
===================================================================
--- grp/Makefile (revision 4012)
+++ grp/Makefile (revision 4013)
@@ -33,6 +33,9 @@
include ../Makeconfig
tests := testgrp
+ifneq (y,$(OPTION_EGLIBC_NSSWITCH))
+LDLIBS-testgrp += $(shell cat $(common-objpfx)nss/fixed-nsswitch-libs)
+endif
ifeq (yes,$(build-shared))
test-srcs := tst_fgetgrent
Index: option-groups.def
===================================================================
--- option-groups.def (revision 4012)
+++ option-groups.def (revision 4013)
@@ -507,10 +507,9 @@
Note that some nsswitch service libraries require other option
groups to be enabled; for example, the OPTION_EGLIBC_INET
- option group must be enabled to use the 'libnss_dns.so.2' or
- 'libnss_nis.so.2' service libraries, which use the Domain Name
- System and Network Information Service network protocols to
- answer queries.
+ option group must be enabled to use the 'libnss_dns.so.2'
+ service library, which uses the Domain Name System network
+ protocol to answer queries.
config OPTION_EGLIBC_RCMD
bool "Support for 'rcmd' and related library functions"
Index: posix/Makefile
===================================================================
--- posix/Makefile (revision 4012)
+++ posix/Makefile (revision 4013)
@@ -144,6 +144,7 @@
$(objpfx)globtest.out: globtest.sh $(objpfx)globtest
$(SHELL) -e globtest.sh $(common-objpfx) $(elf-objpfx) \
$(rtld-installed-name) '$(cross-test-wrapper)'
+LDLIBS-globtest += $(shell cat $(common-objpfx)nss/fixed-nsswitch-libs)
ifeq (y,$(OPTION_EGLIBC_WORDEXP))
tests: $(objpfx)wordexp-tst.out
$(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test