aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-d10v.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf32-d10v.c')
-rw-r--r--bfd/elf32-d10v.c330
1 files changed, 171 insertions, 159 deletions
diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c
index 913e857..50f7da6 100644
--- a/bfd/elf32-d10v.c
+++ b/bfd/elf32-d10v.c
@@ -1,5 +1,5 @@
/* D10V-specific support for 32-bit ELF
- Copyright 1996, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Martin Hunt (hunt@cygnus.com).
This file is part of BFD, the Binary File Descriptor library.
@@ -28,171 +28,183 @@ static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
static void d10v_info_to_howto_rel
PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
-
-/* Use REL instead of RELA to save space */
+static asection * elf32_d10v_gc_mark_hook
+ PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
+ struct elf_link_hash_entry *, Elf_Internal_Sym *));
+static boolean elf32_d10v_gc_sweep_hook
+ PARAMS ((bfd *, struct bfd_link_info *, asection *,
+ const Elf_Internal_Rela *));
+static boolean elf32_d10v_check_relocs
+ PARAMS ((bfd *, struct bfd_link_info *, asection *,
+ const Elf_Internal_Rela *));
+static boolean elf32_d10v_relocate_section
+ PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
+ bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *,
+ asection **));
+
+/* Use REL instead of RELA to save space. */
#define USE_REL
static reloc_howto_type elf_d10v_howto_table[] =
-{
- /* This reloc does nothing. */
- HOWTO (R_D10V_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_D10V_NONE", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false), /* pcrel_offset */
-
- /* An PC Relative 10-bit relocation, shifted by 2 */
- /* right container */
- HOWTO (R_D10V_10_PCREL_R, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 10, /* bitsize */
- true, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_D10V_10_PCREL_R", /* name */
- false, /* partial_inplace */
- 0xff, /* src_mask */
- 0xff, /* dst_mask */
- true), /* pcrel_offset */
-
- /* An PC Relative 10-bit relocation, shifted by 2 */
- /* left container */
- HOWTO (R_D10V_10_PCREL_L, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 10, /* bitsize */
- true, /* pc_relative */
- 15, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_D10V_10_PCREL_L", /* name */
- false, /* partial_inplace */
- 0x07f8000, /* src_mask */
- 0x07f8000, /* dst_mask */
- true), /* pcrel_offset */
-
- /* A 16 bit absolute relocation */
- HOWTO (R_D10V_16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_D10V_16", /* name */
- false, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- false), /* pcrel_offset */
-
- /* An 18 bit absolute relocation, right shifted 2 */
- HOWTO (R_D10V_18, /* type */
- 2, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 18, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_D10V_18", /* name */
- false, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- false), /* pcrel_offset */
-
- /* A relative 18 bit relocation, right shifted by 2 */
- HOWTO (R_D10V_18_PCREL, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 18, /* bitsize */
- true, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_D10V_18_PCREL", /* name */
- false, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- true), /* pcrel_offset */
-
- /* A 32 bit absolute relocation */
- HOWTO (R_D10V_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 */
- bfd_elf_generic_reloc, /* special_function */
- "R_D10V_32", /* name */
- false, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
-
- /* GNU extension to record C++ vtable hierarchy */
- HOWTO (R_D10V_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_D10V_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_D10V_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_D10V_GNU_VTENTRY", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false), /* pcrel_offset */
-
-};
+ {
+ /* This reloc does nothing. */
+ HOWTO (R_D10V_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_D10V_NONE", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* An PC Relative 10-bit relocation, shifted by 2 */
+ /* right container */
+ HOWTO (R_D10V_10_PCREL_R, /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 10, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_D10V_10_PCREL_R", /* name */
+ false, /* partial_inplace */
+ 0xff, /* src_mask */
+ 0xff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* An PC Relative 10-bit relocation, shifted by 2 */
+ /* left container */
+ HOWTO (R_D10V_10_PCREL_L, /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 10, /* bitsize */
+ true, /* pc_relative */
+ 15, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_D10V_10_PCREL_L", /* name */
+ false, /* partial_inplace */
+ 0x07f8000, /* src_mask */
+ 0x07f8000, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* A 16 bit absolute relocation */
+ HOWTO (R_D10V_16, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_D10V_16", /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* An 18 bit absolute relocation, right shifted 2 */
+ HOWTO (R_D10V_18, /* type */
+ 2, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 18, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_D10V_18", /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* A relative 18 bit relocation, right shifted by 2 */
+ HOWTO (R_D10V_18_PCREL, /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 18, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_D10V_18_PCREL", /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* A 32 bit absolute relocation */
+ HOWTO (R_D10V_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 */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_D10V_32", /* name */
+ false, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* GNU extension to record C++ vtable hierarchy */
+ HOWTO (R_D10V_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_D10V_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_D10V_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_D10V_GNU_VTENTRY", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+ };
/* Map BFD reloc types to D10V ELF reloc types. */
struct d10v_reloc_map
-{
- bfd_reloc_code_real_type bfd_reloc_val;
- unsigned char elf_reloc_val;
-};
-
- static const struct d10v_reloc_map d10v_reloc_map[] =
-{
- { BFD_RELOC_NONE, R_D10V_NONE, },
- { BFD_RELOC_D10V_10_PCREL_R, R_D10V_10_PCREL_R },
- { BFD_RELOC_D10V_10_PCREL_L, R_D10V_10_PCREL_L },
- { BFD_RELOC_16, R_D10V_16 },
- { BFD_RELOC_D10V_18, R_D10V_18 },
- { BFD_RELOC_D10V_18_PCREL, R_D10V_18_PCREL },
- { BFD_RELOC_32, R_D10V_32 },
- { BFD_RELOC_VTABLE_INHERIT, R_D10V_GNU_VTINHERIT },
- { BFD_RELOC_VTABLE_ENTRY, R_D10V_GNU_VTENTRY },
-};
+ {
+ bfd_reloc_code_real_type bfd_reloc_val;
+ unsigned char elf_reloc_val;
+ };
+
+static const struct d10v_reloc_map d10v_reloc_map[] =
+ {
+ { BFD_RELOC_NONE, R_D10V_NONE, },
+ { BFD_RELOC_D10V_10_PCREL_R, R_D10V_10_PCREL_R },
+ { BFD_RELOC_D10V_10_PCREL_L, R_D10V_10_PCREL_L },
+ { BFD_RELOC_16, R_D10V_16 },
+ { BFD_RELOC_D10V_18, R_D10V_18 },
+ { BFD_RELOC_D10V_18_PCREL, R_D10V_18_PCREL },
+ { BFD_RELOC_32, R_D10V_32 },
+ { BFD_RELOC_VTABLE_INHERIT, R_D10V_GNU_VTINHERIT },
+ { BFD_RELOC_VTABLE_ENTRY, R_D10V_GNU_VTENTRY },
+ };
static reloc_howto_type *
bfd_elf32_bfd_reloc_type_lookup (abfd, code)