(elf_machine_matches_host): Parameter is now pointer to ELF header.

This commit is contained in:
Ulrich Drepper 2000-10-20 17:04:28 +00:00
parent 8a02fd962e
commit f1dba30859
6 changed files with 21 additions and 33 deletions

View File

@ -29,11 +29,11 @@
#include <string.h> #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 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 /* Return the link-time address of _DYNAMIC. The multiple-got-capable

View File

@ -43,17 +43,11 @@
: "a1"); \ : "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)) static inline int __attribute__ ((unused))
elf_machine_matches_host (Elf32_Half e_machine) elf_machine_matches_host (const Elf32_Ehdr *ehdr)
{ {
switch (e_machine) return ehdr->e_machine == EM_ARM;
{
case EM_ARM:
return 1;
default:
return 0;
}
} }
@ -491,7 +485,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
newvalue = value - (Elf32_Addr)reloc_addr + (addend << 2); newvalue = value - (Elf32_Addr)reloc_addr + (addend << 2);
if (newvalue & 0xfc000003) if (newvalue & 0xfc000003)
newvalue = fix_bad_pc24(reloc_addr, value) newvalue = fix_bad_pc24(reloc_addr, value)
- (Elf32_Addr)reloc_addr + (addend << 2); - (Elf32_Addr)reloc_addr + (addend << 2);
newvalue = newvalue >> 2; newvalue = newvalue >> 2;

View File

@ -59,11 +59,11 @@ extern int __fptr_count;
extern Elf32_Addr __hppa_make_fptr (const struct link_map *, Elf32_Addr, extern Elf32_Addr __hppa_make_fptr (const struct link_map *, Elf32_Addr,
struct hppa_fptr **, struct hppa_fptr *); 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 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 .text
.globl _start .globl _start
.type _start,@function .type _start,@function
_start: _start:
/* The kernel does not give us an initial stack frame. */ /* The kernel does not give us an initial stack frame. */
ldo 64(%sp),%sp ldo 64(%sp),%sp
/* Save the relevant arguments (yes, those are the correct /* Save the relevant arguments (yes, those are the correct
@ -357,7 +357,7 @@ _dl_start_user:
ldw RT'_dl_loaded(%r1),%r26 ldw RT'_dl_loaded(%r1),%r26
ldw 0(%r26),%r26 ldw 0(%r26),%r26
/* envp = argv + argc + 1 */ /* envp = argv + argc + 1 */
sh2add %r25,%r24,%r23 sh2add %r25,%r24,%r23
bl _dl_init,%r2 bl _dl_init,%r2
ldo 4(%r23),%r23 /* delay slot */ ldo 4(%r23),%r23 /* delay slot */

View File

@ -24,17 +24,11 @@
#include <sys/param.h> #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 static inline int
elf_machine_matches_host (Elf32_Half e_machine) elf_machine_matches_host (const Elf32_Ehdr *ehdr)
{ {
switch (e_machine) return ehdr->e_machine == EM_68K;
{
case EM_68K:
return 1;
default:
return 0;
}
} }

View File

@ -86,11 +86,11 @@ do { if ((l)->l_info[DT_MIPS (RLD_MAP)]) \
(ElfW(Addr)) (r); \ (ElfW(Addr)) (r); \
} while (0) } 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)) 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:
case EM_MIPS_RS3_LE: case EM_MIPS_RS3_LE:

View File

@ -77,11 +77,11 @@ do { if ((l)->l_info[DT_MIPS (RLD_MAP)]) \
(ElfW(Addr)) (r); \ (ElfW(Addr)) (r); \
} while (0) } 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)) 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:
case EM_MIPS_RS3_LE: case EM_MIPS_RS3_LE: