aboutsummaryrefslogtreecommitdiff
path: root/bfd/coff-i960.c
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@cygnus>1995-07-07 22:49:42 +0000
committerKen Raeburn <raeburn@cygnus>1995-07-07 22:49:42 +0000
commit943fbd5bd520934ca3a26abb2d5cfbdd2a7659ec (patch)
treeb240b5f343d4689d462e4b642626afbefc87c9f0 /bfd/coff-i960.c
parentc71a604ae102994ad081cb57be24586126048ba6 (diff)
downloadgdb-943fbd5bd520934ca3a26abb2d5cfbdd2a7659ec.zip
gdb-943fbd5bd520934ca3a26abb2d5cfbdd2a7659ec.tar.gz
gdb-943fbd5bd520934ca3a26abb2d5cfbdd2a7659ec.tar.bz2
fsf address update, but not in COPYING files
Diffstat (limited to 'bfd/coff-i960.c')
-rw-r--r--bfd/coff-i960.c73
1 files changed, 51 insertions, 22 deletions
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"