summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-04-27 21:21:42 +0000
committerRoland McGrath <roland@gnu.org>2002-04-27 21:21:42 +0000
commite74e95d8559ee79b61e0cc7eb766555c4c9c1dba (patch)
treef7d3b96f171d6246728f11715fe607d8a3a9501a
parent7ccb92aa6a0493b9896c8219de4b2cd0d4b37bb3 (diff)
2002-04-27 Roland McGrath <roland@frob.com>
* priv.h: Include <link.h> to get ElfW macro. * priv.h, exec.c, main.c, hostarch.c: Use `ElfW(TYPE)' in place of `Elf32_TYPE' throughout.
-rw-r--r--exec/exec.c28
-rw-r--r--exec/hostarch.c4
-rw-r--r--exec/main.c5
-rw-r--r--exec/priv.h11
4 files changed, 25 insertions, 23 deletions
diff --git a/exec/exec.c b/exec/exec.c
index ad1eb079..395b85dc 100644
--- a/exec/exec.c
+++ b/exec/exec.c
@@ -140,7 +140,7 @@ load_section (void *section, struct execdata *u)
#ifdef BFD
asection *const sec = section;
#endif
- const Elf32_Phdr *const ph = section;
+ const ElfW(Phdr) *const ph = section;
if (u->error)
return;
@@ -843,8 +843,8 @@ check_bfd (struct execdata *e)
static void
check_elf (struct execdata *e)
{
- Elf32_Ehdr *ehdr = map (e, 0, sizeof (Elf32_Ehdr));
- Elf32_Phdr *phdr;
+ ElfW(Ehdr) *ehdr = map (e, 0, sizeof (ElfW(Ehdr)));
+ ElfW(Phdr) *phdr;
if (! ehdr)
{
@@ -853,7 +853,7 @@ check_elf (struct execdata *e)
return;
}
- if (*(Elf32_Word *) ehdr != ((union { Elf32_Word word;
+ if (*(ElfW(Word) *) ehdr != ((union { ElfW(Word) word;
unsigned char string[SELFMAG]; })
{ string: ELFMAG }).word)
{
@@ -866,7 +866,7 @@ check_elf (struct execdata *e)
ehdr->e_ident[EI_VERSION] != EV_CURRENT ||
ehdr->e_version != EV_CURRENT ||
ehdr->e_ehsize < sizeof *ehdr ||
- ehdr->e_phentsize != sizeof (Elf32_Phdr))
+ ehdr->e_phentsize != sizeof (ElfW(Phdr)))
{
e->error = ENOEXEC;
return;
@@ -883,7 +883,7 @@ check_elf (struct execdata *e)
e->info.elf.loadbase = 0;
e->info.elf.phnum = ehdr->e_phnum;
- phdr = map (e, ehdr->e_phoff, ehdr->e_phnum * sizeof (Elf32_Phdr));
+ phdr = map (e, ehdr->e_phoff, ehdr->e_phnum * sizeof (ElfW(Phdr)));
if (! phdr)
{
if (!e->error)
@@ -896,13 +896,13 @@ check_elf (struct execdata *e)
/* Copy MAPPED_PHDR into E->info.elf.phdr, filling in
E->interp.phdr, *PHDR_ADDR, and *PHDR_SIZE in the process. */
static void
-check_elf_phdr (struct execdata *e, const Elf32_Phdr *mapped_phdr,
+check_elf_phdr (struct execdata *e, const ElfW(Phdr) *mapped_phdr,
vm_address_t *phdr_addr, vm_size_t *phdr_size)
{
- const Elf32_Phdr *phdr;
+ const ElfW(Phdr) *phdr;
memcpy (e->info.elf.phdr, mapped_phdr,
- e->info.elf.phnum * sizeof (Elf32_Phdr));
+ e->info.elf.phnum * sizeof (ElfW(Phdr)));
for (phdr = e->info.elf.phdr;
phdr < &e->info.elf.phdr[e->info.elf.phnum];
@@ -1025,7 +1025,7 @@ load (task_t usertask, struct execdata *e)
else
#endif
{
- Elf32_Word i;
+ ElfW(Word) i;
for (i = 0; i < e->info.elf.phnum; ++i)
if (e->info.elf.phdr[i].p_type == PT_LOAD)
load_section (&e->info.elf.phdr[i], e);
@@ -1439,8 +1439,8 @@ do_exec (file_t file,
else
#endif
{
- const Elf32_Phdr *phdr = e.info.elf.phdr;
- e.info.elf.phdr = alloca (e.info.elf.phnum * sizeof (Elf32_Phdr));
+ const ElfW(Phdr) *phdr = e.info.elf.phdr;
+ e.info.elf.phdr = alloca (e.info.elf.phnum * sizeof (ElfW(Phdr)));
check_elf_phdr (&e, phdr, &phdr_addr, &phdr_size);
}
@@ -1722,9 +1722,9 @@ do_exec (file_t file,
else
#endif
{
- const Elf32_Phdr *phdr = interp.info.elf.phdr;
+ const ElfW(Phdr) *phdr = interp.info.elf.phdr;
interp.info.elf.phdr = alloca (interp.info.elf.phnum *
- sizeof (Elf32_Phdr));
+ sizeof (ElfW(Phdr)));
check_elf_phdr (&interp, phdr, NULL, NULL);
}
}
diff --git a/exec/hostarch.c b/exec/hostarch.c
index db59c95f..ec59a417 100644
--- a/exec/hostarch.c
+++ b/exec/hostarch.c
@@ -1,6 +1,6 @@
/* Determine the BFD and ELF architecture and machine flavor
from a Mach host port. Used by the exec and core servers.
- Copyright (C) 1992,93,95,96,99,2000 Free Software Foundation, Inc.
+ Copyright (C) 1992,93,95,96,99,2000,02 Free Software Foundation, Inc.
Written by Roland McGrath.
This file is part of the GNU Hurd.
@@ -26,7 +26,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <elf.h>
error_t
-elf_machine_matches_host (Elf32_Half e_machine)
+elf_machine_matches_host (ElfW(Half) e_machine)
{
static void *host_type; /* Cached entry into the switch below. */
struct host_basic_info hostinfo;
diff --git a/exec/main.c b/exec/main.c
index 47e2090c..efad85aa 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -1,6 +1,7 @@
/* GNU Hurd standard exec server, main program and server mechanics.
- Copyright (C) 1992,93,94,95,96,97,98,99,2000,01 Free Software Foundation, Inc.
+ Copyright (C) 1992,93,94,95,96,97,98,99,2000,01,02
+ Free Software Foundation, Inc.
Written by Roland McGrath.
This file is part of the GNU Hurd.
@@ -33,7 +34,7 @@ bfd host_bfd = { arch_info: &host_bfd_arch_info };
extern error_t bfd_mach_host_arch_mach (host_t host,
enum bfd_architecture *bfd_arch,
long int *bfd_machine,
- Elf32_Half *elf_machine);
+ ElfW(Half) *elf_machine);
#endif
/* Trivfs hooks. */
diff --git a/exec/priv.h b/exec/priv.h
index 7b202735..bb671e95 100644
--- a/exec/priv.h
+++ b/exec/priv.h
@@ -1,5 +1,5 @@
/* GNU Hurd standard exec server, private declarations.
- Copyright (C) 1992,93,94,95,96,99,2000 Free Software Foundation, Inc.
+ Copyright (C) 1992,93,94,95,96,99,2000,02 Free Software Foundation, Inc.
Written by Roland McGrath.
This file is part of the GNU Hurd.
@@ -33,6 +33,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#endif
#include <elf.h>
+#include <link.h> /* This gives us the ElfW macro. */
#include <fcntl.h>
#include "exec_S.h"
@@ -127,7 +128,7 @@ struct execdata
union /* Interpreter section giving name of file. */
{
asection *section;
- const Elf32_Phdr *phdr;
+ const ElfW(Phdr) *phdr;
} interp;
memory_object_t filemap, cntlmap;
struct shared_io *cntl;
@@ -149,15 +150,15 @@ struct execdata
/* Program header table read from the executable.
After `check' this is a pointer into the mapping window.
By `load' it is local alloca'd storage. */
- Elf32_Phdr *phdr;
- Elf32_Word phnum; /* Number of program header table elements. */
+ ElfW(Phdr) *phdr;
+ ElfW(Word) phnum; /* Number of program header table elements. */
int anywhere; /* Nonzero if image can go anywhere. */
vm_address_t loadbase; /* Actual mapping location. */
} elf;
} info;
};
-error_t elf_machine_matches_host (Elf32_Half e_machine);
+error_t elf_machine_matches_host (ElfW(Half) e_machine);
void finish (struct execdata *, int dealloc_file_port);