]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Sun, 26 Aug 2001 22:28:16 +0000 (22:28 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sun, 26 Aug 2001 22:28:16 +0000 (22:28 +0000)
2001-08-26  Jakub Jelinek  <jakub@redhat.com>

* elf/dl-reloc.c (RESOLVE_MAP, RESOLVE): Use elf_machine_type_class
instead of elf_machine_lookup_noexec_p and elf_machine_lookup_noplt_p.
Pass type_class to _dl_lookup_*.
* elf/dl-lookup.c (_dl_lookup_symbol): Take type_clas parameter now.
Pass around just type_class instead of noexec, noplt pair.
(_dl_lookup_versioned_symbol): Likewise.
(_dl_lookup_symbol_skip): Pass around just type_class instead of
noexec, noplt pair.
(_dl_lookup_versioned_symbol_skip): Likewise.
(_dl_do_lookup, _dl_do_lookup_versioned): Likewise.
* elf/do-lookup.h (do_lookup): Likewise.
* include/link.h (struct link_map): Replace noexec and noplt fields
in l_lookup_cache with type_class field.
* sysdeps/generic/ldsodefs.h (ELF_RTYPE_CLASS_PLT,
ELF_RTYPE_CLASS_COPY): Define.
Adjust prototypes for _dl_lookup_symbol and
_dl_lookup_versioned_symbol.
* sysdeps/alpha/dl-machine.h (elf_machine_lookup_noplt_p,
elf_machine_lookup_noexec_p): Remove.
(elf_machine_type_class): Define.
* sysdeps/arm/dl-machine.h: Likewise.
* sysdeps/hppa/dl-machine.h: Likewise.
* sysdeps/cris/dl-machine.h: Likewise.
* sysdeps/i386/dl-machine.h: Likewise.
* sysdeps/ia64/dl-machine.h: Likewise.
* sysdeps/m68k/dl-machine.h: Likewise.
* sysdeps/mips/mips64/dl-machine.h: Likewise.
* sysdeps/mips/dl-machine.h: Likewise.
* sysdeps/powerpc/dl-machine.h: Likewise.
* sysdeps/sparc/sparc32/dl-machine.h: Likewise.
* sysdeps/sparc/sparc64/dl-machine.h: Likewise.
* sysdeps/sh/dl-machine.h: Likewise.
* sysdeps/s390/s390-32/dl-machine.h: Likewise.
* sysdeps/s390/s390-64/dl-machine.h: Likewise.

21 files changed:
ChangeLog
elf/dl-lookup.c
elf/dl-reloc.c
elf/do-lookup.h
include/link.h
sysdeps/alpha/dl-machine.h
sysdeps/arm/dl-machine.h
sysdeps/cris/dl-machine.h
sysdeps/generic/ldsodefs.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/s390-32/dl-machine.h
sysdeps/s390/s390-64/dl-machine.h
sysdeps/sh/dl-machine.h
sysdeps/sparc/sparc32/dl-machine.h
sysdeps/sparc/sparc64/dl-machine.h

index ed8c80ffed378f48b5821e8e58336895843dc3c4..35ba6a6e6892c7a1d886196b1533a24710920c02 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,40 @@
+2001-08-26  Jakub Jelinek  <jakub@redhat.com>
+
+       * elf/dl-reloc.c (RESOLVE_MAP, RESOLVE): Use elf_machine_type_class
+       instead of elf_machine_lookup_noexec_p and elf_machine_lookup_noplt_p.
+       Pass type_class to _dl_lookup_*.
+       * elf/dl-lookup.c (_dl_lookup_symbol): Take type_clas parameter now.
+       Pass around just type_class instead of noexec, noplt pair.
+       (_dl_lookup_versioned_symbol): Likewise.
+       (_dl_lookup_symbol_skip): Pass around just type_class instead of
+       noexec, noplt pair.
+       (_dl_lookup_versioned_symbol_skip): Likewise.
+       (_dl_do_lookup, _dl_do_lookup_versioned): Likewise.
+       * elf/do-lookup.h (do_lookup): Likewise.
+       * include/link.h (struct link_map): Replace noexec and noplt fields
+       in l_lookup_cache with type_class field.
+       * sysdeps/generic/ldsodefs.h (ELF_RTYPE_CLASS_PLT,
+       ELF_RTYPE_CLASS_COPY): Define.
+       Adjust prototypes for _dl_lookup_symbol and
+       _dl_lookup_versioned_symbol.
+       * sysdeps/alpha/dl-machine.h (elf_machine_lookup_noplt_p,
+       elf_machine_lookup_noexec_p): Remove.
+       (elf_machine_type_class): Define.
+       * sysdeps/arm/dl-machine.h: Likewise.
+       * sysdeps/hppa/dl-machine.h: Likewise.
+       * sysdeps/cris/dl-machine.h: Likewise.
+       * sysdeps/i386/dl-machine.h: Likewise.
+       * sysdeps/ia64/dl-machine.h: Likewise.
+       * sysdeps/m68k/dl-machine.h: Likewise.
+       * sysdeps/mips/mips64/dl-machine.h: Likewise.
+       * sysdeps/mips/dl-machine.h: Likewise.
+       * sysdeps/powerpc/dl-machine.h: Likewise.
+       * sysdeps/sparc/sparc32/dl-machine.h: Likewise.
+       * sysdeps/sparc/sparc64/dl-machine.h: Likewise.
+       * sysdeps/sh/dl-machine.h: Likewise.
+       * sysdeps/s390/s390-32/dl-machine.h: Likewise.
+       * sysdeps/s390/s390-64/dl-machine.h: Likewise.
+
 2001-08-26  Ulrich Drepper  <drepper@redhat.com>
 
        * manual/message.texi (Advanced gettext functions): Change
index 71dda25affd066b9b155ad7f6a01300486ec83f4..5fa6b73b50e2de8f8affe5671f175b3037e20a50 100644 (file)
@@ -175,14 +175,14 @@ internal_function
 _dl_do_lookup (const char *undef_name, unsigned long int hash,
               const ElfW(Sym) *ref, struct sym_val *result,
               struct r_scope_elem *scope, size_t i,
-              struct link_map *skip, int noexec, int noplt);
+              struct link_map *skip, int type_class);
 static int
 internal_function
 _dl_do_lookup_versioned (const char *undef_name, unsigned long int hash,
                         const ElfW(Sym) *ref, struct sym_val *result,
                         struct r_scope_elem *scope, size_t i,
                         const struct r_found_version *const version,
-                        struct link_map *skip, int noexec, int noplt);
+                        struct link_map *skip, int type_class);
 
 
 /* Search loaded objects' symbol tables for a definition of the symbol
@@ -192,21 +192,19 @@ lookup_t
 internal_function
 _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map,
                   const ElfW(Sym) **ref, struct r_scope_elem *symbol_scope[],
-                  int reloc_type, int explicit)
+                  int type_class, int explicit)
 {
   unsigned long int hash = _dl_elf_hash (undef_name);
   struct sym_val current_value = { NULL, NULL };
   struct r_scope_elem **scope;
   int protected;
-  int noexec = elf_machine_lookup_noexec_p (reloc_type);
-  int noplt = elf_machine_lookup_noplt_p (reloc_type);
 
   ++_dl_num_relocations;
 
   /* Search the relevant loaded objects for a definition.  */
   for (scope = symbol_scope; *scope; ++scope)
     if (do_lookup (undef_name, hash, *ref, &current_value, *scope, 0, NULL,
-                  noexec, noplt))
+                  type_class))
       {
        /* We have to check whether this would bind UNDEF_MAP to an object
           in the global scope which was dynamically loaded.  In this case
@@ -223,7 +221,7 @@ _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map,
          /* Something went wrong.  Perhaps the object we tried to reference
             was just removed.  Try finding another definition.  */
          return _dl_lookup_symbol (undef_name, undef_map, ref, symbol_scope,
-                                   reloc_type, 0);
+                                   type_class, 0);
 
        break;
       }
@@ -270,7 +268,7 @@ _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map,
 
       for (scope = symbol_scope; *scope; ++scope)
        if (_dl_do_lookup (undef_name, hash, *ref, &protected_value, *scope,
-                          0, NULL, 0, 1))
+                          0, NULL, ELF_RTYPE_CLASS_PLT))
          break;
 
       if (protected_value.s == NULL || protected_value.m == undef_map)
@@ -311,10 +309,10 @@ _dl_lookup_symbol_skip (const char *undef_name,
     assert (i < (*scope)->r_nlist);
 
   if (! _dl_do_lookup (undef_name, hash, *ref, &current_value, *scope, i,
-                      skip_map, 0, 0))
+                      skip_map, 0))
     while (*++scope)
       if (_dl_do_lookup (undef_name, hash, *ref, &current_value, *scope, 0,
-                        skip_map, 0, 0))
+                        skip_map, 0))
        break;
 
   if (__builtin_expect (current_value.s == NULL, 0))
@@ -346,10 +344,10 @@ _dl_lookup_symbol_skip (const char *undef_name,
 
       if (i >= (*scope)->r_nlist
          || !_dl_do_lookup (undef_name, hash, *ref, &protected_value, *scope,
-                            i, skip_map, 0, 1))
+                            i, skip_map, ELF_RTYPE_CLASS_PLT))
        while (*++scope)
          if (_dl_do_lookup (undef_name, hash, *ref, &protected_value, *scope,
-                            0, skip_map, 0, 1))
+                            0, skip_map, ELF_RTYPE_CLASS_PLT))
            break;
 
       if (protected_value.s == NULL || protected_value.m == undef_map)
@@ -374,14 +372,12 @@ _dl_lookup_versioned_symbol (const char *undef_name,
                             struct link_map *undef_map, const ElfW(Sym) **ref,
                             struct r_scope_elem *symbol_scope[],
                             const struct r_found_version *version,
-                            int reloc_type, int explicit)
+                            int type_class, int explicit)
 {
   unsigned long int hash = _dl_elf_hash (undef_name);
   struct sym_val current_value = { NULL, NULL };
   struct r_scope_elem **scope;
   int protected;
-  int noexec = elf_machine_lookup_noexec_p (reloc_type);
-  int noplt = elf_machine_lookup_noplt_p (reloc_type);
 
   ++_dl_num_relocations;
 
@@ -389,7 +385,7 @@ _dl_lookup_versioned_symbol (const char *undef_name,
   for (scope = symbol_scope; *scope; ++scope)
     {
       int res = do_lookup_versioned (undef_name, hash, *ref, &current_value,
-                                    *scope, 0, version, NULL, noexec, noplt);
+                                    *scope, 0, version, NULL, type_class);
       if (res > 0)
        {
          /* We have to check whether this would bind UNDEF_MAP to an object
@@ -408,7 +404,7 @@ _dl_lookup_versioned_symbol (const char *undef_name,
               was just removed.  Try finding another definition.  */
            return _dl_lookup_versioned_symbol (undef_name, undef_map, ref,
                                                symbol_scope, version,
-                                               reloc_type, 0);
+                                               type_class, 0);
 
          break;
        }
@@ -482,7 +478,8 @@ _dl_lookup_versioned_symbol (const char *undef_name,
 
       for (scope = symbol_scope; *scope; ++scope)
        if (_dl_do_lookup_versioned (undef_name, hash, *ref, &protected_value,
-                                    *scope, 0, version, NULL, 0, 1))
+                                    *scope, 0, version, NULL,
+                                    ELF_RTYPE_CLASS_PLT))
          break;
 
       if (protected_value.s == NULL || protected_value.m == undef_map)
@@ -522,10 +519,10 @@ _dl_lookup_versioned_symbol_skip (const char *undef_name,
     assert (i < (*scope)->r_nlist);
 
   if (! _dl_do_lookup_versioned (undef_name, hash, *ref, &current_value,
-                                *scope, i, version, skip_map, 0, 0))
+                                *scope, i, version, skip_map, 0))
     while (*++scope)
       if (_dl_do_lookup_versioned (undef_name, hash, *ref, &current_value,
-                                  *scope, 0, version, skip_map, 0, 0))
+                                  *scope, 0, version, skip_map, 0))
        break;
 
   if (__builtin_expect (current_value.s == NULL, 0))
@@ -571,11 +568,11 @@ _dl_lookup_versioned_symbol_skip (const char *undef_name,
       if (i >= (*scope)->r_nlist
          || !_dl_do_lookup_versioned (undef_name, hash, *ref,
                                       &protected_value, *scope, i, version,
-                                      skip_map, 0, 1))
+                                      skip_map, ELF_RTYPE_CLASS_PLT))
        while (*++scope)
          if (_dl_do_lookup_versioned (undef_name, hash, *ref,
                                       &protected_value, *scope, 0, version,
-                                      skip_map, 0, 1))
+                                      skip_map, ELF_RTYPE_CLASS_PLT))
            break;
 
       if (protected_value.s == NULL || protected_value.m == undef_map)
@@ -616,10 +613,10 @@ internal_function
 _dl_do_lookup (const char *undef_name, unsigned long int hash,
               const ElfW(Sym) *ref, struct sym_val *result,
               struct r_scope_elem *scope, size_t i,
-              struct link_map *skip, int noexec, int noplt)
+              struct link_map *skip, int type_class)
 {
-  return do_lookup (undef_name, hash, ref, result, scope, i, skip, noexec,
-                   noplt);
+  return do_lookup (undef_name, hash, ref, result, scope, i, skip,
+                   type_class);
 }
 
 static int
@@ -628,8 +625,8 @@ _dl_do_lookup_versioned (const char *undef_name, unsigned long int hash,
                         const ElfW(Sym) *ref, struct sym_val *result,
                         struct r_scope_elem *scope, size_t i,
                         const struct r_found_version *const version,
-                        struct link_map *skip, int noexec, int noplt)
+                        struct link_map *skip, int type_class)
 {
   return do_lookup_versioned (undef_name, hash, ref, result, scope, i,
-                             version, skip, noexec, noplt);
+                             version, skip, type_class);
 }
index 276aea094b2a56f8a89c0e7d134c34e887b2d34f..6e38648d88279c2bdeaad89d0d8ad8930eb035ff 100644 (file)
@@ -75,45 +75,43 @@ cannot make segment writable for relocation"));
     const char *strtab = (const void *) D_PTR (l, l_info[DT_STRTAB]);
 
     /* This macro is used as a callback from the ELF_DYNAMIC_RELOCATE code.  */
-#define RESOLVE_MAP(ref, version, flags) \
+#define RESOLVE_MAP(ref, version, r_type) \
     (ELFW(ST_BIND) ((*ref)->st_info) != STB_LOCAL                            \
      ? ((__builtin_expect ((*ref) == l->l_lookup_cache.sym, 0)               \
-        && elf_machine_lookup_noexec_p (flags) == l->l_lookup_cache.noexec   \
-        && elf_machine_lookup_noplt_p (flags) == l->l_lookup_cache.noplt)    \
+        && elf_machine_type_class (r_type) == l->l_lookup_cache.type_class)  \
        ? (++_dl_num_cache_relocations,                                       \
           (*ref) = l->l_lookup_cache.ret,                                    \
           l->l_lookup_cache.value)                                           \
        : ({ lookup_t _lr;                                                    \
+            int _tc = elf_machine_type_class (r_type);                       \
+            l->l_lookup_cache.type_class = _tc;                              \
             l->l_lookup_cache.sym = (*ref);                                  \
-            l->l_lookup_cache.noexec = elf_machine_lookup_noexec_p (flags);  \
-            l->l_lookup_cache.noplt = elf_machine_lookup_noplt_p (flags);    \
             _lr = ((version) != NULL && (version)->hash != 0                 \
                    ? _dl_lookup_versioned_symbol (strtab + (*ref)->st_name,  \
                                                   l, (ref), scope,           \
-                                                  (version), (flags), 0)     \
+                                                  (version), _tc, 0)         \
                    : _dl_lookup_symbol (strtab + (*ref)->st_name, l, (ref),  \
-                                        scope, (flags), 0));                 \
+                                        scope, _tc, 0));                     \
             l->l_lookup_cache.ret = (*ref);                                  \
             l->l_lookup_cache.value = _lr; }))                               \
      : l)
-#define RESOLVE(ref, version, flags) \
+#define RESOLVE(ref, version, r_type) \
     (ELFW(ST_BIND) ((*ref)->st_info) != STB_LOCAL                            \
      ? ((__builtin_expect ((*ref) == l->l_lookup_cache.sym, 0)               \
-        && elf_machine_lookup_noexec_p (flags) == l->l_lookup_cache.noexec   \
-        && elf_machine_lookup_noplt_p (flags) == l->l_lookup_cache.noplt)    \
+        && elf_machine_type_class (r_type) == l->l_lookup_cache.type_class)  \
        ? (++_dl_num_cache_relocations,                                       \
           (*ref) = l->l_lookup_cache.ret,                                    \
           l->l_lookup_cache.value)                                           \
        : ({ lookup_t _lr;                                                    \
+            int _tc = elf_machine_type_class (r_type);                       \
+            l->l_lookup_cache.type_class = _tc;                              \
             l->l_lookup_cache.sym = (*ref);                                  \
-            l->l_lookup_cache.noexec = elf_machine_lookup_noexec_p (flags);  \
-            l->l_lookup_cache.noplt = elf_machine_lookup_noplt_p (flags);    \
             _lr = ((version) != NULL && (version)->hash != 0                 \
                    ? _dl_lookup_versioned_symbol (strtab + (*ref)->st_name,  \
                                                   l, (ref), scope,           \
-                                                  (version), (flags), 0)     \
+                                                  (version), _tc, 0)         \
                    : _dl_lookup_symbol (strtab + (*ref)->st_name, l, (ref),  \
-                                        scope, (flags), 0));                 \
+                                        scope, _tc, 0));                     \
             l->l_lookup_cache.ret = (*ref);                                  \
             l->l_lookup_cache.value = _lr; }))                               \
      : l->l_addr)
index e60e227fcd07f6ac1f0c66ac4b95443fd682c8dd..b9364b95d1ff945cd60cad22beb2e7e26b58bb6c 100644 (file)
@@ -31,7 +31,7 @@
 static inline int
 FCT (const char *undef_name, unsigned long int hash, const ElfW(Sym) *ref,
      struct sym_val *result, struct r_scope_elem *scope, size_t i, ARG
-     struct link_map *skip, int noexec, int noplt)
+     struct link_map *skip, int type_class)
 {
   struct link_map **list = scope->r_list;
   size_t n = scope->r_nlist;
@@ -56,7 +56,7 @@ FCT (const char *undef_name, unsigned long int hash, const ElfW(Sym) *ref,
        continue;
 
       /* Don't search the executable when resolving a copy reloc.  */
-      if (noexec && map->l_type == lt_executable)
+      if ((type_class & ELF_RTYPE_CLASS_COPY) && map->l_type == lt_executable)
        continue;
 
       /* Print some debugging info if wanted.  */
@@ -76,8 +76,11 @@ FCT (const char *undef_name, unsigned long int hash, const ElfW(Sym) *ref,
        {
          sym = &symtab[symidx];
 
+         assert (ELF_RTYPE_CLASS_PLT == 1);
          if (sym->st_value == 0 || /* No value.  */
-             (noplt && sym->st_shndx == SHN_UNDEF))
+             /* ((type_class & ELF_RTYPE_CLASS_PLT)
+                 && (sym->st_shndx == SHN_UNDEF)) */
+             (type_class & (sym->st_shndx == SHN_UNDEF)))
            continue;
 
          if (ELFW(ST_TYPE) (sym->st_info) > STT_FUNC)
index 5aba87492780c80311593e6c43a8405b1ffea930..0ae05264c724342c3998cf7597f6a8b6bdb04334 100644 (file)
@@ -236,8 +236,7 @@ struct link_map
     struct
     {
       const ElfW(Sym) *sym;
-      int noexec;
-      int noplt;
+      int type_class;
 #ifdef DL_LOOKUP_RETURNS_MAP
       struct link_map *value;
 #else
index 37e8136be8810b582ee194bb0aa5277509ed7a40..64cca5c1fd53ed7c366ee60a03f5f0751e30f73d 100644 (file)
@@ -351,13 +351,13 @@ $fixup_stack:
 #define RTLD_START_SPECIAL_INIT /* nothing */
 #endif
 
-/* Nonzero iff TYPE describes relocation of a PLT entry, so
-   PLT entries should not be allowed to define the value.  */
-#define elf_machine_lookup_noplt_p(type)  ((type) == R_ALPHA_JMP_SLOT)
-
-/* Nonzero iff TYPE should not be allowed to resolve to one of
-   the main executable's symbols, as for a COPY reloc, which we don't use.  */
-#define elf_machine_lookup_noexec_p(type)  (0)
+/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
+   PLT entries should not be allowed to define the value.
+   ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
+   of the main executable's symbols, as for a COPY reloc, which we don't
+   use.  */
+#define elf_machine_type_class(type)   \
+  (((type) == R_ALPHA_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
 #define ELF_MACHINE_JMP_SLOT    R_ALPHA_JMP_SLOT
index 7dfed999d09ff90539c4d2b8393497715b7662c0..2a4ce9fb01c28d00e44f3a934c2060277b6dcac6 100644 (file)
@@ -323,13 +323,13 @@ _dl_start_user:
 .previous\n\
 ");
 
-/* Nonzero iff TYPE should not be allowed to resolve to one of
-   the main executable's symbols, as for a COPY reloc.  */
-#define elf_machine_lookup_noexec_p(type) ((type) == R_ARM_COPY)
-
-/* Nonzero iff TYPE describes relocation of a PLT entry, so
-   PLT entries should not be allowed to define the value.  */
-#define elf_machine_lookup_noplt_p(type) ((type) == R_ARM_JUMP_SLOT)
+/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
+   PLT entries should not be allowed to define the value.
+   ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
+   of the main executable's symbols, as for a COPY reloc.  */
+#define elf_machine_type_class(type) \
+  ((((type) == R_ARM_JUMP_SLOT) * ELF_RTYPE_CLASS_PLT) \
+   | (((type) == R_ARM_COPY) * ELF_RTYPE_CLASS_COPY))
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
 #define ELF_MACHINE_JMP_SLOT   R_ARM_JUMP_SLOT
index ce8dfc6d4e523deab91a9ed218f62b2e4a28e029..e4778e38a17f24fc0b4e1c61c70d909654edc0ef 100644 (file)
@@ -228,13 +228,13 @@ _dl_start_user:
        .size _dl_start_user, . - _dl_start_user
        .previous");
 
-/* Nonzero iff TYPE describes a relocation that should
-   skip the executable when looking up the symbol value.  */
-#define elf_machine_lookup_noexec_p(type) ((type) == R_CRIS_COPY)
-
-/* Nonzero iff TYPE describes relocation of a PLT entry, so
-   PLT entries should not be allowed to define the value.  */
-#define elf_machine_lookup_noplt_p(type) ((type) == R_CRIS_JUMP_SLOT)
+/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
+   PLT entries should not be allowed to define the value.
+   ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
+   of the main executable's symbols, as for a COPY reloc.  */
+#define elf_machine_type_class(type) \
+  ((((type) == R_CRIS_JUMP_SLOT) * ELF_RTYPE_CLASS_PLT)        \
+   | (((type) == R_CRIS_COPY) * ELF_RTYPE_CLASS_COPY))
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
 #define ELF_MACHINE_JMP_SLOT   R_CRIS_JUMP_SLOT
index 6d196c7379808b8b84b5c537ad7c0836e14e9308..594738116f805a4596fd8ef44ac8a0df522a5f69 100644 (file)
@@ -88,6 +88,13 @@ typedef ElfW(Addr) lookup_t;
 # define DL_STATIC_INIT(map)
 #endif
 
+/* Reloc type classes as returned by elf_machine_type_class().
+   ELF_RTYPE_CLASS_PLT means this reloc should not be satisfied by
+   some PLT symbol, ELF_RTYPE_CLASS_COPY means this reloc should not be
+   satisfied by any symbol in the executable.  */
+#define ELF_RTYPE_CLASS_PLT 1
+#define ELF_RTYPE_CLASS_COPY 2
+
 /* For the version handling we need an array with only names and their
    hash values.  */
 struct r_found_version
@@ -336,14 +343,12 @@ extern void _dl_setup_hash (struct link_map *map) internal_function;
    l_searchlist (i.e. the segment of the dependency tree starting at that
    object) is searched in turn.  REFERENCE_NAME should name the object
    containing the reference; it is used in error messages.
-   RELOC_TYPE is a machine-dependent reloc type, which is passed to
-   the `elf_machine_lookup_*_p' macros in dl-machine.h to affect which
-   symbols can be chosen.  */
+   TYPE_CLASS describes the type of symbol we are looking for.  */
 extern lookup_t _dl_lookup_symbol (const char *undef,
                                   struct link_map *undef_map,
                                   const ElfW(Sym) **sym,
                                   struct r_scope_elem *symbol_scope[],
-                                  int reloc_type, int explicit)
+                                  int type_class, int explicit)
      internal_function;
 
 /* Lookup versioned symbol.  */
@@ -352,7 +357,7 @@ extern lookup_t _dl_lookup_versioned_symbol (const char *undef,
                                             const ElfW(Sym) **sym,
                                             struct r_scope_elem *symbol_scope[],
                                             const struct r_found_version *version,
-                                            int reloc_type, int explicit)
+                                            int type_class, int explicit)
      internal_function;
 
 /* For handling RTLD_NEXT we must be able to skip shared objects.  */
index 15e1c85b392499a4a6693b948f21a607259c45c0..d13f15b3e5aa56f981340ec60a29f339c0be5bfe 100644 (file)
@@ -454,14 +454,14 @@ asm (                                                                     \
 #endif
 
 
-/* Nonzero iff TYPE describes a relocation that should
-   skip the executable when looking up the symbol value.  */
-#define elf_machine_lookup_noexec_p(type) ((type) == R_PARISC_COPY)
-
-/* Nonzero iff TYPE describes relocation of a PLT entry, so
-   PLT entries should not be allowed to define the value.  */
-#define elf_machine_lookup_noplt_p(type) ((type) == R_PARISC_IPLT \
-                                         || (type) == R_PARISC_EPLT)
+/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
+   PLT entries should not be allowed to define the value.
+   ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
+   of the main executable's symbols, as for a COPY reloc.  */
+#define elf_machine_type_class(type) \
+  ((((type) == R_PARISC_IPLT || (type) == R_PARISC_EPLT)       \
+    * ELF_RTYPE_CLASS_PLT)                                     \
+   | (((type) == R_PARISC_COPY) * ELF_RTYPE_CLASS_COPY))
 
 /* Used by ld.so for ... something ... */
 #define ELF_MACHINE_JMP_SLOT R_PARISC_IPLT
index e7a1b104ef62352977a506852173868d08c09458..bb3e89c71beeeee2cd538a27130e3b2933565f01 100644 (file)
@@ -247,13 +247,13 @@ _dl_start_user:\n\
 #define RTLD_START_SPECIAL_INIT /* nothing */
 #endif
 
-/* Nonzero iff TYPE should not be allowed to resolve to one of
-   the main executable's symbols, as for a COPY reloc.  */
-#define elf_machine_lookup_noexec_p(type) ((type) == R_386_COPY)
-
-/* Nonzero iff TYPE describes relocation of a PLT entry, so
-   PLT entries should not be allowed to define the value.  */
-#define elf_machine_lookup_noplt_p(type) ((type) == R_386_JMP_SLOT)
+/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
+   PLT entries should not be allowed to define the value.
+   ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
+   of the main executable's symbols, as for a COPY reloc.  */
+#define elf_machine_type_class(type) \
+  ((((type) == R_386_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)  \
+   | (((type) == R_386_COPY) * ELF_RTYPE_CLASS_COPY))
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
 #define ELF_MACHINE_JMP_SLOT   R_386_JMP_SLOT
@@ -371,8 +371,6 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
                                                   refsym->st_size));
          break;
        default:
-         /* We add these checks in the version to relocate ld.so only
-            if we are still debugging.  */
          _dl_reloc_bad_type (map, r_type, 0);
          break;
        }
index 99c022d148d57f2cbfd893f3e5d797a793cf2e03..21e5615e906089078cebf08fd8f3bc283be70a80 100644 (file)
@@ -434,14 +434,14 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
 #define RTLD_START_SPECIAL_INIT /* nothing */
 #endif
 
-/* Nonzero iff TYPE describes relocation of a PLT entry, so
-   PLT entries should not be allowed to define the value.  */
+/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
+   PLT entries should not be allowed to define the value.
+   ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
+   of the main executable's symbols, as for a COPY reloc, which we don't
+   use.  */
 /* ??? Ignore IPLTMSB for now.  */
-#define elf_machine_lookup_noplt_p(type) ((type) == R_IA64_IPLTLSB)
-
-/* Nonzero iff TYPE should not be allowed to resolve to one of
-   the main executable's symbols, as for a COPY reloc, which we don't use.  */
-#define elf_machine_lookup_noexec_p(type)  (0)
+#define elf_machine_type_class(type) \
+  (((type) == R_IA64_IPLTLSB) * ELF_RTYPE_CLASS_PLT)
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
 #define ELF_MACHINE_JMP_SLOT    R_IA64_IPLTLSB
index b0e29274ccffb597bf68636778e6794ad7c081f5..d9c819429ba5b400797f16c369c2ecdd433531ea 100644 (file)
@@ -189,13 +189,13 @@ _dl_start_user:
        .size _dl_start_user, . - _dl_start_user
        .previous");
 
-/* Nonzero iff TYPE describes a relocation that should
-   skip the executable when looking up the symbol value.  */
-#define elf_machine_lookup_noexec_p(type) ((type) == R_68K_COPY)
-
-/* Nonzero iff TYPE describes relocation of a PLT entry, so
-   PLT entries should not be allowed to define the value.  */
-#define elf_machine_lookup_noplt_p(type) ((type) == R_68K_JMP_SLOT)
+/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
+   PLT entries should not be allowed to define the value.
+   ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
+   of the main executable's symbols, as for a COPY reloc.  */
+#define elf_machine_type_class(type) \
+  ((((type) == R_68K_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)  \
+   | (((type) == R_68K_COPY) * ELF_RTYPE_CLASS_COPY))
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
 #define ELF_MACHINE_JMP_SLOT   R_68K_JMP_SLOT
index 878e27d317dc93d34a0aadf309064e4819dbc27a..cb3fc1c51e7d034c3c373a4d9c151bdad4870fca 100644 (file)
@@ -54,8 +54,7 @@
    This makes no sense on MIPS but we have to define this to R_MIPS_REL32
    to avoid the asserts in dl-lookup.c from blowing.  */
 #define ELF_MACHINE_JMP_SLOT                   R_MIPS_REL32
-#define elf_machine_lookup_noplt_p(type)       (1)
-#define elf_machine_lookup_noexec_p(type)      (0)
+#define elf_machine_type_class(type)           ELF_RTYPE_CLASS_PLT
 
 /* Translate a processor specific dynamic tag to the index
    in l_info array.  */
index eda94c2203cf19db40c8e65c7bdd943ba7227a45..34a81615bb129043f11f38f12abf957632d78d4d 100644 (file)
@@ -45,8 +45,7 @@
    This makes no sense on MIPS but we have to define this to R_MIPS_REL32
    to avoid the asserts in dl-lookup.c from blowing.  */
 #define ELF_MACHINE_JMP_SLOT                   R_MIPS_REL32
-#define elf_machine_lookup_noplt_p(type)       (1)
-#define elf_machine_lookup_noexec_p(type)      (0)
+#define elf_machine_type_class(type)           ELF_RTYPE_CLASS_PLT
 
 /* Translate a processor specific dynamic tag to the index
    in l_info array.  */
index 438629a0a84414a23bedba798a5ed0f51ffc6ce4..e8b54468751f4842992cd432834145725faa574a 100644 (file)
@@ -264,18 +264,18 @@ __elf_preferred_address(struct link_map *loader, size_t maplength,
 #define ELF_PREFERRED_ADDRESS(loader, maplength, mapstartpref) \
   __elf_preferred_address (loader, maplength, mapstartpref)
 
-/* Nonzero iff TYPE should not be allowed to resolve to one of
-   the main executable's symbols, as for a COPY reloc.  */
-#define elf_machine_lookup_noexec_p(type) ((type) == R_PPC_COPY)
-
-/* Nonzero iff TYPE describes relocation of a PLT entry, so
-   PLT entries should not be allowed to define the value.  */
+/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
+   PLT entries should not be allowed to define the value.
+   ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
+   of the main executable's symbols, as for a COPY reloc.  */
 /* We never want to use a PLT entry as the destination of a
    reloc, when what is being relocated is a branch. This is
    partly for efficiency, but mostly so we avoid loops.  */
-#define elf_machine_lookup_noplt_p(type) ((type) == R_PPC_REL24 ||            \
-                                         (type) == R_PPC_ADDR24 ||           \
-                                         (type) == R_PPC_JMP_SLOT)
+#define elf_machine_type_class(type) \
+  ((((type) == R_PPC_JMP_SLOT                          \
+    || (type) == R_PPC_REL24                           \
+    || (type) == R_PPC_ADDR24) * ELF_RTYPE_CLASS_PLT)  \
+   | (((type) == R_PPC_COPY) * ELF_RTYPE_CLASS_COPY))
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
 #define ELF_MACHINE_JMP_SLOT   R_PPC_JMP_SLOT
index 8028f62df0d0b732b723c1973721856a9a0538fe..f72651fba07f9b04917526a452b4d115e9fe6405 100644 (file)
@@ -304,13 +304,13 @@ _dl_start_user:\n\
 #define RTLD_START_SPECIAL_INIT /* nothing */
 #endif
 
-/* Nonzero iff TYPE should not be allowed to resolve to one of
-   the main executable's symbols, as for a COPY reloc.  */
-#define elf_machine_lookup_noexec_p(type) ((type) == R_390_COPY)
-
-/* Nonzero iff TYPE describes relocation of a PLT entry, so
-   PLT entries should not be allowed to define the value.  */
-#define elf_machine_lookup_noplt_p(type) ((type) == R_390_JMP_SLOT)
+/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
+   PLT entries should not be allowed to define the value.
+   ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
+   of the main executable's symbols, as for a COPY reloc.  */
+#define elf_machine_type_class(type) \
+  ((((type) == R_390_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)  \
+   | (((type) == R_390_COPY) * ELF_RTYPE_CLASS_COPY))
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
 #define ELF_MACHINE_JMP_SLOT    R_390_JMP_SLOT
index dde72f15482f294f8f6dcac3e1e2c07ff78bd27e..e77017ab1a4a3a533282c9a90de28132959b9328 100644 (file)
@@ -276,13 +276,13 @@ _dl_start_user:\n\
 #define RTLD_START_SPECIAL_INIT /* nothing */
 #endif
 
-/* Nonzero iff TYPE should not be allowed to resolve to one of
-   the main executable's symbols, as for a COPY reloc. */
-#define elf_machine_lookup_noexec_p(type) ((type) == R_390_COPY)
-
-/* Nonzero iff TYPE describes relocation of a PLT entry, so
-   PLT entries should not be allowed to define the value.  */
-#define elf_machine_lookup_noplt_p(type) ((type) == R_390_JMP_SLOT)
+/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
+   PLT entries should not be allowed to define the value.
+   ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
+   of the main executable's symbols, as for a COPY reloc.  */
+#define elf_machine_type_class(type) \
+  ((((type) == R_390_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)  \
+   | (((type) == R_390_COPY) * ELF_RTYPE_CLASS_COPY))
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
 #define ELF_MACHINE_JMP_SLOT   R_390_JMP_SLOT
index 6f3b31c43709aeac45063e88f4201c2fd484ac64..ee5bb9cdbc7ae0aeea016ccf40d6abf0d2ca71b5 100644 (file)
@@ -388,13 +388,13 @@ _dl_start_user:\n\
 .previous\n\
 ");
 
-/* Nonzero iff TYPE should not be allowed to resolve to one of
-   the main executable's symbols, as for a COPY reloc. */
-#define elf_machine_lookup_noexec_p(type) ((type) == R_SH_COPY)
-
-/* Nonzero iff TYPE describes relocation of a PLT entry, so
-   PLT entries should not be allowed to define the value.  */
-#define elf_machine_lookup_noplt_p(type) ((type) == R_SH_JMP_SLOT)
+/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
+   PLT entries should not be allowed to define the value.
+   ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
+   of the main executable's symbols, as for a COPY reloc.  */
+#define elf_machine_type_class(type) \
+  ((((type) == R_SH_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)   \
+   | (((type) == R_SH_COPY) * ELF_RTYPE_CLASS_COPY))
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
 #define ELF_MACHINE_JMP_SLOT   R_SH_JMP_SLOT
index 2ed14fc5f9afaf07a6bb5b8a536edbdd50ddfcc4..8c3698706193cc6dda2ab2ce07d168e47f507304 100644 (file)
@@ -177,13 +177,13 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
   TRAMPOLINE_TEMPLATE (_dl_runtime_profile, fixup);
 #endif
 
-/* Nonzero iff TYPE should not be allowed to resolve to one of
-   the main executable's symbols, as for a COPY reloc.  */
-#define elf_machine_lookup_noexec_p(type) ((type) == R_SPARC_COPY)
-
-/* Nonzero iff TYPE describes relocation of a PLT entry, so
-   PLT entries should not be allowed to define the value.  */
-#define elf_machine_lookup_noplt_p(type) ((type) == R_SPARC_JMP_SLOT)
+/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
+   PLT entries should not be allowed to define the value.
+   ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
+   of the main executable's symbols, as for a COPY reloc.  */
+#define elf_machine_type_class(type) \
+  ((((type) == R_SPARC_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)        \
+   | (((type) == R_SPARC_COPY) * ELF_RTYPE_CLASS_COPY))
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
 #define ELF_MACHINE_JMP_SLOT   R_SPARC_JMP_SLOT
index a72cb89e01461d3b08c620b7e819c721a71cc970..431e38b695aeba8fc7aa0b5763c461d346e456be 100644 (file)
@@ -392,13 +392,13 @@ elf_machine_lazy_rel (struct link_map *map,
 
 #endif /* RESOLVE */
 
-/* Nonzero iff TYPE should not be allowed to resolve to one of
-   the main executable's symbols, as for a COPY reloc.  */
-#define elf_machine_lookup_noexec_p(type) ((type) == R_SPARC_COPY)
-
-/* Nonzero iff TYPE describes relocation of a PLT entry, so
-   PLT entries should not be allowed to define the value.  */
-#define elf_machine_lookup_noplt_p(type) ((type) == R_SPARC_JMP_SLOT)
+/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
+   PLT entries should not be allowed to define the value.
+   ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
+   of the main executable's symbols, as for a COPY reloc.  */
+#define elf_machine_type_class(type) \
+  ((((type) == R_SPARC_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)        \
+   | (((type) == R_SPARC_COPY) * ELF_RTYPE_CLASS_COPY))
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
 #define ELF_MACHINE_JMP_SLOT   R_SPARC_JMP_SLOT