diff options
-rw-r--r-- | exec/ChangeLog | 13 | ||||
-rw-r--r-- | exec/hostarch.c | 61 | ||||
-rw-r--r-- | exec/main.c | 15 | ||||
-rw-r--r-- | exec/priv.h | 13 | ||||
-rw-r--r-- | libthreads/ChangeLog | 5 | ||||
-rw-r--r-- | libthreads/i386/csw.S | 7 |
6 files changed, 101 insertions, 13 deletions
diff --git a/exec/ChangeLog b/exec/ChangeLog index d650dbd8..0667d35a 100644 --- a/exec/ChangeLog +++ b/exec/ChangeLog @@ -1,3 +1,16 @@ +Thu Aug 29 13:00:38 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> + + * priv.h: Only include <bfd.h> if BFD. Only declare + host_bfd_arc_info, and bfd_host_bfd if BFD. If not BFD, give + typedef for asection. + * main.c: Only define host_bfd_arch_info, host_bfd, and + bfd_mach_host_arch_mach if BFD. + (main): Only call bfd_mach_most_arch_mach if BFD. + Call mach_host_elf_machine. + * hostarch.c (bfd_mach_host_arch_mach): Only define if BFD. + Delete arg E_MACHINE. All callers changed. + (mach_host_elf_machine): New function. + Sun Jul 7 21:13:22 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu> * exec.c (S_exec_exec): Don't use unsafe MOVE_SEND in call to diff --git a/exec/hostarch.c b/exec/hostarch.c index 38a38a00..d8466969 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, 1993, 1995 Free Software Foundation, Inc. + Copyright (C) 1992, 1993, 1995, 1996 Free Software Foundation, Inc. Written by Roland McGrath. This file is part of the GNU Hurd. @@ -19,17 +19,68 @@ You should have received a copy of the GNU General Public License along with the GNU Hurd; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + #include <mach.h> #include <hurd/hurd_types.h> #include <errno.h> -#include <bfd.h> #include <elf.h> error_t +mach_host_elf_machine (host_t host, + Elf32_Half *e_machine) +{ + error_t err; + struct host_basic_info hostinfo; + mach_msg_type_number_t hostinfocnt = HOST_BASIC_INFO_COUNT; + + err = host_info (host, HOST_BASIC_INFO, + (natural_t *) &hostinfo, &hostinfocnt); + if (err) + return err; + + switch (hostinfo.cpu_type) + { + default: + *e_machine = EM_NONE; + break; + + case CPU_TYPE_MC68020: + case CPU_TYPE_MC68030: + case CPU_TYPE_MC68040: + *e_machine = EM_68K; + break; + + case CPU_TYPE_I860: + *e_machine = EM_860; + break; + + case CPU_TYPE_MIPS: + *e_machine = EM_MIPS; + break; + + case CPU_TYPE_MC88000: + *e_machine = EM_88K; + break; + + case CPU_TYPE_SPARC: + *e_machine = EM_SPARC; + break; + + case CPU_TYPE_I386: + *e_machine = EM_386; + break; + } + + return 0; +} + +#ifdef BFD +#include <bfd.h> + +error_t bfd_mach_host_arch_mach (host_t host, enum bfd_architecture *arch, - long int *machine, - Elf32_Half *e_machine) + long int *machine) { error_t err; struct host_basic_info hostinfo; @@ -117,3 +168,5 @@ bfd_mach_host_arch_mach (host_t host, return 0; } + +#endif /* BFD */ diff --git a/exec/main.c b/exec/main.c index 809b99a8..44577d9c 100644 --- a/exec/main.c +++ b/exec/main.c @@ -1,5 +1,5 @@ /* GNU Hurd standard exec server, main program and server mechanics. - Copyright (C) 1992, 1993, 19941996 Free Software Foundation, Inc. + Copyright (C) 1992, 1993, 19941996, 1996 Free Software Foundation, Inc. Written by Roland McGrath. This file is part of the GNU Hurd. @@ -23,16 +23,16 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <hurd/paths.h> #include <hurd/startup.h> - +#ifdef BFD bfd_arch_info_type host_bfd_arch_info; bfd host_bfd = { arch_info: &host_bfd_arch_info }; -Elf32_Half elf_machine; /* ELF e_machine for the host. */ - extern error_t bfd_mach_host_arch_mach (host_t host, enum bfd_architecture *bfd_arch, long int *bfd_machine, Elf32_Half *elf_machine); +#endif +Elf32_Half elf_machine; /* ELF e_machine for the host. */ /* Trivfs hooks. */ int trivfs_fstype = FSTYPE_MISC; @@ -116,12 +116,15 @@ main (int argc, char **argv) save_argv = argv; +#ifdef BFD /* Put the Mach kernel's idea of what flavor of machine this is into the fake BFD against which architecture compatibility checks are made. */ err = bfd_mach_host_arch_mach (mach_host_self (), &host_bfd.arch_info->arch, - &host_bfd.arch_info->mach, - &elf_machine); + &host_bfd.arch_info->mach); +#endif + err = mach_host_elf_machine (mach_host_self (), &elf_machine); + if (err) error (1, err, "Getting host architecture from Mach"); diff --git a/exec/priv.h b/exec/priv.h index 0ded21eb..115c858a 100644 --- a/exec/priv.h +++ b/exec/priv.h @@ -1,5 +1,5 @@ /* GNU Hurd standard exec server, private declarations. - Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. Written by Roland McGrath. This file is part of the GNU Hurd. @@ -26,7 +26,11 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <hurd/ports.h> #include <hurd/lookup.h> #include <rwlock.h> + +#ifdef BFD #include <bfd.h> +#endif + #include <elf.h> #include <fcntl.h> #include "exec_S.h" @@ -35,11 +39,13 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef exec_priv_h #define exec_priv_h +#ifdef BFD /* A BFD whose architecture and machine type are those of the host system. */ extern bfd_arch_info_type host_bfd_arch_info; extern bfd host_bfd; -extern Elf32_Half elf_machine; /* ELF e_machine for the host. */ +#endif +extern Elf32_Half elf_machine; /* ELF e_machine for the host. */ /* Information kept around to be given to a new task in response to a message on the task's bootstrap port. */ @@ -67,6 +73,9 @@ typedef struct trivfs_protid *trivfs_protid_t; /* For MiG. */ extern mach_port_t procserver; /* Our proc port. */ +#ifndef BFD +typedef void asection; +#endif /* Data shared between check, check_section, load, load_section, and finish. */ diff --git a/libthreads/ChangeLog b/libthreads/ChangeLog index ebb6a424..19ad905f 100644 --- a/libthreads/ChangeLog +++ b/libthreads/ChangeLog @@ -1,3 +1,8 @@ +Thu Aug 29 12:50:37 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> + + * i386/csw.S: Include <mach/i386/asm.h> instead of <i386/asm.h>. + Define ELF before inclusion. + Sat Jul 20 15:47:24 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu> * Makefile (lndist-i386-files): Look for I386SRCS and I386HDRS in diff --git a/libthreads/i386/csw.S b/libthreads/i386/csw.S index 0951c5cc..ea77b739 100644 --- a/libthreads/i386/csw.S +++ b/libthreads/i386/csw.S @@ -26,6 +26,10 @@ /* * HISTORY * $Log: csw.S,v $ + * Revision 1.5 1995/10/04 20:55:28 roland + * (JUMPTARGET): New macro, versions for [PIC] and not. + * Use it in place of EXT. + * * Revision 1.4 1995/10/04 20:22:17 roland * [PIC] (EXT): Redefine to use PLT. * @@ -59,7 +63,8 @@ * [90/02/05 dbg] * */ -#include <i386/asm.h> +#define ELF +#include <mach/i386/asm.h> #ifdef PIC #define JUMPTARGET(name) EXT(name##@PLT) |