#include "libcoff.h"
static long get_symbol_value PARAMS ((asymbol *));
-static bfd_reloc_status_type or1_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static boolean coff_or1_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, struct internal_reloc *, struct internal_syment *, asection **));
-static boolean coff_or1_adjust_symndx PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, struct internal_reloc *, boolean *));
+static bfd_reloc_status_type or32_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static boolean coff_or32_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, struct internal_reloc *, struct internal_syment *, asection **));
+static boolean coff_or32_adjust_symndx PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, struct internal_reloc *, boolean *));
+static void reloc_processing PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *));
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
static reloc_howto_type howto_table[] =
{
{ R_ABS, 0, 3, 32, false, 0, complain_overflow_bitfield, or32_reloc, "ABS", true, 0xffffffff,0xffffffff, false },
- {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10},
- {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18}, {19}, {20},
- {21}, {22}, {23},
+ EMPTY_HOWTO (1),
+ EMPTY_HOWTO (2),
+ EMPTY_HOWTO (3),
+ EMPTY_HOWTO (4),
+ EMPTY_HOWTO (5),
+ EMPTY_HOWTO (6),
+ EMPTY_HOWTO (7),
+ EMPTY_HOWTO (8),
+ EMPTY_HOWTO (9),
+ EMPTY_HOWTO (10),
+ EMPTY_HOWTO (11),
+ EMPTY_HOWTO (12),
+ EMPTY_HOWTO (13),
+ EMPTY_HOWTO (14),
+ EMPTY_HOWTO (15),
+ EMPTY_HOWTO (16),
+ EMPTY_HOWTO (17),
+ EMPTY_HOWTO (18),
+ EMPTY_HOWTO (19),
+ EMPTY_HOWTO (20),
+ EMPTY_HOWTO (21),
+ EMPTY_HOWTO (22),
+ EMPTY_HOWTO (23),
{ R_IREL, 0, 3, 32, true, 0, complain_overflow_signed, or32_reloc, "IREL", true, 0xffffffff,0xffffffff, false },
{ R_IABS, 0, 3, 32, false, 0, complain_overflow_bitfield, or32_reloc, "IABS", true, 0xffffffff,0xffffffff, false },
{ R_ILOHALF, 0, 3, 16, true, 0, complain_overflow_signed, or32_reloc, "ILOHALF", true, 0x0000ffff,0x0000ffff, false },
static boolean
coff_or32_relocate_section (output_bfd, info, input_bfd, input_section,
contents, relocs, syms, sections)
- bfd *output_bfd;
+ bfd *output_bfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
bfd *input_bfd;
asection *input_section;
#include "opcode/or32.h"
#include "safe-ctype.h"
#include <string.h>
+#include <stdlib.h>
-#define EXTEND29(x) ((x) & 0x10000000 ? ((x) | 0xf0000000) : ((x)))
+#define EXTEND29(x) ((x) & (unsigned long) 0x10000000 ? ((x) | (unsigned long) 0xf0000000) : ((x)))
static void find_bytes_big PARAMS ((unsigned char *, unsigned long *));
static void find_bytes_little PARAMS ((unsigned char *, unsigned long *));
for (enc = enc_initial; *enc != '\0'; enc++)
if (*enc == param_ch)
- if (enc - 2 >= enc_initial && (*(enc - 2) == '0') && (*(enc - 1) == 'x'))
- continue;
- else
- param_pos++;
+ {
+ if (enc - 2 >= enc_initial && (*(enc - 2) == '0') && (*(enc - 1) == 'x'))
+ continue;
+ else
+ param_pos++;
+ }
#if DEBUG
printf ("or32_extract: %c %x ", param_ch, param_pos);
if ((param_ch == '0') || (param_ch == '1'))
{
- unsigned long tmp = strtol (enc, NULL, 16);
+ unsigned long tmp = strtoul (enc, NULL, 16);
#if DEBUG
printf (" enc=%s, tmp=%x ", enc, tmp);
#endif
if (!param_pos
&& letter_signed (param_ch)
- && ret >> letter_range (param_ch) - 1)
+ && ret >> (letter_range (param_ch) - 1))
{
#if DEBUG
printf ("\n ret=%x opc_pos=%x, param_pos=%x\n",
/* The raw instruction. */
unsigned char insn_ch[4];
/* Address. Will be sign extened 27-bit. */
- int addr;
+ unsigned long addr;
/* The four bytes of the instruction. */
unsigned long insn;
find_byte_func_type find_byte_func = (find_byte_func_type)info->private_data;
debug (int level, const char *format, ...)
{
/* Just to get rid of warnings. */
- format = level = 0;
+ format = (char *) level = 0;
}
#endif
int
insn_index (char *insn)
{
- int i, found = -1;
+ unsigned int i;
+ int found = -1;
for (i = 0; i < or32_num_opcodes; i++)
if (!strcmp (or32_opcodes[i].name, insn))
insn_name (index)
int index;
{
- if (index >= 0 && index < or32_num_opcodes)
+ if (index >= 0 && index < (int) or32_num_opcodes)
return or32_opcodes[index].name;
else
return "???";
int pass;
unsigned int mask;
{
- int best_first = 0, best_len = 0, i, last_match = -1, ninstr = 0;
+ int best_first = 0, last_match = -1, ninstr = 0;
+ unsigned int best_len = 0;
+ unsigned int i;
unsigned long cur_mask = mask;
unsigned long *next;
/* Find longest match. */
for (i = 0; i < 32; i++)
{
- int len;
+ unsigned int len;
for (len = best_len + 1; len < MIN (MAX_LEN, 33 - i); len++)
{
cur += 1 << best_len;
cur_mask = (1 << (unsigned long)best_len) - 1;
- for (i = 0; i < (1 << (unsigned long)best_len); i++)
+ for (i = 0; i < ((unsigned) 1 << best_len); i++)
{
- int j;
+ unsigned int j;
unsigned long *c;
curpass++;
void
build_automata ()
{
- int i;
+ unsigned int i;
unsigned long *end;
struct insn_op_struct *cur;