* configure.in: Add xcofflink.o to pmac_xcoff_vec.
* configure: Rebuild. * mpw-config.in: Add xcofflink.c.o to powerpc-apple-macos. * coff-pmac.c: Include coff-rs6000.c instead of duplicating its contents. (pmac_xcoff_vec): Update to use new xcoff support. * coff-rs6000.c (xcoff_generic_stat_arch_elt): Make static. (xcoff_write_armap): Declare buf as unsigned char. * xcofflink.c (xcoff_link_add_symbols): Declare a local as PTR. * mpw-make.sed: Generalize subdir_do edit.
This commit is contained in:
parent
fe5cfadd42
commit
aadf04f736
8 changed files with 3015 additions and 41 deletions
|
@ -1,3 +1,17 @@
|
|||
Tue Oct 24 17:44:20 1995 Stan Shebs <shebs@andros.cygnus.com>
|
||||
|
||||
* configure.in: Add xcofflink.o to pmac_xcoff_vec.
|
||||
* configure: Rebuild.
|
||||
* mpw-config.in: Add xcofflink.c.o to powerpc-apple-macos.
|
||||
* coff-pmac.c: Include coff-rs6000.c instead of duplicating its
|
||||
contents.
|
||||
(pmac_xcoff_vec): Update to use new xcoff support.
|
||||
* coff-rs6000.c (xcoff_generic_stat_arch_elt): Make static.
|
||||
(xcoff_write_armap): Declare buf as unsigned char.
|
||||
* xcofflink.c (xcoff_link_add_symbols): Declare a local as PTR.
|
||||
|
||||
* mpw-make.sed: Generalize subdir_do edit.
|
||||
|
||||
Tue Oct 24 10:25:01 1995 Jeffrey A Law (law@cygnus.com)
|
||||
|
||||
* hppabsd-core.c (make_bfd_asection): Initialize asect->filepos
|
||||
|
|
79
bfd/coff-pmac.c
Normal file
79
bfd/coff-pmac.c
Normal file
|
@ -0,0 +1,79 @@
|
|||
/* BFD back-end for Apple et al PowerPC Mac "XCOFF" files.
|
||||
Copyright 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
FIXME: Can someone provide a transliteration of this name into ASCII?
|
||||
Using the following chars caused a compiler warning on HIUX (so I replaced
|
||||
them with octal escapes), and isn't useful without an understanding of what
|
||||
character set it is.
|
||||
Written by Metin G. Ozisik, Mimi Ph\373\364ng-Th\345o V\365,
|
||||
and John Gilmore.
|
||||
Contributed by IBM Corporation and Cygnus Support.
|
||||
|
||||
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. */
|
||||
|
||||
/* (eventually lose this) */
|
||||
/* coffcode.h modifies itself based on this flag. */
|
||||
#define RS6000COFF_C 1
|
||||
|
||||
/* Tweak coffcode.h based on this being a PowerMac instead of RS/6000. */
|
||||
|
||||
#define POWERMAC
|
||||
|
||||
#include "coff-rs6000.c"
|
||||
|
||||
|
||||
const bfd_target pmac_xcoff_vec =
|
||||
{
|
||||
"xcoff-powermac", /* name */
|
||||
bfd_target_coff_flavour,
|
||||
true, /* data byte order is big */
|
||||
true, /* header byte order is big */
|
||||
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG | DYNAMIC |
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
0, /* leading char */
|
||||
'/', /* ar_pad_char */
|
||||
15, /* ar_max_namelen??? FIXMEmgo */
|
||||
|
||||
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
||||
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
||||
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
|
||||
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
||||
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
||||
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
|
||||
|
||||
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
xcoff_archive_p, _bfd_dummy_target},
|
||||
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
|
||||
bfd_false},
|
||||
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
||||
xcoff_write_archive_contents, bfd_false},
|
||||
|
||||
BFD_JUMP_TABLE_GENERIC (coff),
|
||||
BFD_JUMP_TABLE_COPY (coff),
|
||||
BFD_JUMP_TABLE_CORE (_bfd_nocore),
|
||||
BFD_JUMP_TABLE_ARCHIVE (xcoff),
|
||||
BFD_JUMP_TABLE_SYMBOLS (coff),
|
||||
BFD_JUMP_TABLE_RELOCS (coff),
|
||||
BFD_JUMP_TABLE_WRITE (coff),
|
||||
BFD_JUMP_TABLE_LINK (_bfd_xcoff),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
|
||||
COFF_SWAP_TABLE,
|
||||
};
|
|
@ -36,6 +36,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
#include "coff/rs6000.h"
|
||||
#include "libcoff.h"
|
||||
|
||||
/* The main body of code is in coffcode.h. */
|
||||
|
||||
static boolean xcoff_mkobject PARAMS ((bfd *));
|
||||
static boolean xcoff_copy_private_bfd_data PARAMS ((bfd *, bfd *));
|
||||
static void xcoff_rtype2howto
|
||||
PARAMS ((arelent *, struct internal_reloc *));
|
||||
static reloc_howto_type *xcoff_reloc_type_lookup
|
||||
PARAMS ((bfd *, bfd_reloc_code_real_type));
|
||||
static boolean xcoff_slurp_armap PARAMS ((bfd *));
|
||||
static const bfd_target *xcoff_archive_p PARAMS ((bfd *));
|
||||
static PTR xcoff_read_ar_hdr PARAMS ((bfd *));
|
||||
|
@ -45,18 +53,72 @@ static const char *normalize_filename PARAMS ((bfd *));
|
|||
static boolean xcoff_write_armap
|
||||
PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
|
||||
static boolean xcoff_write_archive_contents PARAMS ((bfd *));
|
||||
|
||||
/* We use our own tdata type. Its first field is the COFF tdata type,
|
||||
so the COFF routines are compatible. */
|
||||
|
||||
/* The main body of code is in coffcode.h. */
|
||||
static boolean
|
||||
xcoff_mkobject (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
coff_data_type *coff;
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
|
||||
abfd->tdata.xcoff_obj_data =
|
||||
((struct xcoff_tdata *)
|
||||
bfd_zalloc (abfd, sizeof (struct xcoff_tdata)));
|
||||
if (abfd->tdata.xcoff_obj_data == NULL)
|
||||
{
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return false;
|
||||
}
|
||||
coff = coff_data (abfd);
|
||||
coff->symbols = (coff_symbol_type *) NULL;
|
||||
coff->conversion_table = (unsigned int *) NULL;
|
||||
coff->raw_syments = (struct coff_ptr_struct *) NULL;
|
||||
coff->relocbase = 0;
|
||||
|
||||
xcoff_data (abfd)->modtype = ('1' << 8) | 'L';
|
||||
|
||||
/* We set cputype to -1 to indicate that it has not been
|
||||
initialized. */
|
||||
xcoff_data (abfd)->cputype = -1;
|
||||
|
||||
xcoff_data (abfd)->csects = NULL;
|
||||
xcoff_data (abfd)->debug_indices = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Copy XCOFF data from one BFD to another. */
|
||||
|
||||
static boolean
|
||||
xcoff_copy_private_bfd_data (ibfd, obfd)
|
||||
bfd *ibfd;
|
||||
bfd *obfd;
|
||||
{
|
||||
struct xcoff_tdata *ix, *ox;
|
||||
|
||||
if (ibfd->xvec != obfd->xvec)
|
||||
return true;
|
||||
ix = xcoff_data (ibfd);
|
||||
ox = xcoff_data (obfd);
|
||||
ox->toc = ix->toc;
|
||||
ox->text_align_power = ix->text_align_power;
|
||||
ox->data_align_power = ix->data_align_power;
|
||||
ox->modtype = ix->modtype;
|
||||
ox->cputype = ix->cputype;
|
||||
ox->maxdata = ix->maxdata;
|
||||
ox->maxstack = ix->maxstack;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* The XCOFF reloc table. Actually, XCOFF relocations specify the
|
||||
bitsize and whether they are signed or not, along with a
|
||||
conventional type. This table is for the types, which are used for
|
||||
different algorithms for putting in the reloc. Many of these
|
||||
relocs need special_function entries, which I have not written. */
|
||||
|
||||
static reloc_howto_type rs6000coff_howto_table[] =
|
||||
static reloc_howto_type xcoff_howto_table[] =
|
||||
{
|
||||
/* Standard 32 bit relocation. */
|
||||
HOWTO (0, /* type */
|
||||
|
@ -110,7 +172,7 @@ static reloc_howto_type rs6000coff_howto_table[] =
|
|||
16, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
0, /* special_function */
|
||||
"R_TOC", /* name */
|
||||
true, /* partial_inplace */
|
||||
|
@ -400,17 +462,12 @@ static reloc_howto_type rs6000coff_howto_table[] =
|
|||
false) /* pcrel_offset */
|
||||
};
|
||||
|
||||
#define RTYPE2HOWTO(cache_ptr, dst) rs6000coff_rtype2howto (cache_ptr, dst)
|
||||
|
||||
static void rs6000coff_rtype2howto PARAMS ((arelent *,
|
||||
struct internal_reloc *));
|
||||
|
||||
static void
|
||||
rs6000coff_rtype2howto (relent, internal)
|
||||
xcoff_rtype2howto (relent, internal)
|
||||
arelent *relent;
|
||||
struct internal_reloc *internal;
|
||||
{
|
||||
relent->howto = rs6000coff_howto_table + internal->r_type;
|
||||
relent->howto = xcoff_howto_table + internal->r_type;
|
||||
|
||||
/* The r_size field of an XCOFF reloc encodes the bitsize of the
|
||||
relocation, as well as indicating whether it is signed or not.
|
||||
|
@ -426,26 +483,21 @@ rs6000coff_rtype2howto (relent, internal)
|
|||
#endif
|
||||
}
|
||||
|
||||
#define coff_bfd_reloc_type_lookup rs6000coff_reloc_type_lookup
|
||||
|
||||
static reloc_howto_type *rs6000coff_reloc_type_lookup
|
||||
PARAMS ((bfd *, bfd_reloc_code_real_type));
|
||||
|
||||
static reloc_howto_type *
|
||||
rs6000coff_reloc_type_lookup (abfd, code)
|
||||
xcoff_reloc_type_lookup (abfd, code)
|
||||
bfd *abfd;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
case BFD_RELOC_PPC_B26:
|
||||
return &rs6000coff_howto_table[0xa];
|
||||
return &xcoff_howto_table[0xa];
|
||||
case BFD_RELOC_PPC_BA26:
|
||||
return &rs6000coff_howto_table[8];
|
||||
return &xcoff_howto_table[8];
|
||||
case BFD_RELOC_PPC_TOC16:
|
||||
return &rs6000coff_howto_table[3];
|
||||
return &xcoff_howto_table[3];
|
||||
case BFD_RELOC_32:
|
||||
return &rs6000coff_howto_table[0];
|
||||
return &xcoff_howto_table[0];
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
@ -460,9 +512,18 @@ rs6000coff_reloc_type_lookup (abfd, code)
|
|||
: 0) \
|
||||
| (howto->bitsize - 1)); \
|
||||
}
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
|
||||
|
||||
#define COFF_LONG_FILENAMES
|
||||
|
||||
#define RTYPE2HOWTO(cache_ptr, dst) xcoff_rtype2howto (cache_ptr, dst)
|
||||
|
||||
#define coff_mkobject xcoff_mkobject
|
||||
#define coff_bfd_copy_private_bfd_data xcoff_copy_private_bfd_data
|
||||
#define coff_bfd_reloc_type_lookup xcoff_reloc_type_lookup
|
||||
#define coff_relocate_section _bfd_ppc_xcoff_relocate_section
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
/* XCOFF archive support. The original version of this code was by
|
||||
|
@ -826,7 +887,7 @@ xcoff_openr_next_archived_file (archive, last_file)
|
|||
|
||||
/* Stat an element in an XCOFF archive. */
|
||||
|
||||
int
|
||||
static int
|
||||
xcoff_generic_stat_arch_elt (abfd, s)
|
||||
bfd *abfd;
|
||||
struct stat *s;
|
||||
|
@ -881,7 +942,7 @@ xcoff_write_armap (abfd, elength, map, orl_count, stridx)
|
|||
{
|
||||
struct xcoff_ar_hdr hdr;
|
||||
char *p;
|
||||
char buf[4];
|
||||
unsigned char buf[4];
|
||||
bfd *sub;
|
||||
file_ptr fileoff;
|
||||
unsigned int i;
|
||||
|
@ -1262,6 +1323,12 @@ extern int lynx_core_file_failing_signal PARAMS ((bfd *abfd));
|
|||
|
||||
#endif /* LYNX_CORE */
|
||||
|
||||
#define _bfd_xcoff_sizeof_headers coff_sizeof_headers
|
||||
#define _bfd_xcoff_bfd_get_relocated_section_contents \
|
||||
coff_bfd_get_relocated_section_contents
|
||||
#define _bfd_xcoff_bfd_relax_section coff_bfd_relax_section
|
||||
#define _bfd_xcoff_bfd_link_split_section coff_bfd_link_split_section
|
||||
|
||||
/* The transfer vector that leads the outside world to all of the above. */
|
||||
|
||||
const bfd_target rs6000coff_vec =
|
||||
|
@ -1272,7 +1339,7 @@ const bfd_target rs6000coff_vec =
|
|||
true, /* header byte order is big */
|
||||
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_LINENO | HAS_DEBUG | DYNAMIC |
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
|
@ -1301,7 +1368,7 @@ const bfd_target rs6000coff_vec =
|
|||
BFD_JUMP_TABLE_SYMBOLS (coff),
|
||||
BFD_JUMP_TABLE_RELOCS (coff),
|
||||
BFD_JUMP_TABLE_WRITE (coff),
|
||||
BFD_JUMP_TABLE_LINK (coff),
|
||||
BFD_JUMP_TABLE_LINK (_bfd_xcoff),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
|
||||
COFF_SWAP_TABLE,
|
||||
|
|
14
bfd/configure
vendored
14
bfd/configure
vendored
|
@ -837,7 +837,7 @@ else
|
|||
fi
|
||||
done
|
||||
|
||||
for ac_func in fcntl
|
||||
for ac_func in fcntl getpagesize
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||
|
@ -1124,11 +1124,9 @@ EOF
|
|||
|
||||
;;
|
||||
rs6000-*-lynx*) COREFILE=lynx-core.o ;;
|
||||
rs6000-*-aix4*) COREFILE=rs6000-core.o
|
||||
COREFLAG=-DALTERNATE_AIX_CORE_FORMAT ;;
|
||||
rs6000-*-aix4*) COREFILE=rs6000-core.o ;;
|
||||
rs6000-*-*) COREFILE=rs6000-core.o ;;
|
||||
powerpc-*-aix4*) COREFILE=rs6000-core.o
|
||||
COREFLAG=-DALTERNATE_AIX_CORE_FORMAT ;;
|
||||
powerpc-*-aix4*) COREFILE=rs6000-core.o ;;
|
||||
powerpc-*-aix*) COREFILE=rs6000-core.o ;;
|
||||
tahoe-*-*)
|
||||
COREFILE=trad-core.o
|
||||
|
@ -1180,7 +1178,7 @@ EOF
|
|||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1184 "configure"
|
||||
#line 1182 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/procfs.h>
|
||||
int main() { return 0; }
|
||||
|
@ -1366,8 +1364,8 @@ do
|
|||
nlm32_powerpc_vec) tb="$tb nlm32-ppc.o nlm32.o nlm.o" ;;
|
||||
pc532netbsd_vec) tb="$tb ns32knetbsd.o aout-ns32k.o stab-syms.o" ;;
|
||||
pc532machaout_vec) tb="$tb pc532-mach.o aout-ns32k.o stab-syms.o" ;;
|
||||
pmac_xcoff_vec) tb="$tb coff-pmac.o cofflink.o" ;;
|
||||
rs6000coff_vec) tb="$tb coff-rs6000.o" ;;
|
||||
pmac_xcoff_vec) tb="$tb coff-pmac.o xcofflink.o" ;;
|
||||
rs6000coff_vec) tb="$tb coff-rs6000.o xcofflink.o" ;;
|
||||
bfd_powerpc_pe_vec) tb="$tb pe-ppc.o cofflink.o" ;;
|
||||
bfd_powerpcle_pe_vec) tb="$tb pe-ppc.o cofflink.o" ;;
|
||||
bfd_powerpc_pei_vec) tb="$tb pei-ppc.o cofflink.o" ;;
|
||||
|
|
|
@ -54,7 +54,7 @@ BFD_CC_FOR_BUILD
|
|||
|
||||
AC_CHECK_HEADERS(stddef.h string.h strings.h stdlib.h time.h unistd.h)
|
||||
AC_CHECK_HEADERS(fcntl.h sys/file.h)
|
||||
AC_CHECK_FUNCS(fcntl)
|
||||
AC_CHECK_FUNCS(fcntl getpagesize)
|
||||
|
||||
BFD_BINARY_FOPEN
|
||||
|
||||
|
@ -203,11 +203,9 @@ changequote([,])dnl
|
|||
AC_DEFINE(TRAD_HEADER,"hosts/pc532mach.h")
|
||||
;;
|
||||
rs6000-*-lynx*) COREFILE=lynx-core.o ;;
|
||||
rs6000-*-aix4*) COREFILE=rs6000-core.o
|
||||
COREFLAG=-DALTERNATE_AIX_CORE_FORMAT ;;
|
||||
rs6000-*-aix4*) COREFILE=rs6000-core.o ;;
|
||||
rs6000-*-*) COREFILE=rs6000-core.o ;;
|
||||
powerpc-*-aix4*) COREFILE=rs6000-core.o
|
||||
COREFLAG=-DALTERNATE_AIX_CORE_FORMAT ;;
|
||||
powerpc-*-aix4*) COREFILE=rs6000-core.o ;;
|
||||
powerpc-*-aix*) COREFILE=rs6000-core.o ;;
|
||||
tahoe-*-*)
|
||||
COREFILE=trad-core.o
|
||||
|
@ -411,7 +409,8 @@ do
|
|||
nlm32_powerpc_vec) tb="$tb nlm32-ppc.o nlm32.o nlm.o" ;;
|
||||
pc532netbsd_vec) tb="$tb ns32knetbsd.o aout-ns32k.o stab-syms.o" ;;
|
||||
pc532machaout_vec) tb="$tb pc532-mach.o aout-ns32k.o stab-syms.o" ;;
|
||||
rs6000coff_vec) tb="$tb coff-rs6000.o" ;;
|
||||
pmac_xcoff_vec) tb="$tb coff-pmac.o xcofflink.o" ;;
|
||||
rs6000coff_vec) tb="$tb coff-rs6000.o xcofflink.o" ;;
|
||||
bfd_powerpc_pe_vec) tb="$tb pe-ppc.o cofflink.o" ;;
|
||||
bfd_powerpcle_pe_vec) tb="$tb pe-ppc.o cofflink.o" ;;
|
||||
bfd_powerpc_pei_vec) tb="$tb pei-ppc.o cofflink.o" ;;
|
||||
|
|
|
@ -11,7 +11,7 @@ If "{target_canonical}" =~ /m68k-apple-macos/
|
|||
Set defvec m68kcoff_vec
|
||||
Set selvecs '&m68kcoff_vec'
|
||||
Else If "{target_canonical}" =~ /powerpc-apple-macos/
|
||||
Set BFD_BACKENDS '"{o}"coff-pmac.c.o "{o}"cofflink.c.o'
|
||||
Set BFD_BACKENDS '"{o}"coff-pmac.c.o "{o}"xcofflink.c.o'
|
||||
Set defvec pmac_xcoff_vec
|
||||
Set selvecs '&pmac_xcoff_vec'
|
||||
Set selarchs "&bfd_powerpc_arch"
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
/^Makefile /,/--recheck/d
|
||||
|
||||
# Don't do any recursive subdir stuff.
|
||||
/subdir_do/s/{MAKE} subdir_do/null-command/
|
||||
/ subdir_do/s/{MAKE}/null-command/
|
||||
|
||||
/BFD_H/s/^{BFD_H}/#{BFD_H}/
|
||||
|
||||
|
|
2817
bfd/xcofflink.c
Normal file
2817
bfd/xcofflink.c
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue