This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
On Sun, Aug 26, 2001 at 10:36:29AM -0700, Ulrich Drepper wrote: > Jakub Jelinek <jakub@redhat.com> writes: > > > What about merging elf_machine_lookup_no*_p into one function which would > > return a bitmask? As far as I can see they are always used together, and > > having them in one char or int would mean we could pass around just one > > argument, not 2, and compare one argument, not 2 when checking cache (and > > also store just one). > > What do you think? > > Makes sense now that we need these values outside the lookup functions. Here it is (bootstrapped, regression tested on i686): 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. * elf/dl-lookup.c (_dl_lookup_symbol): Likewise. 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. * 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. --- libc/elf/dl-reloc.c.jj Sun Aug 26 19:19:32 2001 +++ libc/elf/dl-reloc.c Sun Aug 26 22:23:43 2001 @@ -78,15 +78,13 @@ cannot make segment writable for relocat #define RESOLVE_MAP(ref, version, flags) \ (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 (flags) == l->l_lookup_cache.type_class) \ ? (++_dl_num_cache_relocations, \ (*ref) = l->l_lookup_cache.ret, \ l->l_lookup_cache.value) \ : ({ lookup_t _lr; \ 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); \ + l->l_lookup_cache.type_class = elf_machine_type_class (flags); \ _lr = ((version) != NULL && (version)->hash != 0 \ ? _dl_lookup_versioned_symbol (strtab + (*ref)->st_name, \ l, (ref), scope, \ @@ -99,15 +97,13 @@ cannot make segment writable for relocat #define RESOLVE(ref, version, flags) \ (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 (flags) == l->l_lookup_cache.type_class) \ ? (++_dl_num_cache_relocations, \ (*ref) = l->l_lookup_cache.ret, \ l->l_lookup_cache.value) \ : ({ lookup_t _lr; \ 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); \ + l->l_lookup_cache.type_class = elf_machine_type_class (flags); \ _lr = ((version) != NULL && (version)->hash != 0 \ ? _dl_lookup_versioned_symbol (strtab + (*ref)->st_name, \ l, (ref), scope, \ --- libc/elf/dl-lookup.c.jj Sun Aug 26 19:19:32 2001 +++ libc/elf/dl-lookup.c Sun Aug 26 23:32:04 2001 @@ -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 @@ -198,15 +198,14 @@ _dl_lookup_symbol (const char *undef_nam 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); + int type_class = elf_machine_type_class (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, ¤t_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 @@ -270,7 +269,7 @@ _dl_lookup_symbol (const char *undef_nam 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 +310,10 @@ _dl_lookup_symbol_skip (const char *unde assert (i < (*scope)->r_nlist); if (! _dl_do_lookup (undef_name, hash, *ref, ¤t_value, *scope, i, - skip_map, 0, 0)) + skip_map, 0)) while (*++scope) if (_dl_do_lookup (undef_name, hash, *ref, ¤t_value, *scope, 0, - skip_map, 0, 0)) + skip_map, 0)) break; if (__builtin_expect (current_value.s == NULL, 0)) @@ -346,10 +345,10 @@ _dl_lookup_symbol_skip (const char *unde 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) @@ -380,8 +379,7 @@ _dl_lookup_versioned_symbol (const char 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); + int type_class = elf_machine_type_class (reloc_type); ++_dl_num_relocations; @@ -389,7 +387,7 @@ _dl_lookup_versioned_symbol (const char for (scope = symbol_scope; *scope; ++scope) { int res = do_lookup_versioned (undef_name, hash, *ref, ¤t_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 @@ -482,7 +480,8 @@ _dl_lookup_versioned_symbol (const char 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 +521,10 @@ _dl_lookup_versioned_symbol_skip (const assert (i < (*scope)->r_nlist); if (! _dl_do_lookup_versioned (undef_name, hash, *ref, ¤t_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, ¤t_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 +570,11 @@ _dl_lookup_versioned_symbol_skip (const 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 +615,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 +627,8 @@ _dl_do_lookup_versioned (const char *und 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); } --- libc/elf/do-lookup.h.jj Thu Aug 23 18:47:05 2001 +++ libc/elf/do-lookup.h Sun Aug 26 22:36:59 2001 @@ -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 lo 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 lo { 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) --- libc/include/link.h.jj Sun Aug 26 19:19:32 2001 +++ libc/include/link.h Sun Aug 26 22:25:00 2001 @@ -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 --- libc/sysdeps/alpha/dl-machine.h.jj Sun Aug 26 22:13:22 2001 +++ libc/sysdeps/alpha/dl-machine.h Sun Aug 26 22:48:00 2001 @@ -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 --- libc/sysdeps/arm/dl-machine.h.jj Sun Aug 26 22:13:22 2001 +++ libc/sysdeps/arm/dl-machine.h Sun Aug 26 23:05:01 2001 @@ -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 --- libc/sysdeps/generic/ldsodefs.h.jj Sun Aug 26 19:19:33 2001 +++ libc/sysdeps/generic/ldsodefs.h Sun Aug 26 22:44:36 2001 @@ -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 --- libc/sysdeps/hppa/dl-machine.h.jj Sun Aug 26 22:13:22 2001 +++ libc/sysdeps/hppa/dl-machine.h Sun Aug 26 22:54:37 2001 @@ -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 --- libc/sysdeps/cris/dl-machine.h.jj Sun Aug 26 22:13:22 2001 +++ libc/sysdeps/cris/dl-machine.h Sun Aug 26 22:55:29 2001 @@ -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 --- libc/sysdeps/i386/dl-machine.h.jj Sun Aug 26 22:13:22 2001 +++ libc/sysdeps/i386/dl-machine.h Sun Aug 26 23:05:53 2001 @@ -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 --- libc/sysdeps/ia64/dl-machine.h.jj Sun Aug 26 22:13:22 2001 +++ libc/sysdeps/ia64/dl-machine.h Sun Aug 26 23:06:24 2001 @@ -434,14 +434,14 @@ elf_machine_runtime_setup (struct link_m #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 --- libc/sysdeps/m68k/dl-machine.h.jj Sun Aug 26 22:13:22 2001 +++ libc/sysdeps/m68k/dl-machine.h Sun Aug 26 22:58:01 2001 @@ -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 --- libc/sysdeps/mips/mips64/dl-machine.h.jj Sun Aug 26 22:13:22 2001 +++ libc/sysdeps/mips/mips64/dl-machine.h Sun Aug 26 22:59:39 2001 @@ -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. */ --- libc/sysdeps/mips/dl-machine.h.jj Sun Aug 26 22:13:22 2001 +++ libc/sysdeps/mips/dl-machine.h Sun Aug 26 22:59:09 2001 @@ -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. */ --- libc/sysdeps/powerpc/dl-machine.h.jj Sun Aug 26 22:13:23 2001 +++ libc/sysdeps/powerpc/dl-machine.h Sun Aug 26 23:01:43 2001 @@ -264,18 +264,18 @@ __elf_preferred_address(struct link_map #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 --- libc/sysdeps/sparc/sparc32/dl-machine.h.jj Sun Aug 26 22:13:23 2001 +++ libc/sysdeps/sparc/sparc32/dl-machine.h Sun Aug 26 23:07:13 2001 @@ -177,13 +177,13 @@ elf_machine_runtime_setup (struct link_m 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 --- libc/sysdeps/sparc/sparc64/dl-machine.h.jj Sun Aug 26 22:13:23 2001 +++ libc/sysdeps/sparc/sparc64/dl-machine.h Sun Aug 26 23:02:56 2001 @@ -392,13 +392,13 @@ elf_machine_lazy_rel (struct link_map *m #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 --- libc/sysdeps/sh/dl-machine.h.jj Sun Aug 26 22:13:23 2001 +++ libc/sysdeps/sh/dl-machine.h Sun Aug 26 23:07:32 2001 @@ -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 --- libc/sysdeps/s390/s390-32/dl-machine.h.jj Sun Aug 26 22:13:23 2001 +++ libc/sysdeps/s390/s390-32/dl-machine.h Sun Aug 26 23:07:43 2001 @@ -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 --- libc/sysdeps/s390/s390-64/dl-machine.h.jj Sun Aug 26 22:13:23 2001 +++ libc/sysdeps/s390/s390-64/dl-machine.h Sun Aug 26 23:07:52 2001 @@ -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 Jakub
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |