Update.
authorUlrich Drepper <drepper@redhat.com>
Sat, 21 Oct 2000 00:02:39 +0000 (00:02 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sat, 21 Oct 2000 00:02:39 +0000 (00:02 +0000)
2000-10-19  H.J. Lu  <hjl@gnu.org>

* elf/Makefile (distribute): Add neededtest.c, neededobj1.c,
neededobj2.c and neededobj3.c.
(tests): Add neededtest.
(modules-names): Add neededobj1, neededobj2 and neededobj3.
($(objpfx)neededobj1.so): New target.
($(objpfx)neededobj2.so): Likewise.
($(objpfx)neededobj3.so): Likewise.
($(objpfx)neededtest): Likewise.
($(objpfx)neededtest.out): Likewise.
* elf/neededtest.c: New. Based on the bug report from
Allen Bauer <kylix_rd@hotmail.com>.
* elf/neededobj1.c: Likewise.
* elf/neededobj2.c: Likewise.
* elf/neededobj3.c: Likewise.

2000-10-20  Ulrich Drepper  <drepper@redhat.com>

* elf/dl-close.c (_dl_close): Decrement reference counter for all
dependencies even if the DSO does not get unloaded.

* elf/dl-load.c (_dl_map_object_from_fd): Pass pointer to ELF header
to elf_machine_matches_host.
* sysdeps/alpha/dl-machine.h (elf_machine_matches_host): Parameter
is now pointer to ELF header.
* sysdeps/arm/dl-machine.h: Likewise.
* sysdeps/generic/dl-machine.h: Likewise.
* sysdeps/hppa/dl-machine.h: Likewise.
* sysdeps/i386/dl-machine.h: Likewise.
* sysdeps/ia64/dl-machine.h: Likewise.
* sysdeps/m68k/dl-machine.h: Likewise.
* sysdeps/mips/dl-machine.h: Likewise.
* sysdeps/mips/mips64/dl-machine.h: Likewise.
* sysdeps/powerpc/dl-machine.h: Likewise.
* sysdeps/s390/dl-machine.h: Likewise.
* sysdeps/sh/dl-machine.h: Likewise.
* sysdeps/sparc/sparc32/dl-machine.h: Likewise.
* sysdeps/sparc/sparc64/dl-machine.h: Likewise.
Patch by Martin Schwidefsksy <schwidefsky@de.ibm.com>.

2000-10-20  Jakub Jelinek  <jakub@redhat.com>

* include/limits.h: Include bits/wordsize.h, use #if __WORDSIZE == 64
check instead of #ifdef __alpha__.
* include/bits/xopen_lim.h (WORD_BIT, LONG_BIT): Don't count on
INT_MAX, __INT_MAX__, LONG_MAX or __LONG_MAX__ being defined when
this is included.

* posix/wordexp-tst.sh (testout): Place output file in build
directory.  Patch by Joseph S. Myers <jsm28@cam.ac.uk>.

26 files changed:
ChangeLog
elf/Makefile
elf/dl-close.c
elf/dl-load.c
elf/neededobj1.c [new file with mode: 0644]
elf/neededobj2.c [new file with mode: 0644]
elf/neededobj3.c [new file with mode: 0644]
elf/neededtest.c [new file with mode: 0644]
include/bits/xopen_lim.h
include/limits.h
localedata/locales/iso14651_t1
posix/wordexp-tst.sh
sysdeps/alpha/dl-machine.h
sysdeps/arm/dl-machine.h
sysdeps/generic/dl-machine.h
sysdeps/hppa/dl-machine.h
sysdeps/i386/dl-machine.h
sysdeps/ia64/dl-machine.h
sysdeps/m68k/dl-machine.h
sysdeps/mips/dl-machine.h
sysdeps/mips/mips64/dl-machine.h
sysdeps/powerpc/dl-machine.h
sysdeps/s390/dl-machine.h
sysdeps/sh/dl-machine.h
sysdeps/sparc/sparc32/dl-machine.h
sysdeps/sparc/sparc64/dl-machine.h

index 4065905..4f7f7de 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,57 @@
+2000-10-19  H.J. Lu  <hjl@gnu.org>
+
+       * elf/Makefile (distribute): Add neededtest.c, neededobj1.c,
+       neededobj2.c and neededobj3.c.
+       (tests): Add neededtest.
+       (modules-names): Add neededobj1, neededobj2 and neededobj3.
+       ($(objpfx)neededobj1.so): New target.
+       ($(objpfx)neededobj2.so): Likewise.
+       ($(objpfx)neededobj3.so): Likewise.
+       ($(objpfx)neededtest): Likewise.
+       ($(objpfx)neededtest.out): Likewise.
+       * elf/neededtest.c: New. Based on the bug report from
+       Allen Bauer <kylix_rd@hotmail.com>.
+       * elf/neededobj1.c: Likewise.
+       * elf/neededobj2.c: Likewise.
+       * elf/neededobj3.c: Likewise.
+
+2000-10-20  Ulrich Drepper  <drepper@redhat.com>
+
+       * elf/dl-close.c (_dl_close): Decrement reference counter for all
+       dependencies even if the DSO does not get unloaded.
+
+       * elf/dl-load.c (_dl_map_object_from_fd): Pass pointer to ELF header
+       to elf_machine_matches_host.
+       * sysdeps/alpha/dl-machine.h (elf_machine_matches_host): Parameter
+       is now pointer to ELF header.
+       * sysdeps/arm/dl-machine.h: Likewise.
+       * sysdeps/generic/dl-machine.h: Likewise.
+       * sysdeps/hppa/dl-machine.h: Likewise.
+       * sysdeps/i386/dl-machine.h: Likewise.
+       * sysdeps/ia64/dl-machine.h: Likewise.
+       * sysdeps/m68k/dl-machine.h: Likewise.
+       * sysdeps/mips/dl-machine.h: Likewise.
+       * sysdeps/mips/mips64/dl-machine.h: Likewise.
+       * sysdeps/powerpc/dl-machine.h: Likewise.
+       * sysdeps/s390/dl-machine.h: Likewise.
+       * sysdeps/sh/dl-machine.h: Likewise.
+       * sysdeps/sparc/sparc32/dl-machine.h: Likewise.
+       * sysdeps/sparc/sparc64/dl-machine.h: Likewise.
+       Patch by Martin Schwidefsksy <schwidefsky@de.ibm.com>.
+
+2000-10-20  Jakub Jelinek  <jakub@redhat.com>
+
+       * include/limits.h: Include bits/wordsize.h, use #if __WORDSIZE == 64
+       check instead of #ifdef __alpha__.
+       * include/bits/xopen_lim.h (WORD_BIT, LONG_BIT): Don't count on
+       INT_MAX, __INT_MAX__, LONG_MAX or __LONG_MAX__ being defined when
+       this is included.
+
 2000-10-20  Ulrich Drepper  <drepper@redhat.com>
 
+       * posix/wordexp-tst.sh (testout): Place output file in build
+       directory.  Patch by Joseph S. Myers <jsm28@cam.ac.uk>.
+
        * sysdeps/powerpc/fpu/bits/mathinline.h: Pretty print.
 
 2000-10-19  Ulrich Drepper  <drepper@redhat.com>
index 917a745..d38524d 100644 (file)
@@ -53,7 +53,8 @@ distribute    := $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \
                   nodlopenmod.c nodelete.c nodelmod1.c nodelmod2.c \
                   nodelmod3.c nodelmod4.c nodlopen.c dl-osinfo.h \
                   reldepmod1.c reldepmod2.c reldepmod3.c reldepmod4.c \
-                  nextmod1.c nextmod2.c
+                  nextmod1.c nextmod2.c \
+                  neededtest.c neededobj1.c neededobj2.c neededobj3.c
 
 include ../Makeconfig
 
@@ -95,7 +96,7 @@ ifeq (yes,$(build-shared))
 tests = loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
        constload1 order $(tests-vis-$(have-protected)) noload filter unload \
        reldep reldep2 reldep3 next $(tests-nodelete-$(have-z-nodelete)) \
-       $(tests-nodlopen-$(have-z-nodlopen))
+       $(tests-nodlopen-$(have-z-nodlopen)) neededtest
 tests-vis-yes = vismain
 tests-nodelete-yes = nodelete
 tests-nodlopen-yes = nodlopen
@@ -105,7 +106,8 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
                dep1 dep2 dep3 dep4 $(modules-vis-$(have-protected)) \
                $(modules-nodelete-$(have-z-nodelete)) \
                $(modules-nodlopen-$(have-z-nodlopen)) filtmod1 filtmod2 \
-               reldepmod1 reldepmod2 reldepmod3 reldepmod4 nextmod1 nextmod2
+               reldepmod1 reldepmod2 reldepmod3 reldepmod4 nextmod1 nextmod2 \
+               neededobj1 neededobj2 neededobj3
 modules-vis-yes = vismod1 vismod2 vismod3
 modules-nodelete-yes = nodelmod1 nodelmod2 nodelmod3 nodelmod4
 modules-nodlopen-yes = nodlopenmod
@@ -249,6 +251,10 @@ $(objpfx)dep4.so: $(objpfx)dep3.so
 $(objpfx)nodelmod3.so: $(objpfx)nodelmod4.so
 $(objpfx)nextmod1.so: $(libdl)
 
+$(objpfx)neededobj1.so: $(libdl)
+$(objpfx)neededobj2.so: $(objpfx)neededobj1.so $(libdl)
+$(objpfx)neededobj3.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so $(libdl)
+
 # filtmod1.so has a special rule
 $(filter-out $(objpfx)filtmod1.so, $(test-modules)): $(objpfx)%.so: $(objpfx)%.os
        $(build-module)
@@ -258,6 +264,11 @@ LDFLAGS-loadtest = -rdynamic
 
 $(objpfx)loadtest.out: $(test-modules)
 
+$(objpfx)neededtest: $(libdl)
+
+$(objpfx)neededtest.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
+                    $(objpfx)neededobj3.so
+
 $(objpfx)restest1: $(objpfx)testobj1.so $(objpfx)testobj1_1.so $(libdl)
 LDFLAGS-restest1 = -rdynamic
 
index 8426e73..03c38d9 100644 (file)
@@ -61,6 +61,9 @@ _dl_close (void *_map)
   /* Acquire the lock.  */
   __libc_lock_lock (_dl_load_lock);
 
+  list = map->l_searchlist.r_list;
+  nsearchlist = map->l_searchlist.r_nlist;
+
   /* Decrement the reference count.  */
   if (map->l_opencount > 1 || map->l_type != lt_loaded)
     {
@@ -78,14 +81,17 @@ _dl_close (void *_map)
                             "\n", NULL);
        }
 
-      --map->l_opencount;
+      /* Even if we don't unload it now, we still have to decrement
+        `l_opencount' of the dependencies.  Otherwise, they may not
+        get unloaded later.  */
+      for (i = 0; i < nsearchlist; ++i)
+       if (! (list[i]->l_flags_1 & DF_1_NODELETE))
+         --list[i]->l_opencount;
+
       __libc_lock_unlock (_dl_load_lock);
       return;
     }
 
-  list = map->l_searchlist.r_list;
-  nsearchlist = map->l_searchlist.r_nlist;
-
   rellist = map->l_reldeps;
   nrellist = map->l_reldepsact;
 
index 81ac233..b2f5ad7 100644 (file)
@@ -851,7 +851,7 @@ _dl_map_object_from_fd (const char *name, int fd, char *realname,
 
   if (__builtin_expect (header->e_version, EV_CURRENT) != EV_CURRENT)
     LOSE (0, N_("ELF file version does not match current one"));
-  if (! __builtin_expect (elf_machine_matches_host (header->e_machine), 1))
+  if (! __builtin_expect (elf_machine_matches_host (header), 1))
     LOSE (0, N_("ELF file machine architecture does not match"));
   if (__builtin_expect (header->e_phentsize, sizeof (ElfW(Phdr)))
       != sizeof (ElfW(Phdr)))
diff --git a/elf/neededobj1.c b/elf/neededobj1.c
new file mode 100644 (file)
index 0000000..12c5184
--- /dev/null
@@ -0,0 +1,4 @@
+void
+c_function (void)
+{
+}
diff --git a/elf/neededobj2.c b/elf/neededobj2.c
new file mode 100644 (file)
index 0000000..22b0e4c
--- /dev/null
@@ -0,0 +1,7 @@
+extern void c_function (void);
+
+void
+b_function (void)
+{
+  c_function();
+}
diff --git a/elf/neededobj3.c b/elf/neededobj3.c
new file mode 100644 (file)
index 0000000..0fc94e2
--- /dev/null
@@ -0,0 +1,9 @@
+extern void b_function (void);
+extern void c_function (void);
+
+void
+a_function (void)
+{
+  b_function ();
+  c_function ();
+}
diff --git a/elf/neededtest.c b/elf/neededtest.c
new file mode 100644 (file)
index 0000000..053d552
--- /dev/null
@@ -0,0 +1,104 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dlfcn.h>
+#include <link.h>
+
+static int
+check_loaded_objects (const char **loaded)
+{
+  struct link_map *lm;
+  int n;
+  int *found = NULL;
+  int errors = 0;
+
+  for (n = 0; loaded[n]; n++)
+    /* NOTHING */;
+
+  if (n)
+    {
+      found = (int *) alloca (sizeof (int) * n);
+      memset (found, 0, sizeof (int) * n);
+    }
+
+  printf("   Name\n");
+  printf(" --------------------------------------------------------\n");
+  for (lm = _r_debug.r_map; lm; lm = lm->l_next)
+    {
+      if (lm->l_name && lm->l_name[0])
+       printf(" %s\n", lm->l_name);
+      if (lm->l_type == lt_loaded && lm->l_name)
+       {
+         int match = 0;
+         for (n = 0; loaded[n] != NULL; n++)
+           {
+             if (strcmp (basename (loaded[n]), basename (lm->l_name)) == 0)
+               {
+                 found[n] = 1;
+                 match = 1;
+                 break;
+               }
+           }
+
+         if (match == 0)
+           {
+             ++errors;
+             printf ("ERRORS: %s is not unloaded\n", lm->l_name);
+           }
+       }
+    }
+
+  for (n = 0; loaded[n] != NULL; n++)
+    {
+      if (found[n] == 0)
+        {
+         ++errors;
+         printf ("ERRORS: %s is not loaded\n", loaded[n]);
+       }
+    }
+
+  return errors;
+}
+
+int
+main (void)
+{
+  void *obj2;
+  void *obj3;
+  const char *loaded[] = { NULL, NULL, NULL, NULL };
+  int errors = 0;
+
+  printf ("\nThis is what is in memory now:\n");
+  errors += check_loaded_objects (loaded);
+  printf( "Loading shared object neededobj3.so\n");
+  obj3 = dlopen( "neededobj3.so", RTLD_LAZY);
+  if (obj3 == NULL)
+    {
+      printf ("%s\n", dlerror ());
+      exit (1);
+    }
+  printf ("And this is what is now in memory\n");
+  loaded[0] = "neededobj1.so";
+  loaded[1] = "neededobj2.so";
+  loaded[2] = "neededobj3.so";
+  errors += check_loaded_objects (loaded);
+  printf ("Now loading shared object neededobj2.so\n");
+  obj2 = dlopen ("neededobj2.so", RTLD_LAZY);
+  if (obj2 == NULL)
+    {
+      printf ("%s\n", dlerror ());
+      exit (1);
+    }
+  printf ("Again, this is what is in memory\n");
+  errors += check_loaded_objects (loaded);
+  printf ("Closing neededobj2.so\n");
+  dlclose (obj2);
+  errors += check_loaded_objects (loaded);
+  printf ("Closing neededobj3.so\n");
+  dlclose (obj3);
+  loaded[0] = NULL;
+  errors += check_loaded_objects (loaded);
+  if (errors != 0)
+    printf ("%d errorss found\n", errors);
+  return errors;
+}
index 823c801..e874dba 100644 (file)
 
 
 /* Number of bits in a word of type `int'.  */
-#if INT_MAX == 32767
-# define WORD_BIT      16
-#else
-# if INT_MAX == 2147483647
-#  define WORD_BIT     32
+#ifdef INT_MAX
+# if INT_MAX == 32767
+#  define WORD_BIT     16
+# else
+#  if INT_MAX == 2147483647
+#   define WORD_BIT    32
+#  else
+/* Safe assumption.  */
+#   define WORD_BIT    64
+#  endif
+# endif
+#elif defined __INT_MAX__
+# if __INT_MAX__ == 32767
+#  define WORD_BIT     16
 # else
+#  if __INT_MAX__ == 2147483647
+#   define WORD_BIT    32
+#  else
 /* Safe assumption.  */
-#  define WORD_BIT     64
+#   define WORD_BIT    64
+#  endif
 # endif
+#else
+# define WORD_BIT      32
 #endif
 
 /* Number of bits in a word of type `long int'.  */
-#if LONG_MAX == 2147483647
-# define LONG_BIT      32
-#else
+#ifdef LONG_MAX
+# if LONG_MAX == 2147483647
+#  define LONG_BIT     32
+# else
 /* Safe assumption.  */
-# define LONG_BIT      64
+#  define LONG_BIT     64
+# endif
+#elif defined __LONG_MAX__
+# if __LONG_MAX__ == 2147483647
+#  define LONG_BIT     32
+# else
+/* Safe assumption.  */
+#  define LONG_BIT     64
+# endif
+#else
+# include <bits/wordsize.h>
+# if __WORDSIZE == 64
+#  define LONG_BIT     64
+# else
+#  define LONG_BIT     32
+# endif
 #endif
 
 #endif /* bits/xopen_lim.h */
index d0c3d61..0e8eb9c 100644 (file)
@@ -42,6 +42,8 @@
 # ifndef _LIMITS_H
 #  define _LIMITS_H    1
 
+#include <bits/wordsize.h>
+
 /* We don't have #include_next.
    Define ANSI <limits.h> for standard 32-bit words.  */
 
@@ -82,7 +84,7 @@
 #  define UINT_MAX     4294967295U
 
 /* Minimum and maximum values a `signed long int' can hold.  */
-#  ifdef __alpha__
+#  if __WORDSIZE == 64
 #   define LONG_MAX    9223372036854775807L
 #  else
 #   define LONG_MAX    2147483647L
@@ -90,7 +92,7 @@
 #  define LONG_MIN     (-LONG_MAX - 1L)
 
 /* Maximum value an `unsigned long int' can hold.  (Minimum is 0.)  */
-#  ifdef __alpha__
+#  if __WORDSIZE == 64
 #   define ULONG_MAX   18446744073709551615UL
 #  else
 #   define ULONG_MAX   4294967295UL
index 4f1f3a9..6ca6335 100644 (file)
@@ -245,6 +245,7 @@ collating-symbol <CYR-OUBRE>
 collating-symbol <CYR-EF>
 collating-symbol <CYR-HA>
 collating-symbol <CYR-TSE>
+collating-symbol <CYR-CHE>
 collating-symbol <CYR-DCHE>
 collating-symbol <CYR-SHA>
 collating-symbol <CYR-SHTSHA>
@@ -501,6 +502,7 @@ collating-symbol <CYR-YA>
 <CYR-EF>
 <CYR-HA>
 <CYR-TSE>
+<CYR-CHE>
 <CYR-DCHE>
 <CYR-SHA>
 <CYR-SHTSHA>
@@ -1428,7 +1430,7 @@ order_start <CYRIL>;forward;forward;forward;forward,position
 <U0444> <CYR-EF>;<BAS>;<MIN>;IGNORE
 <U0445> <CYR-HA>;<BAS>;<MIN>;IGNORE
 <U0446> <CYR-TSE>;<BAS>;<MIN>;IGNORE
-<U0447> <CYR-TSHE>;<BAS>;<MIN>;IGNORE
+<U0447> <CYR-CHE>;<BAS>;<MIN>;IGNORE
 <U045F> <CYR-DCHE>;<BAS>;<MIN>;IGNORE
 <U0448> <CYR-SHA>;<BAS>;<MIN>;IGNORE
 <U0449> <CYR-SHTSHA>;<BAS>;<MIN>;IGNORE
@@ -1473,7 +1475,7 @@ order_start <CYRIL>;forward;forward;forward;forward,position
 <U0424> <CYR-EF>;<BAS>;<CAP>;IGNORE
 <U0425> <CYR-HA>;<BAS>;<CAP>;IGNORE
 <U0426> <CYR-TSE>;<BAS>;<CAP>;IGNORE
-<U0427> <CYR-TSHE>;<BAS>;<CAP>;IGNORE
+<U0427> <CYR-CHE>;<BAS>;<CAP>;IGNORE
 <U040F> <CYR-DCHE>;<BAS>;<CAP>;IGNORE
 <U0428> <CYR-SHA>;<BAS>;<CAP>;IGNORE
 <U0429> <CYR-SHTSHA>;<BAS>;<CAP>;IGNORE
index 8fe697e..9654457 100755 (executable)
@@ -7,10 +7,8 @@
 common_objpfx=$1; shift
 elf_objpfx=$1; shift
 rtld_installed_name=$1; shift
-logfile=$common_objpfx/posix/wordexp-tst.out
-
-: ${TMPDIR=${common_objpfx}posix}
-testout=$TMPDIR/wordexp-test-result
+logfile=${common_objpfx}posix/wordexp-tst.out
+testout=${common_objpfx}posix/wordexp-test-result
 
 result=0
 rm -f $logfile
index 69845b4..d9aeb18 100644 (file)
 #include <string.h>
 
 
-/* Return nonzero iff E_MACHINE is compatible with the running host.  */
+/* Return nonzero iff ELF header is compatible with the running host.  */
 static inline int
-elf_machine_matches_host (Elf64_Word e_machine)
+elf_machine_matches_host (const Elf64_Ehdr *ehdr)
 {
-  return e_machine == EM_ALPHA;
+  return ehdr->e_machine == EM_ALPHA;
 }
 
 /* Return the link-time address of _DYNAMIC.  The multiple-got-capable
index cbef92f..9b40e6f 100644 (file)
                    : "a1");                                            \
 }
 
-/* Return nonzero iff E_MACHINE is compatible with the running host.  */
+/* Return nonzero iff ELF header is compatible with the running host.  */
 static inline int __attribute__ ((unused))
-elf_machine_matches_host (Elf32_Half e_machine)
+elf_machine_matches_host (const Elf32_Ehdr *ehdr)
 {
-  switch (e_machine)
-    {
-    case EM_ARM:
-      return 1;
-    default:
-      return 0;
-    }
+  return ehdr->e_machine == EM_ARM;
 }
 
 
@@ -491,7 +485,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
 
             newvalue = value - (Elf32_Addr)reloc_addr + (addend << 2);
             if (newvalue & 0xfc000003)
-              newvalue = fix_bad_pc24(reloc_addr, value) 
+              newvalue = fix_bad_pc24(reloc_addr, value)
                 - (Elf32_Addr)reloc_addr + (addend << 2);
 
             newvalue = newvalue >> 2;
index a23f178..b8502f7 100644 (file)
 #include <link.h>
 
 
-/* Return nonzero iff E_MACHINE is compatible with the running host.  */
+/* Return nonzero iff ELF header is compatible with the running host.  */
 static inline int
-elf_machine_matches_host (Elf32_Half e_machine)
+elf_machine_matches_host (const Elf32_Ehdr *ehdr)
 {
-  switch (e_machine)
+  switch (ehdr->e_machine)
     {
     default:
       return 0;
index e6782b3..89ad542 100644 (file)
@@ -59,11 +59,11 @@ extern int __fptr_count;
 extern Elf32_Addr __hppa_make_fptr (const struct link_map *, Elf32_Addr,
                                    struct hppa_fptr **, struct hppa_fptr *);
 
-/* Return nonzero iff E_MACHINE is compatible with the running host.  */
+/* Return nonzero iff ELF header is compatible with the running host.  */
 static inline int
-elf_machine_matches_host (Elf32_Half e_machine)
+elf_machine_matches_host (const Elf32_Ehdr *ehdr)
 {
-  return e_machine == EM_PARISC;
+  return ehdr->e_machine == EM_PARISC;
 }
 
 
@@ -252,7 +252,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
        .text
        .globl _start
        .type _start,@function
-_start:        
+_start:
        /* The kernel does not give us an initial stack frame. */
        ldo     64(%sp),%sp
        /* Save the relevant arguments (yes, those are the correct
@@ -357,7 +357,7 @@ _dl_start_user:
        ldw     RT'_dl_loaded(%r1),%r26
        ldw     0(%r26),%r26
        /* envp = argv + argc + 1 */
-       sh2add  %r25,%r24,%r23  
+       sh2add  %r25,%r24,%r23
        bl      _dl_init,%r2
        ldo     4(%r23),%r23    /* delay slot */
 
index 61b419c..8029469 100644 (file)
 
 #include <sys/param.h>
 
-/* Return nonzero iff E_MACHINE is compatible with the running host.  */
+/* Return nonzero iff ELF header is compatible with the running host.  */
 static inline int __attribute__ ((unused))
-elf_machine_matches_host (Elf32_Half e_machine)
+elf_machine_matches_host (const Elf32_Ehdr *ehdr)
 {
-  switch (e_machine)
-    {
-    case EM_386:
-      return 1;
-    default:
-      return 0;
-    }
+  return ehdr->e_machine == EM_386;
 }
 
 
index 5c4870d..92aad5a 100644 (file)
@@ -53,11 +53,11 @@ extern int __fptr_count;
 extern Elf64_Addr __ia64_make_fptr (const struct link_map *, Elf64_Addr,
                                    struct ia64_fptr **, struct ia64_fptr *);
 
-/* Return nonzero iff E_MACHINE is compatible with the running host.  */
+/* Return nonzero iff ELF header is compatible with the running host.  */
 static inline int
-elf_machine_matches_host (Elf64_Word e_machine)
+elf_machine_matches_host (const Elf64_Ehdr *ehdr)
 {
-  return e_machine == EM_IA_64;
+  return ehdr->e_machine == EM_IA_64;
 }
 
 
index 06c9db6..3381d6f 100644 (file)
 
 #include <sys/param.h>
 
-/* Return nonzero iff E_MACHINE is compatible with the running host.  */
+/* Return nonzero iff ELF header is compatible with the running host.  */
 static inline int
-elf_machine_matches_host (Elf32_Half e_machine)
+elf_machine_matches_host (const Elf32_Ehdr *ehdr)
 {
-  switch (e_machine)
-    {
-    case EM_68K:
-      return 1;
-    default:
-      return 0;
-    }
+  return ehdr->e_machine == EM_68K;
 }
 
 
index c0ece38..8051dc6 100644 (file)
@@ -86,11 +86,11 @@ do { if ((l)->l_info[DT_MIPS (RLD_MAP)]) \
        (ElfW(Addr)) (r); \
    } while (0)
 
-/* Return nonzero iff E_MACHINE is compatible with the running host.  */
+/* Return nonzero iff ELF header is compatible with the running host.  */
 static inline int __attribute__ ((unused))
-elf_machine_matches_host (ElfW(Half) e_machine)
+elf_machine_matches_host (const ElfW(Ehdr) *ehdr)
 {
-  switch (e_machine)
+  switch (ehdr->e_machine)
     {
     case EM_MIPS:
     case EM_MIPS_RS3_LE:
index 195a1d3..59bd581 100644 (file)
@@ -77,11 +77,11 @@ do { if ((l)->l_info[DT_MIPS (RLD_MAP)]) \
        (ElfW(Addr)) (r); \
    } while (0)
 
-/* Return nonzero iff E_MACHINE is compatible with the running host.  */
+/* Return nonzero iff ELF  header is compatible with the running host.  */
 static inline int __attribute__ ((unused))
-elf_machine_matches_host (ElfW(Half) e_machine)
+elf_machine_matches_host (const ElfW(Ehdr) *ehdr)
 {
-  switch (e_machine)
+  switch (ehdr->e_machine)
     {
     case EM_MIPS:
     case EM_MIPS_RS3_LE:
index 0307a29..c8d6c11 100644 (file)
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  PowerPC version.
-   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 
+   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
 
 #include <assert.h>
 
-/* Return nonzero iff E_MACHINE is compatible with the running host.  */
+/* Return nonzero iff ELF header is compatible with the running host.  */
 static inline int
-elf_machine_matches_host (Elf32_Half e_machine)
+elf_machine_matches_host (const Elf32_Ehdr *ehdr)
 {
-  return e_machine == EM_PPC;
+  return ehdr->e_machine == EM_PPC;
 }
 
 
index 3cab824..3432426 100644 (file)
 #include <link.h>
 
 
-/* Return nonzero iff E_MACHINE is compatible with the running host.  */
+/* Return nonzero iff ELF header is compatible with the running host.  */
 static inline int
-elf_machine_matches_host (Elf32_Half e_machine)
+elf_machine_matches_host (const Elf32_Ehdr *ehdr)
 {
-  switch (e_machine)
-    {
-    case EM_S390:
-      return 1;
-    default:
-      return 0;
-    }
+  return ehdr->e_machine == EM_S390;
 }
 
 
index 1530f94..dd21dfb 100644 (file)
 
 #include <assert.h>
 
-/* Return nonzero iff E_MACHINE is compatible with the running host.  */
+/* Return nonzero iff ELF header is compatible with the running host.  */
 static inline int __attribute__ ((unused))
-elf_machine_matches_host (Elf32_Half e_machine)
+elf_machine_matches_host (const Elf32_Ehdr *ehdr)
 {
-  switch (e_machine)
-    {
-    case EM_SH:
-      return 1;
-    default:
-      return 0;
-    }
+  return ehdr->e_machine == EM_SH;
 }
 
 
index cd91add..c1d423a 100644 (file)
                       : "/etc/ld.so.preload")
 
 
-/* Return nonzero iff E_MACHINE is compatible with the running host.  */
+/* Return nonzero iff ELF header is compatible with the running host.  */
 static inline int
-elf_machine_matches_host (Elf32_Half e_machine)
+elf_machine_matches_host (const Elf32_Ehdr *ehdr)
 {
-  if (e_machine == EM_SPARC)
+  if (ehdr->e_machine == EM_SPARC)
     return 1;
-  else if (e_machine == EM_SPARC32PLUS)
+  else if (ehdr->e_machine == EM_SPARC32PLUS)
     {
       unsigned long *hwcap;
       weak_extern (_dl_hwcap);
index 6aa9ca6..079e1d7 100644 (file)
 #define ELF64_R_TYPE_ID(info)  ((info) & 0xff)
 #define ELF64_R_TYPE_DATA(info) ((info) >> 8)
 
-/* Return nonzero iff E_MACHINE is compatible with the running host.  */
+/* Return nonzero iff ELF header is compatible with the running host.  */
 static inline int
-elf_machine_matches_host (Elf64_Half e_machine)
+elf_machine_matches_host (const Elf64_Ehdr *ehdr)
 {
-  return e_machine == EM_SPARCV9;
+  return ehdr->e_machine == EM_SPARCV9;
 }
 
 /* Return the link-time address of _DYNAMIC.  Conveniently, this is the