From ceb579a3f8b7698868817f4fb0a36742f0494b28 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 21 Oct 2000 00:02:39 +0000 Subject: Update. 2000-10-19 H.J. Lu * 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 . * elf/neededobj1.c: Likewise. * elf/neededobj2.c: Likewise. * elf/neededobj3.c: Likewise. 2000-10-20 Ulrich Drepper * 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 . 2000-10-20 Jakub Jelinek * 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 . --- sysdeps/alpha/dl-machine.h | 6 +++--- sysdeps/arm/dl-machine.h | 14 ++++---------- sysdeps/generic/dl-machine.h | 6 +++--- sysdeps/hppa/dl-machine.h | 10 +++++----- sysdeps/i386/dl-machine.h | 12 +++--------- sysdeps/ia64/dl-machine.h | 6 +++--- sysdeps/m68k/dl-machine.h | 12 +++--------- sysdeps/mips/dl-machine.h | 6 +++--- sysdeps/mips/mips64/dl-machine.h | 6 +++--- sysdeps/powerpc/dl-machine.h | 8 ++++---- sysdeps/s390/dl-machine.h | 12 +++--------- sysdeps/sh/dl-machine.h | 12 +++--------- sysdeps/sparc/sparc32/dl-machine.h | 8 ++++---- sysdeps/sparc/sparc64/dl-machine.h | 6 +++--- 14 files changed, 47 insertions(+), 77 deletions(-) (limited to 'sysdeps') diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h index 69845b4b01..d9aeb18764 100644 --- a/sysdeps/alpha/dl-machine.h +++ b/sysdeps/alpha/dl-machine.h @@ -29,11 +29,11 @@ #include -/* 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 diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h index cbef92f3ae..9b40e6f98b 100644 --- a/sysdeps/arm/dl-machine.h +++ b/sysdeps/arm/dl-machine.h @@ -43,17 +43,11 @@ : "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; diff --git a/sysdeps/generic/dl-machine.h b/sysdeps/generic/dl-machine.h index a23f178034..b8502f71cc 100644 --- a/sysdeps/generic/dl-machine.h +++ b/sysdeps/generic/dl-machine.h @@ -23,11 +23,11 @@ #include -/* 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; diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h index e6782b3481..89ad542cdd 100644 --- a/sysdeps/hppa/dl-machine.h +++ b/sysdeps/hppa/dl-machine.h @@ -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 */ diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index 61b419c091..8029469e9f 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -24,17 +24,11 @@ #include -/* 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; } diff --git a/sysdeps/ia64/dl-machine.h b/sysdeps/ia64/dl-machine.h index 5c4870dc9b..92aad5af47 100644 --- a/sysdeps/ia64/dl-machine.h +++ b/sysdeps/ia64/dl-machine.h @@ -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; } diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h index 06c9db64a8..3381d6f25e 100644 --- a/sysdeps/m68k/dl-machine.h +++ b/sysdeps/m68k/dl-machine.h @@ -24,17 +24,11 @@ #include -/* 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; } diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h index c0ece38719..8051dc670c 100644 --- a/sysdeps/mips/dl-machine.h +++ b/sysdeps/mips/dl-machine.h @@ -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: diff --git a/sysdeps/mips/mips64/dl-machine.h b/sysdeps/mips/mips64/dl-machine.h index 195a1d3634..59bd581eae 100644 --- a/sysdeps/mips/mips64/dl-machine.h +++ b/sysdeps/mips/mips64/dl-machine.h @@ -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: diff --git a/sysdeps/powerpc/dl-machine.h b/sysdeps/powerpc/dl-machine.h index 0307a2924a..c8d6c113cf 100644 --- a/sysdeps/powerpc/dl-machine.h +++ b/sysdeps/powerpc/dl-machine.h @@ -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. @@ -25,11 +25,11 @@ #include -/* 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; } diff --git a/sysdeps/s390/dl-machine.h b/sysdeps/s390/dl-machine.h index 3cab824ce2..3432426127 100644 --- a/sysdeps/s390/dl-machine.h +++ b/sysdeps/s390/dl-machine.h @@ -29,17 +29,11 @@ #include -/* 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; } diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h index 1530f946f8..dd21dfbb9c 100644 --- a/sysdeps/sh/dl-machine.h +++ b/sysdeps/sh/dl-machine.h @@ -28,17 +28,11 @@ #include -/* 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; } diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h index cd91addda5..c1d423aa36 100644 --- a/sysdeps/sparc/sparc32/dl-machine.h +++ b/sysdeps/sparc/sparc32/dl-machine.h @@ -43,13 +43,13 @@ : "/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); diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h index 6aa9ca6659..079e1d7530 100644 --- a/sysdeps/sparc/sparc64/dl-machine.h +++ b/sysdeps/sparc/sparc64/dl-machine.h @@ -27,11 +27,11 @@ #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 -- cgit v1.2.3