about summary refs log tree commit diff
path: root/sysdeps/generic
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic')
-rw-r--r--sysdeps/generic/dl-sysdep.c25
-rw-r--r--sysdeps/generic/glob.c4
-rw-r--r--sysdeps/generic/ldsodefs.h10
-rw-r--r--sysdeps/generic/nfs/nfs.h32
4 files changed, 60 insertions, 11 deletions
diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c
index 6ac0d95ea6..985e2b8f77 100644
--- a/sysdeps/generic/dl-sysdep.c
+++ b/sysdeps/generic/dl-sysdep.c
@@ -393,7 +393,7 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
 		    cnt += *p++;
 		    ++p;	/* Skip mask word.  */
 		    dsocaps = (const char *) p;
-		    dsocapslen = note->datalen - sizeof *p;
+		    dsocapslen = note->datalen - sizeof *p * 2;
 		    break;
 		  }
 		note = ((const void *) (note + 1)
@@ -431,14 +431,23 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
 #if defined NEED_DL_SYSINFO || defined NEED_DL_SYSINFO_DSO
   if (dsocaps != NULL)
     {
-      GLRO(dl_hwcap) |= ((uint64_t) ((const ElfW(Word) *) dsocaps)[-1]
-			 << _DL_FIRST_EXTRA);
-      for (const char *p = dsocaps;
-	   p < dsocaps + dsocapslen;
-	   p += temp[m++].len + 1)
+      const ElfW(Word) mask = ((const ElfW(Word) *) dsocaps)[-1];
+      GLRO(dl_hwcap) |= (uint64_t) mask << _DL_FIRST_EXTRA;
+      size_t len;
+      for (const char *p = dsocaps; p < dsocaps + dsocapslen; p += len + 1)
 	{
-	  temp[m].str = p;
-	  temp[m].len = strlen (p);
+	  uint_fast8_t bit = *p++;
+	  len = strlen (p);
+
+	  /* Skip entries that are not enabled in the mask word.  */
+	  if (__builtin_expect (mask & ((ElfW(Word)) 1 << bit), 1))
+	    {
+	      temp[m].str = p;
+	      temp[m].len = len;
+	      ++m;
+	    }
+	  else
+	    --cnt;
 	}
     }
 #endif
diff --git a/sysdeps/generic/glob.c b/sysdeps/generic/glob.c
index c0e76b377e..2e767304a7 100644
--- a/sysdeps/generic/glob.c
+++ b/sysdeps/generic/glob.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2002,2003,2004,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -715,7 +715,7 @@ glob (pattern, flags, errfunc, pglob)
 		buflen = 20;
 	      name = (char *) __alloca (buflen);
 
-	      success = getlogin_r (name, buflen) >= 0;
+	      success = getlogin_r (name, buflen) == 0;
 #   else
 	      success = (name = getlogin ()) != NULL;
 #   endif
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index a24c2ff58e..191ae4d4fb 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -62,7 +62,7 @@ typedef struct link_map *lookup_t;
 # define LOOKUP_VALUE(map) map
 # define LOOKUP_VALUE_ADDRESS(map) ((map) ? (map)->l_addr : 0)
 
-/* on some architectures a pointer to a function is not just a pointer
+/* On some architectures a pointer to a function is not just a pointer
    to the actual code of the function but rather an architecture
    specific descriptor. */
 #ifndef ELF_FUNCTION_PTR_IS_SPECIAL
@@ -73,6 +73,14 @@ typedef struct link_map *lookup_t;
 # define DL_DT_FINI_ADDRESS(map, start) (start)
 #endif
 
+/* On some architectures dladdr can't use st_size of all symbols this way.  */
+#define DL_ADDR_SYM_MATCH(L, SYM, MATCHSYM, ADDR) \
+  ((ADDR) >= (L)->l_addr + (SYM)->st_value				\
+   && (((SYM)->st_size == 0						\
+	&& (ADDR) == (L)->l_addr + (SYM)->st_value)			\
+       || (ADDR) < (L)->l_addr + (SYM)->st_value + (SYM)->st_size)	\
+   && ((MATCHSYM) == NULL || (MATCHSYM)->st_value < (SYM)->st_value))
+
 /* Unmap a loaded object, called by _dl_close (). */
 #ifndef DL_UNMAP_IS_SPECIAL
 # define DL_UNMAP(map) \
diff --git a/sysdeps/generic/nfs/nfs.h b/sysdeps/generic/nfs/nfs.h
new file mode 100644
index 0000000000..e83a874fe6
--- /dev/null
+++ b/sysdeps/generic/nfs/nfs.h
@@ -0,0 +1,32 @@
+/* <nfs/nfs.h> -- ill-specified NFS-related definitions
+   Copyright (C) 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _NFS_NFS_H
+#define _NFS_NFS_H 1
+
+/* This file is empty for now.  Its contents do not seem to be
+   standardized in any way.  It exists solely for the sake of
+   <rpcsvc/bootparam_prot.h> which insists on including <nfs/nfs.h>.
+
+   For the time being, we just provide this file here to smooth building
+   the libc distribution (i.e. librpcsvc).  We do not install this file for
+   users, since we haven't really figured out what the right thing to go
+   here is.  */
+
+#endif /* nfs/nfs.h */