/* BFD back-end for RISC iX (Acorn, arm) binaries.
- Copyright (C) 1994 Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001
+ Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
-
+
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
/* RISC iX overloads the MAGIC field to indicate more than just the usual
[ZNO]MAGIC values. Also included are squeezing information and
shared library usage. */
#define SPOMAGIC (MF_USES_SL|OMAGIC) /* OMAGIC with large header */
/* -- may contain a ref to a */
/* shared lib required by the */
- /* object. */
+ /* object. */
#define SLOMAGIC (MF_IS_SL|OMAGIC) /* A reference to a shared library */
/* The text portion of the object */
/* contains "overflow text" from */
/* the shared library to be linked */
/* in with an object */
-#define QMAGIC (MF_SQUEEZED|ZMAGIC) /* Sqeezed demand paged. */
+#define QMAGIC (MF_SQUEEZED|ZMAGIC) /* Sqeezed demand paged. */
/* NOTE: This interpretation of */
/* QMAGIC seems to be at variance */
/* With that used on other */
- /* architectures. */
+ /* architectures. */
#define SPZMAGIC (MF_USES_SL|ZMAGIC) /* program which uses sl */
#define SPQMAGIC (MF_USES_SL|QMAGIC) /* sqeezed ditto */
#define SLZMAGIC (MF_IS_SL|ZMAGIC) /* shared lib part of prog */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
-#include "assert.h"
#define WRITE_HEADERS(abfd, execp) \
{ \
if (bfd_get_outsymbols (abfd) != (asymbol **) NULL \
&& bfd_get_symcount (abfd) != 0) \
{ \
- if (bfd_seek (abfd, (file_ptr)(N_SYMOFF(*execp)), SEEK_SET) != 0) \
+ if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0) \
return false; \
\
- if (! NAME(aout,write_syms)(abfd)) return false; \
+ if (! NAME(aout,write_syms) (abfd)) return false; \
\
- if (bfd_seek (abfd, (file_ptr)(N_TRELOFF(*execp)), SEEK_SET) != 0) \
+ if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) != 0) \
return false; \
\
if (! riscix_squirt_out_relocs (abfd, obj_textsec (abfd))) \
return false; \
- if (bfd_seek (abfd, (file_ptr)(N_DRELOFF(*execp)), SEEK_SET) != 0) \
+ if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) != 0) \
return false; \
\
- if (!NAME(aout,squirt_out_relocs)(abfd, obj_datasec (abfd))) \
+ if (!NAME(aout,squirt_out_relocs) (abfd, obj_datasec (abfd))) \
return false; \
} \
}
HOWTO( 5, 0, 1, 16, true, 0, complain_overflow_signed, 0,"DISP16", true, 0x0000ffff,0x0000ffff, true),
HOWTO( 6, 0, 2, 32, true, 0, complain_overflow_signed, 0,"DISP32", true, 0xffffffff,0xffffffff, true),
HOWTO( 7, 2, 3, 26, false, 0, complain_overflow_signed, riscix_fix_pcrel_26_done, "ARM26D",true,0x00ffffff,0x00ffffff, false),
- {-1},
+ EMPTY_HOWTO (-1),
HOWTO( 9, 0, -1, 16, false, 0, complain_overflow_bitfield,0,"NEG16", true, 0x0000ffff,0x0000ffff, false),
HOWTO( 10, 0, -2, 32, false, 0, complain_overflow_bitfield,0,"NEG32", true, 0xffffffff,0xffffffff, false)
};
#define RISCIX_TABLE_SIZE \
(sizeof (riscix_std_reloc_howto) / sizeof (reloc_howto_type))
-
static bfd_reloc_status_type
riscix_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;
+ bfd *abfd ATTRIBUTE_UNUSED;
+ arelent *reloc_entry ATTRIBUTE_UNUSED;
+ asymbol *symbol ATTRIBUTE_UNUSED;
+ PTR data ATTRIBUTE_UNUSED;
+ asection *input_section ATTRIBUTE_UNUSED;
+ bfd *output_bfd ATTRIBUTE_UNUSED;
+ char **error_message ATTRIBUTE_UNUSED;
{
/* This is dead simple at present. */
return bfd_reloc_ok;
PTR data;
asection *input_section;
bfd *output_bfd;
- char **error_message;
+ char **error_message ATTRIBUTE_UNUSED;
{
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)
/* Check for overflow */
if (relocation & 0x02000000)
{
- if ((relocation & ~0x03ffffff) != ~0x03ffffff)
+ if ((relocation & ~ (bfd_vma) 0x03ffffff) != ~ (bfd_vma) 0x03ffffff)
flag = bfd_reloc_overflow;
}
else if (relocation & ~0x03ffffff)
/* 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 = &riscix_std_reloc_howto[7];
-
+
return flag;
}
reloc_howto_type *
-DEFUN(riscix_reloc_type_lookup,(abfd,code),
- bfd *abfd AND
- bfd_reloc_code_real_type code)
+riscix_reloc_type_lookup (abfd, code)
+ bfd *abfd;
+ bfd_reloc_code_real_type code;
{
#define ASTD(i,j) case i: return &riscix_std_reloc_howto[j]
if (code == BFD_RELOC_CTOR)
#define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define MY_final_link_callback should_not_be_used
#define MY_bfd_final_link _bfd_generic_final_link
#define MY_bfd_reloc_type_lookup riscix_reloc_type_lookup
/* For RISC iX, in pc-relative relocs the r_pcrel bit means that the
relocation has been done already (Only for the 26-bit one I think)???!!!
*/
-
+
if (r_length == 3)
r_pcrel = r_pcrel ? 0 : 1;
-
#if 0
/* For a standard reloc, the addend is in the object file. */
{
/* Fill in symbol */
r_extern = 1;
- r_index = stoi((*(g->sym_ptr_ptr))->flags);
+ r_index = (*g->sym_ptr_ptr)->udata.i;
}
}
else
arelent **generic;
unsigned char *native, *natptr;
size_t each_size;
-
+
unsigned int count = section->reloc_count;
size_t natsize;
return true;
}
-
/*
* This is just like the standard aoutx.h version but we need to do our
* own mapping of external reloc type values to howto entries.
*/
long
-MY(canonicalize_reloc)(abfd, section, relptr, symbols)
+MY(canonicalize_reloc) (abfd, section, relptr, symbols)
bfd *abfd;
sec_ptr section;
arelent **relptr;
unsigned int count, c;
extern reloc_howto_type NAME(aout,std_howto_table)[];
- /* If we have already read in the relocation table, return the values. */
+ /* If we have already read in the relocation table, return the values. */
if (section->flags & SEC_CONSTRUCTOR) {
arelent_chain *chain = section->constructor_chain;
return section->reloc_count;
}
- if (!NAME(aout,slurp_reloc_table)(abfd, section, symbols))
+ if (!NAME(aout,slurp_reloc_table) (abfd, section, symbols))
return -1;
tblptr = section->relocation;
for (count = 0; count++ < section->reloc_count;)
{
c = tblptr->howto - NAME(aout,std_howto_table);
- assert (c < RISCIX_TABLE_SIZE);
+ BFD_ASSERT (c < RISCIX_TABLE_SIZE);
tblptr->howto = &riscix_std_reloc_howto[c];
*relptr++ = tblptr++;
return section->reloc_count;
}
-/* This is the same as NAME(aout,some_aout_object_p), but has different
+/* This is the same as NAME(aout,some_aout_object_p), but has different
expansions of the macro definitions. */
const bfd_target *
struct aout_data_struct *rawptr, *oldrawptr;
const bfd_target *result;
- rawptr = ((struct aout_data_struct *)
+ rawptr = ((struct aout_data_struct *)
bfd_zalloc (abfd, sizeof (struct aout_data_struct )));
if (rawptr == NULL)
execp = abfd->tdata.aout_data->a.hdr;
/* Set the file flags */
- abfd->flags = NO_FLAGS;
+ abfd->flags = BFD_NO_FLAGS;
if (execp->a_drsize || execp->a_trsize)
abfd->flags |= HAS_RELOC;
/* Setting of EXEC_P has been deferred to the bottom of this function */
if (N_DYNAMIC(*execp))
abfd->flags |= DYNAMIC;
-
- if ((execp->a_info & MF_SQUEEZED) != 0) /* Squeezed files aren't supported
+ if ((execp->a_info & MF_SQUEEZED) != 0) /* Squeezed files aren't supported
(yet)! */
{
bfd_set_error (bfd_error_wrong_format);
/* The default relocation entry size is that of traditional V7 Unix. */
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
- /* The default symbol entry size is that of traditional Unix. */
+ /* The default symbol entry size is that of traditional Unix. */
obj_symbol_entry_size (abfd) = EXTERNAL_NLIST_SIZE;
obj_aout_external_syms (abfd) = NULL;
: (SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS));
obj_bsssec (abfd)->flags = SEC_ALLOC;
- result = (*callback_to_real_object_p)(abfd);
+ result = (*callback_to_real_object_p) (abfd);
#if defined(MACH) || defined(STAT_FOR_EXEC)
/* The original heuristic doesn't work in some important cases. The
return result;
}
-
static const bfd_target *
MY(object_p) (abfd)
bfd *abfd;
if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) return 0;
#endif
- NAME(aout,swap_exec_header_in)(abfd, &exec_bytes, &exec);
+ NAME(aout,swap_exec_header_in) (abfd, &exec_bytes, &exec);
target = riscix_some_aout_object_p (abfd, &exec, MY(callback));
return target;
}
-
#include "aout-target.h"