aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-or32.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2005-07-01 11:16:33 +0000
committerNick Clifton <nickc@redhat.com>2005-07-01 11:16:33 +0000
commit47b0e7ad8c60ea4b45b22ad5cb376f068991bc88 (patch)
treebb27e86679b3604624116e9a81be6bb3bd7353f2 /bfd/elf32-or32.c
parente4e8248d79d8461adf8b0cf22086e85a4c9ee0a4 (diff)
downloadgdb-47b0e7ad8c60ea4b45b22ad5cb376f068991bc88.zip
gdb-47b0e7ad8c60ea4b45b22ad5cb376f068991bc88.tar.gz
gdb-47b0e7ad8c60ea4b45b22ad5cb376f068991bc88.tar.bz2
Update function declarations to ISO C90 formatting
Diffstat (limited to 'bfd/elf32-or32.c')
-rw-r--r--bfd/elf32-or32.c547
1 files changed, 246 insertions, 301 deletions
diff --git a/bfd/elf32-or32.c b/bfd/elf32-or32.c
index f7f9e77..546aa15 100644
--- a/bfd/elf32-or32.c
+++ b/bfd/elf32-or32.c
@@ -1,5 +1,5 @@
/* OR32-specific support for 32-bit ELF
- Copyright 2002, 2004 Free Software Foundation, Inc.
+ Copyright 2002, 2004, 2005 Free Software Foundation, Inc.
Contributed by Ivan Guzvinec <ivang@opencores.org>
This file is part of BFD, the Binary File Descriptor library.
@@ -25,226 +25,14 @@
#include "elf/or32.h"
#include "libiberty.h"
-static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-static void or32_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
-static bfd_boolean or32_elf_object_p
- PARAMS ((bfd *));
-static void or32_elf_final_write_processing
- PARAMS ((bfd *, bfd_boolean));
-static bfd_reloc_status_type or32_elf_32_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type or32_elf_16_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type or32_elf_8_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type or32_elf_const_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type or32_elf_consth_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type or32_elf_jumptarg_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-
/* Try to minimize the amount of space occupied by relocation tables
on the ROM (not that the ROM won't be swamped by other ELF overhead). */
#define USE_REL 1
-static reloc_howto_type elf_or32_howto_table[] =
-{
- /* This reloc does nothing. */
- HOWTO (R_OR32_NONE, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_OR32_NONE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A standard 32 bit relocation. */
- HOWTO (R_OR32_32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- or32_elf_32_reloc, /* special_function */
- "R_OR32_32", /* name */
- FALSE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A standard 16 bit relocation. */
- HOWTO (R_OR32_16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- or32_elf_16_reloc, /* special_function */
- "R_OR32_16", /* name */
- FALSE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A standard 8 bit relocation. */
- HOWTO (R_OR32_8, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- or32_elf_8_reloc, /* special_function */
- "R_OR32_8", /* name */
- FALSE, /* partial_inplace */
- 0x000000ff, /* src_mask */
- 0x000000ff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A standard low 16 bit relocation. */
- HOWTO (R_OR32_CONST, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- or32_elf_const_reloc, /* special_function */
- "R_OR32_CONST", /* name */
- FALSE, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A standard high 16 bit relocation. */
- HOWTO (R_OR32_CONSTH, /* type */
- 16, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- or32_elf_consth_reloc, /* special_function */
- "R_OR32_CONSTH", /* name */
- FALSE, /* partial_inplace */
- 0xffff0000, /* src_mask */
- 0x0000ffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* A standard branch relocation. */
- HOWTO (R_OR32_JUMPTARG, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 28, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- or32_elf_jumptarg_reloc,/* special_function */
- "R_OR32_JUMPTARG", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x03ffffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* GNU extension to record C++ vtable hierarchy. */
- HOWTO (R_OR32_GNU_VTINHERIT, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- NULL, /* special_function */
- "R_OR32_GNU_VTINHERIT", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* GNU extension to record C++ vtable member usage. */
- HOWTO (R_OR32_GNU_VTENTRY, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_elf_rel_vtable_reloc_fn, /* special_function */
- "R_OR32_GNU_VTENTRY", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-};
-
-/* Map BFD reloc types to OR32 ELF reloc types. */
-
-struct or32_reloc_map
-{
- bfd_reloc_code_real_type bfd_reloc_val;
- unsigned char elf_reloc_val;
-};
-
-static const struct or32_reloc_map or32_reloc_map[] =
-{
- { BFD_RELOC_NONE, R_OR32_NONE },
- { BFD_RELOC_32, R_OR32_32 },
- { BFD_RELOC_16, R_OR32_16 },
- { BFD_RELOC_8, R_OR32_8 },
- { BFD_RELOC_LO16, R_OR32_CONST },
- { BFD_RELOC_HI16, R_OR32_CONSTH },
- { BFD_RELOC_32_GOT_PCREL, R_OR32_JUMPTARG },
- { BFD_RELOC_VTABLE_INHERIT, R_OR32_GNU_VTINHERIT },
- { BFD_RELOC_VTABLE_ENTRY, R_OR32_GNU_VTENTRY },
-};
-
-static reloc_howto_type *
-bfd_elf32_bfd_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
-{
- unsigned int i;
-
- for (i = ARRAY_SIZE (or32_reloc_map); i--;)
- {
- if (or32_reloc_map[i].bfd_reloc_val == code)
- return &elf_or32_howto_table[or32_reloc_map[i].elf_reloc_val];
- }
-
- return NULL;
-}
-
-/* Set the howto pointer for an OR32 ELF reloc. */
-
-static void
-or32_info_to_howto_rel (abfd, cache_ptr, dst)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *cache_ptr;
- Elf_Internal_Rela *dst;
-{
- unsigned int r_type;
-
- r_type = ELF32_R_TYPE (dst->r_info);
- BFD_ASSERT (r_type < (unsigned int) R_OR32_max);
- cache_ptr->howto = &elf_or32_howto_table[r_type];
-}
-
/* Set the right machine number for an OR32 ELF file. */
static bfd_boolean
-or32_elf_object_p (abfd)
- bfd *abfd;
+or32_elf_object_p (bfd *abfd)
{
(void) bfd_default_set_arch_mach (abfd, bfd_arch_or32, 0);
return TRUE;
@@ -254,41 +42,22 @@ or32_elf_object_p (abfd)
This gets the OR32 architecture right based on the machine number. */
static void
-or32_elf_final_write_processing (abfd, linker)
- bfd *abfd;
- bfd_boolean linker ATTRIBUTE_UNUSED;
+or32_elf_final_write_processing (bfd *abfd,
+ bfd_boolean linker ATTRIBUTE_UNUSED)
{
- int mach;
- unsigned long val;
-
- switch (mach = bfd_get_mach (abfd))
- {
- /*
- case bfd_mach_arc_base:
- val = E_OR32_MACH_BASE;
- break;
- */
- default:
- val = 0;
- return;
- }
-
elf_elfheader (abfd)->e_flags &=~ EF_OR32_MACH;
- elf_elfheader (abfd)->e_flags |= val;
}
-bfd_reloc_status_type
-or32_elf_32_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 ATTRIBUTE_UNUSED;
+static bfd_reloc_status_type
+or32_elf_32_reloc (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void * data,
+ asection *input_section,
+ bfd *output_bfd,
+ char **error_message ATTRIBUTE_UNUSED)
{
- if (output_bfd != (bfd *) NULL)
+ if (output_bfd != NULL)
{
unsigned long insn;
bfd_size_type addr = reloc_entry->address;
@@ -307,18 +76,16 @@ or32_elf_32_reloc (abfd, reloc_entry, symbol, data, input_section,
return bfd_reloc_continue;
}
-bfd_reloc_status_type
-or32_elf_16_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 ATTRIBUTE_UNUSED;
+static bfd_reloc_status_type
+or32_elf_16_reloc (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void * data,
+ asection *input_section,
+ bfd *output_bfd,
+ char **error_message ATTRIBUTE_UNUSED)
{
- if (output_bfd != (bfd *) NULL)
+ if (output_bfd != NULL)
{
unsigned short insn;
bfd_size_type addr = reloc_entry->address;
@@ -337,18 +104,16 @@ or32_elf_16_reloc (abfd, reloc_entry, symbol, data, input_section,
return bfd_reloc_continue;
}
-bfd_reloc_status_type
-or32_elf_8_reloc (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
+static bfd_reloc_status_type
+or32_elf_8_reloc (bfd *abfd ATTRIBUTE_UNUSED,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void * data,
+ asection *input_section,
+ bfd *output_bfd,
+ char **error_message ATTRIBUTE_UNUSED)
{
- if (output_bfd != (bfd *) NULL)
+ if (output_bfd != NULL)
{
unsigned char insn;
bfd_size_type addr = reloc_entry->address;
@@ -387,16 +152,14 @@ struct or32_consth
static struct or32_consth *or32_consth_list;
-bfd_reloc_status_type
-or32_elf_consth_reloc (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
+static bfd_reloc_status_type
+or32_elf_consth_reloc (bfd *abfd ATTRIBUTE_UNUSED,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void * data,
+ asection *input_section,
+ bfd *output_bfd,
+ char **error_message ATTRIBUTE_UNUSED)
{
bfd_reloc_status_type ret;
bfd_vma relocation;
@@ -405,7 +168,7 @@ or32_elf_consth_reloc (abfd, reloc_entry, symbol, data, input_section,
ret = bfd_reloc_ok;
if (bfd_is_und_section (symbol->section)
- && output_bfd == (bfd *) NULL)
+ && output_bfd == NULL)
ret = bfd_reloc_undefined;
if (bfd_is_com_section (symbol->section))
@@ -421,7 +184,7 @@ or32_elf_consth_reloc (abfd, reloc_entry, symbol, data, input_section,
return bfd_reloc_outofrange;
/* Save the information, and let LO16 do the actual relocation. */
- n = (struct or32_consth *) bfd_malloc (sizeof *n);
+ n = bfd_malloc (sizeof *n);
if (n == NULL)
return bfd_reloc_outofrange;
n->addr = (bfd_byte *) data + reloc_entry->address;
@@ -429,7 +192,7 @@ or32_elf_consth_reloc (abfd, reloc_entry, symbol, data, input_section,
n->next = or32_consth_list;
or32_consth_list = n;
- if (output_bfd != (bfd *) NULL)
+ if (output_bfd != NULL)
reloc_entry->address += input_section->output_offset;
return ret;
@@ -439,16 +202,14 @@ or32_elf_consth_reloc (abfd, reloc_entry, symbol, data, input_section,
inplace relocation; this function exists in order to do the
R_OR32_CONSTH relocation described above. */
-bfd_reloc_status_type
-or32_elf_const_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;
+static bfd_reloc_status_type
+or32_elf_const_reloc (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void * data,
+ asection *input_section,
+ bfd *output_bfd,
+ char **error_message)
{
if (or32_consth_list != NULL)
{
@@ -482,7 +243,7 @@ or32_elf_const_reloc (abfd, reloc_entry, symbol, data, input_section,
or32_consth_list = NULL;
}
- if (output_bfd != (bfd *) NULL)
+ if (output_bfd != NULL)
{
unsigned long insn, tmp;
bfd_size_type addr = reloc_entry->address;
@@ -505,18 +266,16 @@ or32_elf_const_reloc (abfd, reloc_entry, symbol, data, input_section,
input_section, output_bfd, error_message);
}
-bfd_reloc_status_type
-or32_elf_jumptarg_reloc (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol ATTRIBUTE_UNUSED;
- PTR data;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
+static bfd_reloc_status_type
+or32_elf_jumptarg_reloc (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol ATTRIBUTE_UNUSED,
+ void * data,
+ asection *input_section,
+ bfd *output_bfd,
+ char **error_message ATTRIBUTE_UNUSED)
{
- if (output_bfd != (bfd *) NULL)
+ if (output_bfd != NULL)
{
unsigned long insn, tmp;
bfd_size_type addr = reloc_entry->address;
@@ -535,6 +294,192 @@ or32_elf_jumptarg_reloc (abfd, reloc_entry, symbol, data, input_section,
return bfd_reloc_continue;
}
+static reloc_howto_type elf_or32_howto_table[] =
+{
+ /* This reloc does nothing. */
+ HOWTO (R_OR32_NONE, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_OR32_NONE", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* A standard 32 bit relocation. */
+ HOWTO (R_OR32_32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ or32_elf_32_reloc, /* special_function */
+ "R_OR32_32", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* A standard 16 bit relocation. */
+ HOWTO (R_OR32_16, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ or32_elf_16_reloc, /* special_function */
+ "R_OR32_16", /* name */
+ FALSE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* A standard 8 bit relocation. */
+ HOWTO (R_OR32_8, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ or32_elf_8_reloc, /* special_function */
+ "R_OR32_8", /* name */
+ FALSE, /* partial_inplace */
+ 0x000000ff, /* src_mask */
+ 0x000000ff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* A standard low 16 bit relocation. */
+ HOWTO (R_OR32_CONST, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ or32_elf_const_reloc, /* special_function */
+ "R_OR32_CONST", /* name */
+ FALSE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* A standard high 16 bit relocation. */
+ HOWTO (R_OR32_CONSTH, /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ or32_elf_consth_reloc, /* special_function */
+ "R_OR32_CONSTH", /* name */
+ FALSE, /* partial_inplace */
+ 0xffff0000, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* A standard branch relocation. */
+ HOWTO (R_OR32_JUMPTARG, /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 28, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ or32_elf_jumptarg_reloc,/* special_function */
+ "R_OR32_JUMPTARG", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x03ffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* GNU extension to record C++ vtable hierarchy. */
+ HOWTO (R_OR32_GNU_VTINHERIT, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ NULL, /* special_function */
+ "R_OR32_GNU_VTINHERIT", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* GNU extension to record C++ vtable member usage. */
+ HOWTO (R_OR32_GNU_VTENTRY, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ _bfd_elf_rel_vtable_reloc_fn, /* special_function */
+ "R_OR32_GNU_VTENTRY", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ FALSE), /* pcrel_offset */
+};
+
+/* Map BFD reloc types to OR32 ELF reloc types. */
+
+struct or32_reloc_map
+{
+ bfd_reloc_code_real_type bfd_reloc_val;
+ unsigned char elf_reloc_val;
+};
+
+static const struct or32_reloc_map or32_reloc_map[] =
+{
+ { BFD_RELOC_NONE, R_OR32_NONE },
+ { BFD_RELOC_32, R_OR32_32 },
+ { BFD_RELOC_16, R_OR32_16 },
+ { BFD_RELOC_8, R_OR32_8 },
+ { BFD_RELOC_LO16, R_OR32_CONST },
+ { BFD_RELOC_HI16, R_OR32_CONSTH },
+ { BFD_RELOC_32_GOT_PCREL, R_OR32_JUMPTARG },
+ { BFD_RELOC_VTABLE_INHERIT, R_OR32_GNU_VTINHERIT },
+ { BFD_RELOC_VTABLE_ENTRY, R_OR32_GNU_VTENTRY },
+};
+
+static reloc_howto_type *
+bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_reloc_code_real_type code)
+{
+ unsigned int i;
+
+ for (i = ARRAY_SIZE (or32_reloc_map); i--;)
+ if (or32_reloc_map[i].bfd_reloc_val == code)
+ return &elf_or32_howto_table[or32_reloc_map[i].elf_reloc_val];
+
+ return NULL;
+}
+
+/* Set the howto pointer for an OR32 ELF reloc. */
+
+static void
+or32_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
+ arelent *cache_ptr,
+ Elf_Internal_Rela *dst)
+{
+ unsigned int r_type;
+
+ r_type = ELF32_R_TYPE (dst->r_info);
+ BFD_ASSERT (r_type < (unsigned int) R_OR32_max);
+ cache_ptr->howto = &elf_or32_howto_table[r_type];
+}
+
#define TARGET_LITTLE_SYM bfd_elf32_or32_little_vec
#define TARGET_LITTLE_NAME "elf32-littleor32"
#define TARGET_BIG_SYM bfd_elf32_or32_big_vec