diff options
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/Makefile.in | 2 | ||||
-rw-r--r-- | bfd/aout-encap.c | 2 | ||||
-rw-r--r-- | bfd/aout-rce.c | 2 | ||||
-rw-r--r-- | bfd/aoutx.h | 62 | ||||
-rw-r--r-- | bfd/cf-m68klynx.c | 2 | ||||
-rw-r--r-- | bfd/coff-a29k.c | 2 | ||||
-rw-r--r-- | bfd/coff-arm.c | 570 | ||||
-rw-r--r-- | bfd/coff-i960.c | 73 | ||||
-rw-r--r-- | bfd/cofflink.c | 2 | ||||
-rw-r--r-- | bfd/core.c | 2 | ||||
-rw-r--r-- | bfd/cpu-a29k.c | 2 | ||||
-rw-r--r-- | bfd/cpu-rce.c | 2 | ||||
-rw-r--r-- | bfd/ecoff.c | 2 | ||||
-rw-r--r-- | bfd/elf32-i386.c | 2 | ||||
-rw-r--r-- | bfd/elf32-m68k.c | 2 | ||||
-rw-r--r-- | bfd/elf32-sparc.c | 2 | ||||
-rw-r--r-- | bfd/elflink.h | 2 | ||||
-rw-r--r-- | bfd/filemode.c | 2 | ||||
-rw-r--r-- | bfd/i386linux.c | 4 | ||||
-rw-r--r-- | bfd/libelf.h | 2 | ||||
-rw-r--r-- | bfd/linker.c | 2 | ||||
-rw-r--r-- | bfd/m68klynx.c | 2 | ||||
-rw-r--r-- | bfd/mpw-make.in | 2 | ||||
-rw-r--r-- | bfd/sunos.c | 10 |
24 files changed, 683 insertions, 74 deletions
diff --git a/bfd/Makefile.in b/bfd/Makefile.in index a1027b6..9e3b234 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -16,7 +16,7 @@ # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. VPATH = @srcdir@ srcdir = @srcdir@ diff --git a/bfd/aout-encap.c b/bfd/aout-encap.c index f5e4fd7..eb74608 100644 --- a/bfd/aout-encap.c +++ b/bfd/aout-encap.c @@ -15,7 +15,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* THIS MODULE IS NOT FINISHED. IT PROBABLY DOESN'T EVEN COMPILE. */ diff --git a/bfd/aout-rce.c b/bfd/aout-rce.c index 6fa3f52..f83e5f9 100644 --- a/bfd/aout-rce.c +++ b/bfd/aout-rce.c @@ -15,7 +15,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGET_IS_BIG_ENDIAN_P #define PAGE_SIZE 4096 diff --git a/bfd/aoutx.h b/bfd/aoutx.h index b3c660e..8c6ebb1 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -16,7 +16,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* SECTION @@ -705,8 +705,10 @@ NAME(aout,machine_type) (arch, machine, unknown) case 0: case 2000: case 3000: arch_flags = M_MIPS1; break; - case 4000: + case 4000: /* mips3 */ case 4400: + case 8000: /* mips4 */ + /* real mips2: */ case 6000: arch_flags = M_MIPS2; break; default: arch_flags = M_UNKNOWN; break; } @@ -1542,37 +1544,43 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer) struct external_nlist *sym_pointer; { bfd_vma value = cache_ptr->value; + asection *sec; + bfd_vma off; /* Mask out any existing type bits in case copying from one section to another. */ sym_pointer->e_type[0] &= ~N_TYPE; - if (bfd_is_abs_section (bfd_get_section (cache_ptr))) - sym_pointer->e_type[0] |= N_ABS; - else if (bfd_get_section (cache_ptr) == obj_textsec (abfd) - || (bfd_get_section (cache_ptr)->output_section - == obj_textsec (abfd))) - sym_pointer->e_type[0] |= N_TEXT; - else if (bfd_get_section (cache_ptr) == obj_datasec (abfd) - || (bfd_get_section (cache_ptr)->output_section - == obj_datasec (abfd))) - sym_pointer->e_type[0] |= N_DATA; - else if (bfd_get_section (cache_ptr) == obj_bsssec (abfd) - || (bfd_get_section (cache_ptr)->output_section - == obj_bsssec (abfd))) - sym_pointer->e_type[0] |= N_BSS; - else if (bfd_get_section (cache_ptr) == NULL) + sec = bfd_get_section (cache_ptr); + off = 0; + + if (sec == NULL) { - /* Protect the bfd_is_com_section call. This case occurs, e.g., - for the *DEBUG* section of a COFF file. */ + /* This case occurs, e.g., for the *DEBUG* section of a COFF + file. */ bfd_set_error (bfd_error_nonrepresentable_section); return false; } - else if (bfd_is_und_section (bfd_get_section (cache_ptr))) + + if (sec->output_section != NULL) + { + off = sec->output_offset; + sec = sec->output_section; + } + + if (bfd_is_abs_section (sec)) + sym_pointer->e_type[0] |= N_ABS; + else if (sec == obj_textsec (abfd)) + sym_pointer->e_type[0] |= N_TEXT; + else if (sec == obj_datasec (abfd)) + sym_pointer->e_type[0] |= N_DATA; + else if (sec == obj_bsssec (abfd)) + sym_pointer->e_type[0] |= N_BSS; + else if (bfd_is_und_section (sec)) sym_pointer->e_type[0] = N_UNDF | N_EXT; - else if (bfd_is_ind_section (bfd_get_section (cache_ptr))) + else if (bfd_is_ind_section (sec)) sym_pointer->e_type[0] = N_INDR; - else if (bfd_is_com_section (bfd_get_section (cache_ptr))) + else if (bfd_is_com_section (sec)) sym_pointer->e_type[0] = N_UNDF | N_EXT; else { @@ -1581,11 +1589,7 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer) } /* Turn the symbol from section relative to absolute again */ - if (cache_ptr->section->output_section != NULL) - value += (cache_ptr->section->output_section->vma - + cache_ptr->section->output_offset); - else - value += cache_ptr->section->vma; + value += sec->vma + off; if ((cache_ptr->flags & BSF_WARNING) != 0) sym_pointer->e_type[0] = N_WARNING; @@ -4465,6 +4469,10 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs, + input_section->output_offset - input_section->vma); +#ifdef MY_relocatable_reloc + MY_relocatable_reloc (howto, output_bfd, rel, relocation, r_addr); +#endif + if (relocation == 0) r = bfd_reloc_ok; else diff --git a/bfd/cf-m68klynx.c b/bfd/cf-m68klynx.c index bb12e22..94a6fb0 100644 --- a/bfd/cf-m68klynx.c +++ b/bfd/cf-m68klynx.c @@ -16,7 +16,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGET_SYM m68klynx_coff_vec #define TARGET_NAME "coff-m68k-lynx" diff --git a/bfd/coff-a29k.c b/bfd/coff-a29k.c index fdcb430..cac98ad 100644 --- a/bfd/coff-a29k.c +++ b/bfd/coff-a29k.c @@ -16,7 +16,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define A29K 1 diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c new file mode 100644 index 0000000..8fa712d --- /dev/null +++ b/bfd/coff-arm.c @@ -0,0 +1,570 @@ +/* BFD back-end for Intel arm COFF files. + Copyright 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. + Written by 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "obstack.h" + +#include "coff/arm.h" + +#include "coff/internal.h" + +#ifdef COFF_WITH_PE +#include "coff/pe.h" +#endif + +#include "libcoff.h" + +static bfd_reloc_status_type +aoutarm_fix_pcrel_26_done PARAMS ((bfd *, arelent *, asymbol *, PTR, + asection *, bfd *, char **)); + +static bfd_reloc_status_type +aoutarm_fix_pcrel_26 PARAMS ((bfd *, arelent *, asymbol *, PTR, + asection *, bfd *, char **)); + + +static bfd_reloc_status_type coff_arm_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + +static bfd_reloc_status_type +coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, + error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + symvalue diff; + + if (output_bfd == (bfd *) NULL) + return bfd_reloc_continue; + + if (bfd_is_com_section (symbol->section)) + { + /* We are relocating a common symbol. The current value in the + object file is ORIG + OFFSET, where ORIG is the value of the + common symbol as seen by the object file when it was compiled + (this may be zero if the symbol was undefined) and OFFSET is + the offset into the common symbol (normally zero, but may be + non-zero when referring to a field in a common structure). + ORIG is the negative of reloc_entry->addend, which is set by + the CALC_ADDEND macro below. We want to replace the value in + the object file with NEW + OFFSET, where NEW is the value of + the common symbol which we are going to put in the final + object file. NEW is symbol->value. */ + diff = symbol->value + reloc_entry->addend; + } + else + { + /* For some reason bfd_perform_relocation always effectively + ignores the addend for a COFF target when producing + relocateable output. This seems to be always wrong for 386 + COFF, so we handle the addend here instead. */ + diff = reloc_entry->addend; + } + +#define DOIT(x) \ + x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask)) + + if (diff != 0) + { + reloc_howto_type *howto = reloc_entry->howto; + unsigned char *addr = (unsigned char *) data + reloc_entry->address; + + switch (howto->size) + { + case 0: + { + char x = bfd_get_8 (abfd, addr); + DOIT (x); + bfd_put_8 (abfd, x, addr); + } + break; + + case 1: + { + short x = bfd_get_16 (abfd, addr); + DOIT (x); + bfd_put_16 (abfd, x, addr); + } + break; + + case 2: + { + long x = bfd_get_32 (abfd, addr); + DOIT (x); + bfd_put_32 (abfd, x, addr); + } + break; + + default: + abort (); + } + } + + /* Now let bfd_perform_relocation finish everything up. */ + return bfd_reloc_continue; +} + +static reloc_howto_type aoutarm_std_reloc_howto[] = +{ + /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone */ + HOWTO(0, /* type */ + 0, /* rs */ + 0, /* size */ + 8, /* bsz */ + false, /* pcrel */ + 0, /* bitpos */ + complain_overflow_bitfield, /* ovf */ + coff_arm_reloc, /* sf */ + "8", /*name */ + true, /* partial */ + 0x000000ff, /*read mask */ + 0x000000ff, /* setmask */ + PCRELOFFSET /* pcdone */), + HOWTO(1, + 0, + 1, + 16, + false, + 0, + complain_overflow_bitfield, + coff_arm_reloc, + "16", + true, + 0x0000ffff, + 0x0000ffff, + PCRELOFFSET), + HOWTO( 2, + 0, + 2, + 32, + false, + 0, + complain_overflow_bitfield, + coff_arm_reloc, + "32", + true, + 0xffffffff, + 0xffffffff, + PCRELOFFSET), + HOWTO( 3, + 2, + 3, + 26, + true, + 0, + complain_overflow_signed, + aoutarm_fix_pcrel_26 , + "ARM26", + true, + 0x00ffffff, + 0x00ffffff, + PCRELOFFSET), + HOWTO( 4, + 0, + 0, + 8, + true, + 0, + complain_overflow_signed, + coff_arm_reloc, + "DISP8", + true, + 0x000000ff, + 0x000000ff, + true), + HOWTO( 5, + 0, + 1, + 16, + true, + 0, + complain_overflow_signed, + coff_arm_reloc, + "DISP16", + true, + 0x0000ffff, + 0x0000ffff, + true), + HOWTO( 6, + 0, + 2, + 32, + true, + 0, + complain_overflow_signed, + coff_arm_reloc, + "DISP32", + true, + 0xffffffff, + 0xffffffff, + true), + HOWTO( 7, + 2, + 3, + 26, + false, + 0, + complain_overflow_signed, + aoutarm_fix_pcrel_26_done, + "ARM26D", + true, + 0x00ffffff, + 0x00ffffff, + false), + {-1}, + HOWTO( 9, + 0, + -1, + 16, + false, + 0, + complain_overflow_bitfield, + coff_arm_reloc, + "NEG16", + true, + 0x0000ffff, + 0x0000ffff, + false), + HOWTO( 10, + 0, + -2, + 32, + false, + 0, + complain_overflow_bitfield, + coff_arm_reloc, + "NEG32", + true, + 0xffffffff, + 0xffffffff, + false) +}; + + + +#define RTYPE2HOWTO(cache_ptr, dst) \ + (cache_ptr)->howto = aoutarm_std_reloc_howto + (dst)->r_type; + +static bfd_reloc_status_type +aoutarm_fix_pcrel_26_done (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + /* This is dead simple at present. */ + return bfd_reloc_ok; +} + +static bfd_reloc_status_type +aoutarm_fix_pcrel_26 (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + bfd_vma relocation; + bfd_size_type addr = reloc_entry->address; + long target = bfd_get_32 (abfd, (bfd_byte *) data + addr); + bfd_reloc_status_type flag = bfd_reloc_ok; + + /* If this is an undefined symbol, return error */ + if (symbol->section == &bfd_und_section + && (symbol->flags & BSF_WEAK) == 0) + return output_bfd ? bfd_reloc_continue : bfd_reloc_undefined; + + /* If the sections are different, and we are doing a partial relocation, + just ignore it for now. */ + if (symbol->section->name != input_section->name + && output_bfd != (bfd *)NULL) + return bfd_reloc_continue; + + relocation = (target & 0x00ffffff) << 2; + relocation = (relocation ^ 0x02000000) - 0x02000000; /* Sign extend */ + relocation += symbol->value; + relocation += symbol->section->output_section->vma; + relocation += symbol->section->output_offset; + relocation += reloc_entry->addend; + relocation -= input_section->output_section->vma; + relocation -= input_section->output_offset; + relocation -= addr; + if (relocation & 3) + return bfd_reloc_overflow; + + /* Check for overflow */ + if (relocation & 0x02000000) + { + if ((relocation & ~0x03ffffff) != ~0x03ffffff) + flag = bfd_reloc_overflow; + } + else if (relocation & ~0x03ffffff) + flag = bfd_reloc_overflow; + + target &= ~0x00ffffff; + target |= (relocation >> 2) & 0x00ffffff; + bfd_put_32 (abfd, target, (bfd_byte *) data + addr); + + /* Now the ARM magic... Change the reloc type so that it is marked as done. + Strictly this is only necessary if we are doing a partial relocation. */ + reloc_entry->howto = &aoutarm_std_reloc_howto[7]; + + return flag; +} + +static CONST struct reloc_howto_struct * +arm_reloc_type_lookup(abfd,code) + bfd *abfd; + bfd_reloc_code_real_type code; +{ +#define ASTD(i,j) case i: return &aoutarm_std_reloc_howto[j] + if (code == BFD_RELOC_CTOR) + switch (bfd_get_arch_info (abfd)->bits_per_address) + { + case 32: + code = BFD_RELOC_32; + break; + default: return (CONST struct reloc_howto_struct *) 0; + } + + switch (code) + { + ASTD (BFD_RELOC_16, 1); + ASTD (BFD_RELOC_32, 2); + ASTD (BFD_RELOC_ARM_PCREL_BRANCH, 3); + ASTD (BFD_RELOC_8_PCREL, 4); + ASTD (BFD_RELOC_16_PCREL, 5); + ASTD (BFD_RELOC_32_PCREL, 6); + default: return (CONST struct reloc_howto_struct *) 0; + } +} + + +#define coff_bfd_reloc_type_lookup arm_reloc_type_lookup + +static reloc_howto_type *coff_arm_rtype_to_howto + PARAMS ((bfd *, asection *, struct internal_reloc *, + struct coff_link_hash_entry *, struct internal_syment *, + + bfd_vma *)); + +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2) +/* The page size is a guess based on ELF. */ +#define COFF_PAGE_SIZE 0x1000 + +/* For some reason when using arm COFF the value stored in the .text + section for a reference to a common symbol is the value itself plus + any desired offset. Ian Taylor, Cygnus Support. */ + +/* If we are producing relocateable output, we need to do some + adjustments to the object file that are not done by the + bfd_perform_relocation function. This function is called by every + reloc type to make any required adjustments. */ + +static bfd_reloc_status_type +aacoff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, + error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + symvalue diff; + + if (output_bfd == (bfd *) NULL) + return bfd_reloc_continue; + + if (bfd_is_com_section (symbol->section)) + { + /* We are relocating a common symbol. The current value in the + object file is ORIG + OFFSET, where ORIG is the value of the + common symbol as seen by the object file when it was compiled + (this may be zero if the symbol was undefined) and OFFSET is + the offset into the common symbol (normally zero, but may be + non-zero when referring to a field in a common structure). + ORIG is the negative of reloc_entry->addend, which is set by + the CALC_ADDEND macro below. We want to replace the value in + the object file with NEW + OFFSET, where NEW is the value of + the common symbol which we are going to put in the final + object file. NEW is symbol->value. */ + diff = symbol->value + reloc_entry->addend; + } + else + { + /* For some reason bfd_perform_relocation always effectively + ignores the addend for a COFF target when producing + relocateable output. This seems to be always wrong for arm + COFF, so we handle the addend here instead. */ + diff = reloc_entry->addend; + } + +#define DOIT(x) \ + x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask)) + + if (diff != 0) + { + reloc_howto_type *howto = reloc_entry->howto; + unsigned char *addr = (unsigned char *) data + reloc_entry->address; + + switch (howto->size) + { + case 0: + { + char x = bfd_get_8 (abfd, addr); + DOIT (x); + bfd_put_8 (abfd, x, addr); + } + break; + + case 1: + { + short x = bfd_get_16 (abfd, addr); + DOIT (x); + bfd_put_16 (abfd, x, addr); + } + break; + + case 2: + { + long x = bfd_get_32 (abfd, addr); + DOIT (x); + bfd_put_32 (abfd, x, addr); + } + break; + + default: + abort (); + } + } + + /* Now let bfd_perform_relocation finish everything up. */ + return bfd_reloc_continue; +} + + + + + +/* Turn a howto into a reloc nunmber */ + +#define SELECT_RELOC(x,howto) { x.r_type = howto->type; } +#define BADMAG(x) ARMBADMAG(x) +#define ARM 1 /* Customize coffcode.h */ + + +/* On SCO Unix 3.2.2 the native assembler generates two .data + sections. We handle that by renaming the second one to .data2. It + does no harm to do this for any arm COFF target. */ +#define TWO_DATA_SECS + +/* For arm COFF a STYP_NOLOAD | STYP_BSS section is part of a shared + library. On some other COFF targets STYP_BSS is normally + STYP_NOLOAD. */ +#define BSS_NOLOAD_IS_SHARED_LIBRARY + + +/* We use the special COFF backend linker. */ +#define coff_relocate_section _bfd_coff_generic_relocate_section + + + +#include "coffcode.h" + +static const bfd_target * +i3coff_object_p(a) + bfd *a; +{ + return coff_object_p(a); +} + +const bfd_target +#ifdef TARGET_SYM + TARGET_SYM = +#else + armcoff_vec = +#endif +{ +#ifdef TARGET_NAME + TARGET_NAME, +#else + "coff-arm", /* name */ +#endif + bfd_target_coff_flavour, + false, /* data byte order is little */ + false, /* header byte order is little */ + + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), + + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ +#ifdef TARGET_UNDERSCORE + TARGET_UNDERSCORE, /* leading underscore */ +#else + 0, /* leading underscore */ +#endif + '/', /* ar_pad_char */ + 15, /* ar_max_namelen */ + + 2, /* minimum alignment power */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ + +/* Note that we allow an object file to be treated as a core file as well. */ + {_bfd_dummy_target, i3coff_object_p, /* bfd_check_format */ + bfd_generic_archive_p, i3coff_object_p}, + {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ + bfd_false}, + {bfd_false, coff_write_object_contents, /* bfd_write_contents */ + _bfd_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 (_bfd_archive_coff), + BFD_JUMP_TABLE_SYMBOLS (coff), + BFD_JUMP_TABLE_RELOCS (coff), + BFD_JUMP_TABLE_WRITE (coff), + BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + COFF_SWAP_TABLE, +}; diff --git a/bfd/coff-i960.c b/bfd/coff-i960.c index cfbe5fd..fcc8754 100644 --- a/bfd/coff-i960.c +++ b/bfd/coff-i960.c @@ -1,5 +1,5 @@ /* BFD back-end for Intel 960 COFF files. - Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 93, 94, 1995 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -16,7 +16,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define I960 1 #define BADMAG(x) I960BADMAG(x) @@ -34,6 +34,12 @@ static bfd_reloc_status_type optcall_callback static bfd_reloc_status_type coff_i960_relocate PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3) + +/* The i960 does not support an MMU, so COFF_PAGE_SIZE can be + arbitrarily small. */ +#define COFF_PAGE_SIZE 1 + #define COFF_LONG_FILENAMES #define CALLS 0x66003800 /* Template for 'calls' instruction */ @@ -42,12 +48,12 @@ static bfd_reloc_status_type coff_i960_relocate static bfd_reloc_status_type optcall_callback (abfd, reloc_entry, symbol_in, data, - ignore_input_section, ignore_bfd, error_message) + input_section, ignore_bfd, error_message) bfd *abfd; arelent *reloc_entry; asymbol *symbol_in; PTR data; - asection *ignore_input_section; + asection *input_section; bfd *ignore_bfd; char **error_message; { @@ -57,6 +63,13 @@ optcall_callback (abfd, reloc_entry, symbol_in, data, bfd_reloc_status_type result; coff_symbol_type *cs = coffsymbol(symbol_in); + /* Don't do anything with symbols which aren't tied up yet, + except move the reloc. */ + if (bfd_is_und_section (cs->symbol.section)) { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + /* So the target symbol has to be of coff type, and the symbol has to have the correct native information within it */ if ((bfd_asymbol_flavour(&cs->symbol) != bfd_target_coff_flavour) @@ -126,8 +139,7 @@ coff_i960_relocate (abfd, reloc_entry, symbol, data, input_section, bfd *output_bfd; char **error_message; { - const char *sec_name; - asymbol **syms, **sym_end; + asection *osec; if (output_bfd == NULL) { @@ -141,25 +153,42 @@ coff_i960_relocate (abfd, reloc_entry, symbol, data, input_section, return bfd_reloc_continue; } + if (bfd_is_com_section (bfd_get_section (symbol))) + { + /* I don't really know what the right action is for a common + symbol. */ + return bfd_reloc_continue; + } + /* Convert the reloc to use the section symbol. FIXME: This method - is ridiculous. */ - sec_name = bfd_get_section_name (output_bfd, - bfd_get_section (symbol)->output_section); - syms = bfd_get_outsymbols (output_bfd); - sym_end = syms + bfd_get_symcount (output_bfd); - for (; syms < sym_end; syms++) + is ridiculous. Fortunately, we don't use the used_by_bfd field + in COFF. */ + osec = bfd_get_section (symbol)->output_section; + if (osec->used_by_bfd != NULL) + reloc_entry->sym_ptr_ptr = (asymbol **) osec->used_by_bfd; + else { - if (bfd_asymbol_name (*syms) != NULL - && strcmp (bfd_asymbol_name (*syms), sec_name) == 0 - && (*syms)->value == 0) + const char *sec_name; + asymbol **syms, **sym_end; + + sec_name = bfd_get_section_name (output_bfd, osec); + syms = bfd_get_outsymbols (output_bfd); + sym_end = syms + bfd_get_symcount (output_bfd); + for (; syms < sym_end; syms++) { - reloc_entry->sym_ptr_ptr = syms; - break; + if (bfd_asymbol_name (*syms) != NULL + && (*syms)->value == 0 + && strcmp (!(*syms)->section->output_section->name, sec_name)) + { + osec->used_by_bfd = (PTR) syms; + reloc_entry->sym_ptr_ptr = syms; + break; + } } - } - if (syms >= sym_end) - abort (); + if (syms >= sym_end) + abort (); + } /* Let bfd_perform_relocation do its thing, which will include stuffing the symbol addend into the object file. */ @@ -177,7 +206,7 @@ static reloc_howto_type howto_optcall = HOWTO (R_OPTCALL, 0,2,24,true,0, complain_overflow_signed, optcall_callback, "optcall", true, 0x00ffffff, 0x00ffffff, 0); -static const reloc_howto_type * +static reloc_howto_type * coff_i960_reloc_type_lookup (abfd, code) bfd *abfd; bfd_reloc_code_real_type code; @@ -207,7 +236,7 @@ coff_i960_reloc_type_lookup (abfd, code) case 27: howto_ptr = &howto_optcall; break; \ default: howto_ptr = 0; break; \ } \ - cache_ptr->howto = howto_ptr; \ + (cache_ptr)->howto = howto_ptr; \ } #include "coffcode.h" diff --git a/bfd/cofflink.c b/bfd/cofflink.c index 4913b51..efc8305 100644 --- a/bfd/cofflink.c +++ b/bfd/cofflink.c @@ -16,7 +16,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This file contains the COFF backend linker code. */ @@ -16,7 +16,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* SECTION diff --git a/bfd/cpu-a29k.c b/bfd/cpu-a29k.c index fa7f478..3601551 100644 --- a/bfd/cpu-a29k.c +++ b/bfd/cpu-a29k.c @@ -16,7 +16,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/bfd/cpu-rce.c b/bfd/cpu-rce.c index 12b752a..e597e87 100644 --- a/bfd/cpu-rce.c +++ b/bfd/cpu-rce.c @@ -15,7 +15,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/bfd/ecoff.c b/bfd/ecoff.c index b85bf41..a5ad16b 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -17,7 +17,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index ef1b42e..a362262 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -15,7 +15,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index dae2dd2..2916c46 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -15,7 +15,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c index b0962cf..a3dca6a 100644 --- a/bfd/elf32-sparc.c +++ b/bfd/elf32-sparc.c @@ -15,7 +15,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/bfd/elflink.h b/bfd/elflink.h index 554e14c..9ba2bed 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -15,7 +15,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* ELF linker code. */ static boolean elf_link_add_object_symbols diff --git a/bfd/filemode.c b/bfd/filemode.c index d53cef1..fd790b3 100644 --- a/bfd/filemode.c +++ b/bfd/filemode.c @@ -13,7 +13,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <sys/types.h> #include <sys/stat.h> diff --git a/bfd/i386linux.c b/bfd/i386linux.c index e5162c4..a40b5c5 100644 --- a/bfd/i386linux.c +++ b/bfd/i386linux.c @@ -1,5 +1,5 @@ /* BFD back-end for linux flavored i386 a.out binaries. - Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. + Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -15,7 +15,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define PAGE_SIZE 4096 #define ZMAGIC_DISK_BLOCK_SIZE 1024 diff --git a/bfd/libelf.h b/bfd/libelf.h index f48bbdb..463619c 100644 --- a/bfd/libelf.h +++ b/bfd/libelf.h @@ -16,7 +16,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _LIBELF_H_ #define _LIBELF_H_ 1 diff --git a/bfd/linker.c b/bfd/linker.c index 4ce41e9..5aae545 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -16,7 +16,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/bfd/m68klynx.c b/bfd/m68klynx.c index d8d696f..15309c2 100644 --- a/bfd/m68klynx.c +++ b/bfd/m68klynx.c @@ -15,7 +15,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define BYTES_IN_WORD 4 #define N_SHARED_LIB(x) 0 diff --git a/bfd/mpw-make.in b/bfd/mpw-make.in index a0d2b7f..a9c6780 100644 --- a/bfd/mpw-make.in +++ b/bfd/mpw-make.in @@ -16,7 +16,7 @@ # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. DebugOptions = # -d DEBUG_BFD_SEND diff --git a/bfd/sunos.c b/bfd/sunos.c index 427beb4..807f5b1 100644 --- a/bfd/sunos.c +++ b/bfd/sunos.c @@ -16,7 +16,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGETNAME "a.out-sunos-big" #define MY(OP) CAT(sunos_big_,OP) @@ -486,7 +486,8 @@ sunos_canonicalize_dynamic_reloc (abfd, storage, syms) p = (struct reloc_ext_external *) info->dynrel; pend = p + info->dynrel_count; for (; p < pend; p++, to++) - NAME(aout,swap_ext_reloc_in) (abfd, p, to, syms); + NAME(aout,swap_ext_reloc_in) (abfd, p, to, syms, + info->dynsym_count); } else { @@ -496,7 +497,8 @@ sunos_canonicalize_dynamic_reloc (abfd, storage, syms) p = (struct reloc_std_external *) info->dynrel; pend = p + info->dynrel_count; for (; p < pend; p++, to++) - NAME(aout,swap_std_reloc_in) (abfd, p, to, syms); + NAME(aout,swap_std_reloc_in) (abfd, p, to, syms, + info->dynsym_count); } } @@ -876,7 +878,7 @@ sunos_add_one_symbol (info, abfd, name, flags, section, value, string, && h->root.root.u.def.section->owner != NULL && (h->root.root.u.def.section->owner->flags & DYNAMIC) != 0) || (h->root.root.type == bfd_link_hash_common - && ((h->root.root.u.c.section->owner->flags & DYNAMIC) + && ((h->root.root.u.c.p->section->owner->flags & DYNAMIC) != 0))) { /* The existing definition is from a dynamic object. We |