From 179ce6e10b6f1de007323a29205dd6d6c9725b2b Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 22 Jul 1997 22:29:11 +0000 Subject: [PATCH] Tue Jul 22 17:19:45 1997 Robert Hoehne * coff-stubgo32.c: New file. * go32stub.h: New file. * coff-i386.c: If COFF_GO32_EXE, include coff/go32exe.h. * targets.c (go32stubbedcoff_vec): Declare. (bfd_target_vector): Add go32stubbedcoff_vec. * configure.in (go32coff_vec): New target vector. (go32stubbedcoff_vec): Likewise. * Makefile.in: Rebuild dependencies. (BFD32_BACKENDS): Add coff-stubgo32.o. (BFD32_BACKENDS_CFILES): Add coff-stubgo32.c. (HFILES): Add go32stub.h. --- bfd/.Sanitize | 2 + bfd/ChangeLog | 11 ++ bfd/Makefile.in | 21 +- bfd/coff-i386.c | 4 + bfd/coff-stubgo32.c | 463 ++++++++++++++++++++++++++++++++++++++++++++ bfd/configure | 26 +-- bfd/configure.in | 2 + bfd/go32stub.h | 128 ++++++++++++ 8 files changed, 640 insertions(+), 17 deletions(-) create mode 100644 bfd/coff-stubgo32.c create mode 100644 bfd/go32stub.h diff --git a/bfd/.Sanitize b/bfd/.Sanitize index b5c2004c771..a73071caf3d 100644 --- a/bfd/.Sanitize +++ b/bfd/.Sanitize @@ -109,6 +109,7 @@ coff-ppc.c coff-rs6000.c coff-sh.c coff-sparc.c +coff-stubgo32.c coff-svm68k.c coff-u68k.c coff-we32k.c @@ -196,6 +197,7 @@ format.c freebsd.h gen-aout.c genlink.h +go32stub.h hash.c host-aout.c hosts diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 449d41a23be..d47a2bd282b 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,8 @@ Tue Jul 22 17:19:45 1997 Robert Hoehne + * coff-stubgo32.c: New file. + * go32stub.h: New file. + * coff-i386.c: If COFF_GO32_EXE, include coff/go32exe.h. * coffswap.h (coff_swap_filehdr_in): Invoke COFF_ADJUST_FILEHDR_IN_PRE and COFF_ADJUST_FILEHDR_IN_POST if they are defined. @@ -13,6 +16,14 @@ Tue Jul 22 17:19:45 1997 Robert Hoehne diff --git a/bfd/Makefile.in b/bfd/Makefile.in index 7f6479a5717..e323c6d906d 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -205,6 +205,7 @@ BFD32_BACKENDS = \ coff-rs6000.o \ coff-sh.o \ coff-sparc.o \ + coff-stubgo32.o \ coff-svm68k.o \ $(start-sanitize-tic80) \ coff-tic80.o \ @@ -315,6 +316,7 @@ BFD32_BACKENDS_CFILES = \ coff-rs6000.c \ coff-sh.c \ coff-sparc.c \ + coff-stubgo32.c \ coff-svm68k.c \ coff-u68k.c \ coff-we32k.c \ @@ -487,9 +489,9 @@ CFILES = \ HFILES = \ aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h \ ecoffswap.h elf32-hppa.h elf32-target.h elf64-target.h \ - elfcode.h evax.h genlink.h hppa_stubs.h libaout.h libbfd.h \ - libcoff.h libecoff.h elf-bfd.h libhppa.h libieee.h libnlm.h \ - liboasys.h netbsd.h nlm-target.h nlmcode.h ns32k.h som.h \ + elfcode.h evax.h genlink.h go32stub.h hppa_stubs.h libaout.h \ + libbfd.h libcoff.h libecoff.h elf-bfd.h libhppa.h libieee.h \ + libnlm.h liboasys.h netbsd.h nlm-target.h nlmcode.h ns32k.h som.h \ targmatch.h all: Makefile $(ALLLIBS) @PICLIST@ @@ -638,8 +640,13 @@ do_distclean: do_clean rm -f Makefile config.status config.cache config.h config.log \ stamp-h bfd-in3.h rm -rf pic stamp-picdir + +# do_maintainer_clean really should remove bfd-in2.h, since it is a +# generated file. However, the GNU standards say that +# maintainer-clean should not delete anything which needs to exist in +# order to run configure, and bfd-in2.h is used by configure. do_maintainer_clean: do_distclean - rm -f $(srcdir)/bfd-in2.h $(srcdir)/libbfd.h $(srcdir)/libcoff.h + rm -f $(srcdir)/libbfd.h $(srcdir)/libcoff.h mostlyclean: do_mostlyclean $(MAKE) subdir_do DO=mostlyclean "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) @@ -878,7 +885,7 @@ end-sanitize-v850: start-sanitize-tic80: cpu-tic80.o: cpu-tic80.c coff-tic80.o: coff-tic80.c $(INCDIR)/bfdlink.h elf-bfd.h \ - $(INCDIR)/coff/internal.h coffcode.h + $(INCDIR)/coff/tic80.h $(INCDIR)/coff/internal.h coffcode.h end-sanitize-tic80: $(OFILES): stamp-picdir @@ -1017,6 +1024,10 @@ coff-sh.o: coff-sh.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h \ $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h coff-sparc.o: coff-sparc.c $(INCDIR)/coff/sparc.h $(INCDIR)/coff/internal.h \ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h +coff-stubgo32.o: coff-stubgo32.c coff-i386.c $(INCDIR)/coff/i386.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/go32exe.h \ + libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h \ + go32stub.h coff-svm68k.o: coff-svm68k.c coff-m68k.c $(INCDIR)/coff/m68k.h \ $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ coffcode.h coffswap.h diff --git a/bfd/coff-i386.c b/bfd/coff-i386.c index b6b6257639b..79b9f94f9af 100644 --- a/bfd/coff-i386.c +++ b/bfd/coff-i386.c @@ -30,6 +30,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "coff/pe.h" #endif +#ifdef COFF_GO32_EXE +#include "coff/go32exe.h" +#endif + #include "libcoff.h" static bfd_reloc_status_type coff_i386_reloc diff --git a/bfd/coff-stubgo32.c b/bfd/coff-stubgo32.c new file mode 100644 index 00000000000..7a0630d744b --- /dev/null +++ b/bfd/coff-stubgo32.c @@ -0,0 +1,463 @@ +/* BFD back-end for Intel 386 COFF files (go32 variant with a stub). + Copyright 1997 Free Software Foundation, Inc. + Written by Robert Hoehne. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* This file handles now also stubbed coff images. The stub is a small + DOS executable program before the coff image to load it in memory + and execute it. This is needed, because DOS cannot run coff files. + + All the functions below are called by the corresponding functions + from coffswap.h. + The only thing what they do is to adjust the information stored in + the COFF file which are offset into the file. + This is needed, because DJGPP uses a very special way to load and run + the coff image. It loads the image in memory and assumes then, that the + image had no stub by using the filepointers as pointers in the coff + image and NOT in the file. + + To be compatible with any existing executables I have fixed this + here and NOT in the DJGPP startup code. + */ + +#define TARGET_SYM go32stubbedcoff_vec +#define TARGET_NAME "coff-go32-exe" +#define TARGET_UNDERSCORE '_' +#define COFF_GO32_EXE + +#include "bfd.h" + +/* At first the prototypes */ + +static void +adjust_filehdr_in_post PARAMS ((bfd * abfd, PTR src, PTR dst)); +static void +adjust_filehdr_out_pre PARAMS ((bfd * abfd, PTR in, PTR out)); +static void +adjust_filehdr_out_post PARAMS ((bfd * abfd, PTR in, PTR out)); + +static void +adjust_scnhdr_in_post PARAMS ((bfd * abfd, PTR ext, PTR in)); +static void +adjust_scnhdr_out_pre PARAMS ((bfd * abfd, PTR in, PTR out)); +static void +adjust_scnhdr_out_post PARAMS ((bfd * abfd, PTR in, PTR out)); + +static void +adjust_aux_in_post PARAMS ((bfd * abfd, PTR ext1, int type, int class, int indx, + int numaux, PTR in1)); +static void +adjust_aux_out_pre PARAMS ((bfd * abfd, PTR inp, int type, int class, int indx, + int numaux, PTR extp)); +static void +adjust_aux_out_post PARAMS ((bfd * abfd, PTR inp, int type, int class, int indx, + int numaux, PTR extp)); + +static void +create_go32_stub PARAMS ((bfd * abfd)); + +/* + All that ..._PRE and ...POST functions are called from the corresponding + coff_swap... functions. The ...PRE functions are called at the beginning + of the function and the ...POST functions at the end of the swap routines. + */ + +#define COFF_ADJUST_FILEHDR_IN_POST adjust_filehdr_in_post +#define COFF_ADJUST_FILEHDR_OUT_PRE adjust_filehdr_out_pre +#define COFF_ADJUST_FILEHDR_OUT_POST adjust_filehdr_out_post + +#define COFF_ADJUST_SCNHDR_IN_POST adjust_scnhdr_in_post +#define COFF_ADJUST_SCNHDR_OUT_PRE adjust_scnhdr_out_pre +#define COFF_ADJUST_SCNHDR_OUT_POST adjust_scnhdr_out_post + +#define COFF_ADJUST_AUX_IN_POST adjust_aux_in_post +#define COFF_ADJUST_AUX_OUT_PRE adjust_aux_out_pre +#define COFF_ADJUST_AUX_OUT_POST adjust_aux_out_post + +static boolean + go32_stubbed_coff_bfd_copy_private_bfd_data PARAMS ((bfd * ibfd, bfd * obfd)); + +#define coff_bfd_copy_private_bfd_data go32_stubbed_coff_bfd_copy_private_bfd_data + +#include "coff-i386.c" + +/* I hold in the usrdata the stub */ +#define bfd_coff_go32stub bfd_usrdata + +/* This macro is used, because I cannot assume the endianess of the + host system */ +#define _H(index) (bfd_h_get_16(abfd, (bfd_byte *)(header+index*2))) + +/* This function checks if the bfd is a stubbed coff image */ +static const bfd_target * +go32_stubbed_coff_object_p (abfd) + bfd *abfd; +{ + unsigned char header[10]; + char magic[8]; + unsigned long coff_start, exe_start; + + if (bfd_read (&header, 1, sizeof (header), abfd) != sizeof (header)) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return 0; + } + if (_H (0) != 0x5a4d) /* it is not an exe file. maybe a coff-image */ + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return 0; + } + coff_start = (long) _H (2) * 512L; + if (_H (1)) + coff_start += (long) _H (1) - 512L; + + /* We can handle only a stub with a length of STUBSIZE */ + if (coff_start != STUBSIZE) + { + bfd_set_error (bfd_error_wrong_format); + return 0; + } + exe_start = _H (4) * 16; + if (bfd_seek (abfd, exe_start, SEEK_SET) != 0) + return 0; + if (bfd_read (&magic, 1, 8, abfd) != 8) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return 0; + } + if (memcmp (magic, "go32stub", 8) != 0) + { + bfd_set_error (bfd_error_wrong_format); + return 0; + } + if (bfd_seek (abfd, 0, SEEK_SET) != 0) + return 0; + + /* Call the normal COFF detection routine */ + return coff_object_p (abfd); +} + +/* These bytes are a 2048-byte DOS executable, which loads the COFF + image into memory and then runs it. It is called 'stub' */ + +static unsigned char stub_bytes[STUBSIZE] = +{ +#include "go32stub.h" +}; + +/* + I have not commented each swap function below, because the + technique is in any function the same. For the ...in function, + all the pointers are adjusted by adding STUBSIZE and for the + ...out function, it is subtracted first and after calling the + standard swap function it is reset to the old value */ + +/* This macro is used for adjusting the filepointers, which + is done only, if the pointer is nonzero */ + +#define ADJUST_VAL(val,diff) \ + if (val != 0) val += diff + +static void +adjust_filehdr_in_post (abfd, src, dst) + bfd *abfd; + PTR src; + PTR dst; +{ + FILHDR *filehdr_src = (FILHDR *) src; + struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst; + + ADJUST_VAL (filehdr_dst->f_symptr, STUBSIZE); + + /* Save now the stub to be used later */ + bfd_coff_go32stub (abfd) = (PTR) bfd_alloc (abfd, STUBSIZE); + + /* Since this function returns no status, I do not set here + any bfd_error_... + That means, before the use of bfd_coff_go32stub (), this value + should be checked if it is != NULL */ + if (bfd_coff_go32stub (abfd) == NULL) + return; + memcpy (bfd_coff_go32stub (abfd), filehdr_src->stub, STUBSIZE); +} + +static void +adjust_filehdr_out_pre (abfd, in, out) + bfd *abfd; + PTR in; + PTR out; +{ + struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in; + FILHDR *filehdr_out = (FILHDR *) out; + + /* Generate the stub */ + create_go32_stub (abfd); + + /* Copy the stub to the file header */ + if (bfd_coff_go32stub (abfd) != NULL) + memcpy (filehdr_out->stub, bfd_coff_go32stub (abfd), STUBSIZE); + else + /* use the default */ + memcpy (filehdr_out->stub, stub_bytes, STUBSIZE); + + ADJUST_VAL (filehdr_in->f_symptr, -STUBSIZE); +} + +static void +adjust_filehdr_out_post (abfd, in, out) + bfd *abfd; + PTR in; + PTR out; +{ + struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in; + /* undo the above change */ + ADJUST_VAL (filehdr_in->f_symptr, STUBSIZE); +} + +static void +adjust_scnhdr_in_post (abfd, ext, in) + bfd *abfd; + PTR ext; + PTR in; +{ + struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in; + + ADJUST_VAL (scnhdr_int->s_scnptr, STUBSIZE); + ADJUST_VAL (scnhdr_int->s_relptr, STUBSIZE); + ADJUST_VAL (scnhdr_int->s_lnnoptr, STUBSIZE); +} + +static void +adjust_scnhdr_out_pre (abfd, in, out) + bfd *abfd; + PTR in; + PTR out; +{ + struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in; + + ADJUST_VAL (scnhdr_int->s_scnptr, -STUBSIZE); + ADJUST_VAL (scnhdr_int->s_relptr, -STUBSIZE); + ADJUST_VAL (scnhdr_int->s_lnnoptr, -STUBSIZE); +} + +static void +adjust_scnhdr_out_post (abfd, in, out) + bfd *abfd; + PTR in; + PTR out; +{ + struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in; + + ADJUST_VAL (scnhdr_int->s_scnptr, STUBSIZE); + ADJUST_VAL (scnhdr_int->s_relptr, STUBSIZE); + ADJUST_VAL (scnhdr_int->s_lnnoptr, STUBSIZE); +} + +static void +adjust_aux_in_post (abfd, ext1, type, class, indx, numaux, in1) + bfd *abfd; + PTR ext1; + int type; + int class; + int indx; + int numaux; + PTR in1; +{ + union internal_auxent *in = (union internal_auxent *) in1; + + if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class)) + { + ADJUST_VAL (in->x_sym.x_fcnary.x_fcn.x_lnnoptr, STUBSIZE); + } +} + +static void +adjust_aux_out_pre (abfd, inp, type, class, indx, numaux, extp) + bfd *abfd; + PTR inp; + int type; + int class; + int indx; + int numaux; + PTR extp; +{ + union internal_auxent *in = (union internal_auxent *) inp; + + if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class)) + { + ADJUST_VAL (in->x_sym.x_fcnary.x_fcn.x_lnnoptr, -STUBSIZE); + } +} + +static void +adjust_aux_out_post (abfd, inp, type, class, indx, numaux, extp) + bfd *abfd; + PTR inp; + int type; + int class; + int indx; + int numaux; + PTR extp; +{ + union internal_auxent *in = (union internal_auxent *) inp; + + if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class)) + { + ADJUST_VAL (in->x_sym.x_fcnary.x_fcn.x_lnnoptr, STUBSIZE); + } +} + +/* + That's the function, which creates the stub. There are + different cases from where the stub is taken. + At first the environment variable $(GO32STUB) is checked and then + $(STUB) if it was not set. + If it exists and points to a valid stub the stub is taken from + that file. This file can be also a whole executable file, because + the stub is computed from the exe information at the start of that + file. + + If there was any error, the standard stub (compiled in this file) + is taken. + */ + +static void +create_go32_stub (abfd) + bfd *abfd; +{ + /* Do it only once */ + if (bfd_coff_go32stub (abfd) == NULL) + { + char *stub; + struct stat st; + int f; + unsigned char header[10]; + char magic[8]; + unsigned long coff_start, exe_start; + + /* Check at first the environment variable $(GO32STUB) */ + stub = getenv ("GO32STUB"); + /* Now check the environment variable $(STUB) */ + if (stub == NULL) + stub = getenv ("STUB"); + if (stub == NULL) + goto stub_end; + if (stat (stub, &st) != 0) + goto stub_end; +#ifdef O_BINARY + f = open (stub, O_RDONLY | O_BINARY); +#else + f = open (stub, O_RDONLY); +#endif + if (f < 0) + goto stub_end; + if (read (f, &header, sizeof (header)) < 0) + { + close (f); + goto stub_end; + } + if (_H (0) != 0x5a4d) /* it is not an exe file */ + { + close (f); + goto stub_end; + } + /* Compute the size of the stub (it is every thing up + to the beginning of the coff image) */ + coff_start = (long) _H (2) * 512L; + if (_H (1)) + coff_start += (long) _H (1) - 512L; + + /* Currently there is only a fixed stub size of 2048 bytes + supported */ + if (coff_start != 2048) + { + close (f); + goto stub_end; + } + exe_start = _H (4) * 16; + if (lseek (f, exe_start, SEEK_SET) != exe_start) + { + close (f); + goto stub_end; + } + if (read (f, &magic, 8) != 8) + { + close (f); + goto stub_end; + } + if (memcmp (magic, "go32stub", 8) != 0) + { + close (f); + goto stub_end; + } + /* Now we found a correct stub (hopefully) */ + bfd_coff_go32stub (abfd) = (PTR) bfd_alloc (abfd, coff_start); + if (bfd_coff_go32stub (abfd) == NULL) + { + close (f); + return; + } + lseek (f, 0L, SEEK_SET); + if (read (f, bfd_coff_go32stub (abfd), coff_start) != coff_start) + { + bfd_release (abfd, bfd_coff_go32stub (abfd)); + bfd_coff_go32stub (abfd) = NULL; + } + close (f); + } +stub_end: + /* There was something wrong above, so use now the standard builtin + stub */ + if (bfd_coff_go32stub (abfd) == NULL) + { + bfd_coff_go32stub (abfd) = (PTR) bfd_alloc (abfd, STUBSIZE); + if (bfd_coff_go32stub (abfd) == NULL) + { + return; + } + + memcpy (bfd_coff_go32stub (abfd), stub_bytes, STUBSIZE); + } +} + +/* If ibfd was a stubbed coff image, copy the stub from that bfd + to the new obfd. + */ + +static boolean +go32_stubbed_coff_bfd_copy_private_bfd_data (ibfd, obfd) + bfd *ibfd; + bfd *obfd; +{ + /* check if both are the same targets */ + if (ibfd->xvec != obfd->xvec) + return true; + + /* check if both have a valid stub */ + if (bfd_coff_go32stub (ibfd) == NULL + || bfd_coff_go32stub (obfd) == NULL) + return true; + + /* Now copy the stub */ + memcpy (bfd_coff_go32stub (obfd), bfd_coff_go32stub (ibfd), STUBSIZE); + + return true; +} diff --git a/bfd/configure b/bfd/configure index 0adee2ad141..e587ebff1ac 100755 --- a/bfd/configure +++ b/bfd/configure @@ -2057,6 +2057,8 @@ do ecoff_biglittle_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;; ecoffalpha_little_vec) tb="$tb coff-alpha.o ecoff.o ecofflink.o" target64=true ;; + go32coff_vec) tb="$tb coff-go32.o cofflink.o" ;; + go32stubbedcoff_vec) tb="$tb coff-stubgo32.o cofflink.o" ;; evax_alpha_vec) tb="$tb evax-alpha.o evax-emh.o evax-egsd.o evax-etir.o evax-misc.o" target64=true ;; h8300coff_vec) tb="$tb coff-h8300.o reloc16.o" ;; @@ -2209,17 +2211,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2213: checking for $ac_hdr" >&5 +echo "configure:2215: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2223: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2225: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2248,12 +2250,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2252: checking for $ac_func" >&5 +echo "configure:2254: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2282: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2301,7 +2303,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:2305: checking for working mmap" >&5 +echo "configure:2307: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2309,7 +2311,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -2474,12 +2476,12 @@ fi for ac_func in madvise mprotect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2478: checking for $ac_func" >&5 +echo "configure:2480: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else diff --git a/bfd/configure.in b/bfd/configure.in index 6315d93d23a..9cb877b02aa 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -484,6 +484,8 @@ do ecoff_biglittle_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;; ecoffalpha_little_vec) tb="$tb coff-alpha.o ecoff.o ecofflink.o" target64=true ;; + go32coff_vec) tb="$tb coff-go32.o cofflink.o" ;; + go32stubbedcoff_vec) tb="$tb coff-stubgo32.o cofflink.o" ;; evax_alpha_vec) tb="$tb evax-alpha.o evax-emh.o evax-egsd.o evax-etir.o evax-misc.o" target64=true ;; h8300coff_vec) tb="$tb coff-h8300.o reloc16.o" ;; diff --git a/bfd/go32stub.h b/bfd/go32stub.h new file mode 100644 index 00000000000..3e4388c087b --- /dev/null +++ b/bfd/go32stub.h @@ -0,0 +1,128 @@ +0x4d,0x5a,0x00,0x00,0x04,0x00,0x00,0x00,0x20,0x00,0x27,0x00,0xff,0xff,0x00,0x00, +0x60,0x07,0x00,0x00,0x54,0x00,0x00,0x00,0x0d,0x0a,0x73,0x74,0x75,0x62,0x2e,0x68, +0x20,0x67,0x65,0x6e,0x65,0x72,0x61,0x74,0x65,0x64,0x20,0x66,0x72,0x6f,0x6d,0x20, +0x73,0x74,0x75,0x62,0x2e,0x61,0x73,0x6d,0x20,0x62,0x79,0x20,0x64,0x6a,0x61,0x73, +0x6d,0x2c,0x20,0x6f,0x6e,0x20,0x57,0x65,0x64,0x20,0x4a,0x75,0x6e,0x20,0x31,0x31, +0x20,0x31,0x36,0x3a,0x30,0x39,0x3a,0x31,0x35,0x20,0x31,0x39,0x39,0x37,0x0d,0x0a, +0x54,0x68,0x65,0x20,0x53,0x54,0x55,0x42,0x2e,0x45,0x58,0x45,0x20,0x73,0x74,0x75, +0x62,0x20,0x6c,0x6f,0x61,0x64,0x65,0x72,0x20,0x69,0x73,0x20,0x43,0x6f,0x70,0x79, +0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x43,0x29,0x20,0x31,0x39,0x39,0x33,0x2d,0x31, +0x39,0x39,0x35,0x20,0x44,0x4a,0x20,0x44,0x65,0x6c,0x6f,0x72,0x69,0x65,0x2e,0x20, +0x0d,0x0a,0x50,0x65,0x72,0x6d,0x69,0x73,0x73,0x69,0x6f,0x6e,0x20,0x67,0x72,0x61, +0x6e,0x74,0x65,0x64,0x20,0x74,0x6f,0x20,0x75,0x73,0x65,0x20,0x66,0x6f,0x72,0x20, +0x61,0x6e,0x79,0x20,0x70,0x75,0x72,0x70,0x6f,0x73,0x65,0x20,0x70,0x72,0x6f,0x76, +0x69,0x64,0x65,0x64,0x20,0x74,0x68,0x69,0x73,0x20,0x63,0x6f,0x70,0x79,0x72,0x69, +0x67,0x68,0x74,0x20,0x0d,0x0a,0x72,0x65,0x6d,0x61,0x69,0x6e,0x73,0x20,0x70,0x72, +0x65,0x73,0x65,0x6e,0x74,0x20,0x61,0x6e,0x64,0x20,0x75,0x6e,0x6d,0x6f,0x64,0x69, +0x66,0x69,0x65,0x64,0x2e,0x20,0x0d,0x0a,0x54,0x68,0x69,0x73,0x20,0x6f,0x6e,0x6c, +0x79,0x20,0x61,0x70,0x70,0x6c,0x69,0x65,0x73,0x20,0x74,0x6f,0x20,0x74,0x68,0x65, +0x20,0x73,0x74,0x75,0x62,0x2c,0x20,0x61,0x6e,0x64,0x20,0x6e,0x6f,0x74,0x20,0x6e, +0x65,0x63,0x63,0x65,0x73,0x73,0x61,0x72,0x69,0x6c,0x79,0x20,0x74,0x68,0x65,0x20, +0x77,0x68,0x6f,0x6c,0x65,0x20,0x70,0x72,0x6f,0x67,0x72,0x61,0x6d,0x2e,0x0a,0x0d, +0x0a,0x24,0x49,0x64,0x3a,0x20,0x73,0x74,0x75,0x62,0x2e,0x61,0x73,0x6d,0x20,0x62, +0x75,0x69,0x6c,0x74,0x20,0x30,0x36,0x2f,0x31,0x31,0x2f,0x39,0x37,0x20,0x31,0x36, +0x3a,0x30,0x39,0x3a,0x31,0x35,0x20,0x62,0x79,0x20,0x64,0x6a,0x61,0x73,0x6d,0x20, +0x24,0x0a,0x0d,0x0a,0x40,0x28,0x23,0x29,0x20,0x73,0x74,0x75,0x62,0x2e,0x61,0x73, +0x6d,0x20,0x62,0x75,0x69,0x6c,0x74,0x20,0x30,0x36,0x2f,0x31,0x31,0x2f,0x39,0x37, +0x20,0x31,0x36,0x3a,0x30,0x39,0x3a,0x31,0x35,0x20,0x62,0x79,0x20,0x64,0x6a,0x61, +0x73,0x6d,0x0a,0x0d,0x0a,0x1a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x67,0x6f,0x33,0x32,0x73,0x74,0x75,0x62,0x2c,0x20,0x76,0x20,0x32,0x2e,0x30,0x30, +0x54,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x43,0x57,0x53,0x44,0x50,0x4d,0x49,0x2e,0x45,0x58,0x45,0x00, +0x00,0x00,0x00,0x00,0x0e,0x1f,0x8c,0x1e,0x24,0x00,0x8c,0x06,0x60,0x07,0xfc,0xb4, +0x30,0xcd,0x21,0x3c,0x03,0x73,0x06,0xba,0x86,0x05,0xe9,0xb2,0x03,0xa2,0x69,0x08, +0xbb,0x70,0x08,0xa1,0x20,0x00,0x39,0xc3,0x73,0x02,0x89,0xc3,0x89,0x1e,0x20,0x00, +0xfe,0xc7,0xb9,0x04,0xff,0xd3,0xeb,0xb4,0x4a,0xcd,0x21,0x73,0x0a,0xd3,0xe3,0xfe, +0xcf,0x89,0x1e,0x20,0x00,0xeb,0xd9,0x26,0x8e,0x06,0x2c,0x00,0x31,0xff,0x30,0xc0, +0xa9,0xf2,0xae,0x26,0x81,0x3d,0x50,0x41,0x75,0x15,0xaf,0x26,0x81,0x3d,0x54,0x48, +0x75,0x0d,0xaf,0x26,0x80,0x3d,0x3d,0x75,0x06,0x47,0x89,0x3e,0x67,0x04,0x4f,0xae, +0x75,0xdf,0xaf,0x06,0x57,0x31,0xc9,0x74,0x10,0xba,0x5d,0x05,0xe9,0x50,0x03,0x09, +0xc9,0x75,0xf6,0x41,0xe8,0x92,0x03,0x72,0xf0,0xb8,0x87,0x16,0xcd,0x2f,0x09,0xc0, +0x75,0xed,0x80,0xe3,0x01,0x74,0xe8,0x89,0x3e,0x00,0x06,0x8c,0x06,0x02,0x06,0x89, +0x36,0x04,0x06,0x5f,0x07,0xe8,0xd5,0x02,0x89,0x3e,0x2a,0x00,0x89,0x36,0x62,0x07, +0x80,0x3e,0x2c,0x00,0x00,0x74,0x24,0xb9,0x08,0x00,0xbf,0x2c,0x00,0x8a,0x05,0x47, +0x08,0xc0,0x74,0x05,0x88,0x07,0x43,0xe2,0xf4,0x66,0xc7,0x07,0x2e,0x45,0x58,0x45, +0x81,0xc3,0x04,0x00,0xc6,0x07,0x00,0x89,0x1e,0x62,0x07,0xb8,0x00,0x3d,0xba,0x64, +0x07,0xcd,0x21,0x0f,0x82,0xb4,0x02,0xa3,0x06,0x06,0x89,0xc3,0xb9,0x06,0x00,0xba, +0xb5,0x07,0xb4,0x3f,0xcd,0x21,0x31,0xd2,0x31,0xc9,0xa1,0xb5,0x07,0x3d,0x4c,0x01, +0x74,0x1b,0x3d,0x4d,0x5a,0x0f,0x85,0x97,0x02,0x8b,0x16,0xb9,0x07,0xc1,0xe2,0x09, +0x8b,0x1e,0xb7,0x07,0x09,0xdb,0x74,0x05,0x80,0xee,0x02,0x01,0xda,0x89,0x16,0xbb, +0x07,0x89,0x0e,0xbd,0x07,0xb8,0x00,0x42,0x8b,0x1e,0x06,0x06,0xcd,0x21,0xb9,0xa8, +0x00,0xba,0xbf,0x07,0xb4,0x3f,0xcd,0x21,0x3d,0xa8,0x00,0x75,0x06,0x81,0x3e,0xbf, +0x07,0x4c,0x01,0x0f,0x85,0x5e,0x02,0x66,0xa1,0xe3,0x07,0x66,0xa3,0x10,0x06,0x66, +0x8b,0x0e,0xbb,0x07,0x66,0xa1,0x03,0x08,0x66,0x01,0xc8,0x66,0xa3,0x08,0x06,0x66, +0xa1,0x2b,0x08,0x66,0x01,0xc8,0x66,0xa3,0x0c,0x06,0x66,0x8b,0x1e,0x4b,0x08,0x66, +0xa1,0x4f,0x08,0x66,0x01,0xc3,0x66,0xb8,0x01,0x00,0x01,0x00,0x66,0x39,0xc3,0x73, +0x03,0x66,0x89,0xc3,0x66,0x81,0xc3,0xff,0xff,0x00,0x00,0x31,0xdb,0x66,0x89,0x1e, +0x1c,0x00,0xe8,0xe8,0x02,0x8b,0x1e,0x04,0x06,0x09,0xdb,0x74,0x0a,0xb4,0x48,0xcd, +0x21,0x0f,0x82,0x10,0x02,0x8e,0xc0,0xe8,0xfb,0x02,0xb8,0x01,0x00,0xff,0x1e,0x00, +0x06,0x0f,0x82,0x08,0x02,0x8c,0x06,0x26,0x00,0x8c,0x0e,0x28,0x00,0x8c,0xd8,0xa3, +0x22,0x00,0x8e,0xc0,0x31,0xc0,0xb9,0x01,0x00,0xcd,0x31,0x72,0x07,0xa3,0x14,0x06, +0x31,0xc0,0xcd,0x31,0x0f,0x82,0xea,0x01,0xa3,0x16,0x06,0x66,0x8b,0x0e,0x1c,0x00, +0xb8,0x01,0x05,0x8b,0x1e,0x1e,0x00,0xcd,0x31,0x0f,0x82,0xda,0x01,0x89,0x1e,0x1a, +0x06,0x89,0x0e,0x18,0x06,0x89,0x36,0x1a,0x00,0x89,0x3e,0x18,0x00,0xb8,0x07,0x00, +0x8b,0x1e,0x14,0x06,0x8b,0x0e,0x1a,0x06,0x8b,0x16,0x18,0x06,0xcd,0x31,0xb8,0x09, +0x00,0x8c,0xc9,0x81,0xe1,0x03,0x00,0xc1,0xe1,0x05,0x51,0x81,0xc9,0x9b,0xc0,0xcd, +0x31,0xb8,0x08,0x00,0x8b,0x0e,0x1e,0x00,0x49,0xba,0xff,0xff,0xcd,0x31,0xb8,0x07, +0x00,0x8b,0x1e,0x16,0x06,0x8b,0x0e,0x1a,0x06,0x8b,0x16,0x18,0x06,0xcd,0x31,0xb8, +0x09,0x00,0x59,0x81,0xc9,0x93,0xc0,0xcd,0x31,0xb8,0x08,0x00,0x8b,0x0e,0x1e,0x00, +0x49,0xba,0xff,0xff,0xcd,0x31,0xb8,0x00,0x01,0xbb,0x00,0x0f,0xcd,0x31,0x73,0x10, +0x3d,0x08,0x00,0x0f,0x85,0x65,0x01,0xb8,0x00,0x01,0xcd,0x31,0x0f,0x82,0x5c,0x01, +0xa3,0x1c,0x06,0x89,0x16,0x1e,0x06,0xc1,0xe3,0x04,0x89,0x1e,0x20,0x06,0x66,0x8b, +0x36,0x08,0x06,0x66,0x8b,0x3e,0xfb,0x07,0x66,0x8b,0x0e,0xff,0x07,0xe8,0x49,0x00, +0x66,0x8b,0x36,0x0c,0x06,0x66,0x8b,0x3e,0x23,0x08,0x66,0x8b,0x0e,0x27,0x08,0xe8, +0x37,0x00,0x8e,0x06,0x16,0x06,0x66,0x8b,0x3e,0x4b,0x08,0x66,0x8b,0x0e,0x4f,0x08, +0x66,0x31,0xc0,0x66,0xc1,0xe9,0x02,0x67,0xf3,0x66,0xab,0xb4,0x3e,0x8b,0x1e,0x06, +0x06,0xcd,0x21,0xb8,0x01,0x01,0x8b,0x16,0x1e,0x06,0xcd,0x31,0x1e,0x0f,0xa1,0x8e, +0x1e,0x16,0x06,0x66,0x64,0xff,0x2e,0x10,0x06,0x66,0x89,0xf0,0x66,0x25,0xff,0x01, +0x00,0x00,0x66,0x01,0xc1,0x29,0xc6,0x66,0x29,0xc7,0x66,0x89,0x0e,0x26,0x06,0x66, +0x89,0x3e,0x22,0x06,0xe8,0xfe,0x00,0x89,0x36,0x3e,0x06,0x66,0xc1,0xee,0x10,0x89, +0x36,0x42,0x06,0x8b,0x1e,0x06,0x06,0x89,0x1e,0x3a,0x06,0xc7,0x06,0x46,0x06,0x00, +0x42,0xe8,0xf2,0x00,0xa1,0x1c,0x06,0xa3,0x4e,0x06,0xc7,0x06,0x3e,0x06,0x00,0x00, +0xc6,0x06,0x47,0x06,0x3f,0xa1,0x28,0x06,0x09,0xc0,0x75,0x09,0xa1,0x26,0x06,0x3b, +0x06,0x20,0x06,0x76,0x03,0xa1,0x20,0x06,0xa3,0x42,0x06,0xe8,0xc8,0x00,0x66,0x31, +0xc9,0x8b,0x0e,0x46,0x06,0x66,0x8b,0x3e,0x22,0x06,0x66,0x01,0x0e,0x22,0x06,0x66, +0x29,0x0e,0x26,0x06,0x66,0x31,0xf6,0xc1,0xe9,0x02,0x1e,0x06,0x8e,0x06,0x16,0x06, +0x8e,0x1e,0x1e,0x06,0x67,0xf3,0x66,0xa5,0x07,0x1f,0x66,0x03,0x0e,0x26,0x06,0x75, +0xaf,0xc3,0x3c,0x3a,0x74,0x06,0x3c,0x2f,0x74,0x02,0x3c,0x5c,0xc3,0xbe,0x64,0x07, +0x89,0xf3,0x26,0x8a,0x05,0x47,0x88,0x04,0x38,0xe0,0x74,0x0e,0x08,0xc0,0x74,0x0a, +0x46,0xe8,0xde,0xff,0x75,0xec,0x89,0xf3,0x74,0xe8,0xc3,0xba,0x26,0x05,0xeb,0x08, +0xba,0x34,0x05,0xeb,0x03,0xba,0x3e,0x05,0x52,0x8b,0x1e,0x62,0x07,0xc6,0x07,0x24, +0xbb,0x64,0x07,0xeb,0x1e,0xe8,0xed,0x00,0xba,0x78,0x05,0xeb,0x12,0xba,0x91,0x05, +0xeb,0x0d,0xba,0xa3,0x05,0xeb,0x08,0xba,0xb5,0x05,0xeb,0x03,0xba,0x78,0x05,0x52, +0xbb,0x19,0x05,0xe8,0x14,0x00,0x5b,0xe8,0x10,0x00,0xbb,0x42,0x04,0xe8,0x0a,0x00, +0xb8,0xff,0x4c,0xcd,0x21,0x43,0xb4,0x02,0xcd,0x21,0x8a,0x17,0x80,0xfa,0x24,0x75, +0xf4,0xc3,0x0d,0x0a,0x24,0x50,0x51,0x57,0x31,0xc0,0xbf,0x2a,0x06,0xb9,0x19,0x00, +0xf3,0xab,0x5f,0x59,0x58,0xc3,0xb8,0x00,0x03,0xbb,0x21,0x00,0x31,0xc9,0x66,0xbf, +0x2a,0x06,0x00,0x00,0xcd,0x31,0xc3,0x00,0x00,0x30,0xe4,0xe8,0x5f,0xff,0x89,0xde, +0x8b,0x3e,0x67,0x04,0xeb,0x18,0xb4,0x3b,0xe8,0x52,0xff,0x81,0xfe,0x64,0x07,0x74, +0x13,0x8a,0x84,0xff,0xff,0xe8,0x3a,0xff,0x74,0x04,0xc6,0x04,0x5c,0x46,0xe8,0x03, +0x00,0x72,0xe3,0xc3,0xe8,0x36,0x00,0xbb,0x44,0x00,0x8a,0x07,0x88,0x04,0x43,0x46, +0x08,0xc0,0x75,0xf6,0x06,0x57,0x1e,0x07,0xe8,0x9a,0xff,0xbb,0x2a,0x06,0x8c,0x9f, +0x04,0x00,0x89,0x9f,0x02,0x00,0xba,0x64,0x07,0xb8,0x00,0x4b,0xcd,0x21,0x5f,0x07, +0x72,0x09,0xb4,0x4d,0xcd,0x21,0x2d,0x00,0x03,0xf7,0xd8,0xeb,0x28,0x80,0x3e,0x69, +0x08,0x05,0x72,0x20,0xb8,0x00,0x58,0xcd,0x21,0xa2,0x67,0x08,0xb8,0x02,0x58,0xcd, +0x21,0xa2,0x68,0x08,0xb8,0x01,0x58,0xbb,0x80,0x00,0xcd,0x21,0xb8,0x03,0x58,0xbb, +0x01,0x00,0xcd,0x21,0xc3,0x9c,0x80,0x3e,0x69,0x08,0x05,0x72,0x1a,0x50,0x53,0xb8, +0x03,0x58,0x8a,0x1e,0x68,0x08,0x30,0xff,0xcd,0x21,0xb8,0x01,0x58,0x8a,0x1e,0x67, +0x08,0x30,0xff,0xcd,0x21,0x5b,0x58,0x9d,0xc3,0x4c,0x6f,0x61,0x64,0x20,0x65,0x72, +0x72,0x6f,0x72,0x3a,0x20,0x24,0x3a,0x20,0x63,0x61,0x6e,0x6e,0x6f,0x74,0x20,0x6f, +0x70,0x65,0x6e,0x24,0x3a,0x20,0x6e,0x6f,0x74,0x20,0x45,0x58,0x45,0x24,0x3a,0x20, +0x6e,0x6f,0x74,0x20,0x43,0x4f,0x46,0x46,0x20,0x28,0x43,0x68,0x65,0x63,0x6b,0x20, +0x66,0x6f,0x72,0x20,0x76,0x69,0x72,0x75,0x73,0x65,0x73,0x29,0x24,0x6e,0x6f,0x20, +0x44,0x50,0x4d,0x49,0x20,0x2d,0x20,0x47,0x65,0x74,0x20,0x63,0x73,0x64,0x70,0x6d, +0x69,0x2a,0x62,0x2e,0x7a,0x69,0x70,0x24,0x6e,0x6f,0x20,0x44,0x4f,0x53,0x20,0x6d, +0x65,0x6d,0x6f,0x72,0x79,0x24,0x6e,0x65,0x65,0x64,0x20,0x44,0x4f,0x53,0x20,0x33, +0x24,0x63,0x61,0x6e,0x27,0x74,0x20,0x73,0x77,0x69,0x74,0x63,0x68,0x20,0x6d,0x6f, +0x64,0x65,0x24,0x6e,0x6f,0x20,0x44,0x50,0x4d,0x49,0x20,0x73,0x65,0x6c,0x65,0x63, +0x74,0x6f,0x72,0x73,0x24,0x6e,0x6f,0x20,0x44,0x50,0x4d,0x49,0x20,0x6d,0x65,0x6d, +0x6f,0x72,0x79,0x24,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90, +0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90, +0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90, +0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90 -- 2.30.2