From f1dba30859338176d3440a7d68fac14d392c9f49 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 20 Oct 2000 17:04:28 +0000 Subject: [PATCH] (elf_machine_matches_host): Parameter is now pointer to ELF header. --- sysdeps/alpha/dl-machine.h | 6 +++--- sysdeps/arm/dl-machine.h | 14 ++++---------- sysdeps/hppa/dl-machine.h | 10 +++++----- sysdeps/m68k/dl-machine.h | 12 +++--------- sysdeps/mips/dl-machine.h | 6 +++--- sysdeps/mips/mips64/dl-machine.h | 6 +++--- 6 files changed, 21 insertions(+), 33 deletions(-) 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/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/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: