/* D10V-specific support for 32-bit ELF
- Copyright 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by Martin Hunt (hunt@cygnus.com).
This file is part of BFD, the Binary File Descriptor library.
static void d10v_info_to_howto_rel
PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
static asection * elf32_d10v_gc_mark_hook
- PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
+ PARAMS ((asection *, 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 *,
asection **));
/* Use REL instead of RELA to save space. */
-#define USE_REL
+#define USE_REL 1
static reloc_howto_type elf_d10v_howto_table[] =
{
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_D10V_NONE", /* name */
- false, /* partial_inplace */
+ complain_overflow_dont, /* 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 */
HOWTO (R_D10V_10_PCREL_R, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
- 10, /* bitsize */
- true, /* pc_relative */
+ 7, /* 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 */
+ false, /* partial_inplace */
+ 0xff, /* src_mask */
0xff, /* dst_mask */
- true), /* pcrel_offset */
+ 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 */
+ 7, /* 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 */
+ 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 */
+ false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_D10V_16", /* name */
- false, /* partial_inplace */
+ false, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
false), /* pcrel_offset */
HOWTO (R_D10V_18, /* type */
2, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
- 18, /* bitsize */
- false, /* pc_relative */
+ 16, /* bitsize */
+ false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_D10V_18", /* name */
- false, /* partial_inplace */
+ false, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
false), /* pcrel_offset */
HOWTO (R_D10V_18_PCREL, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
- 18, /* bitsize */
- true, /* pc_relative */
+ 15, /* bitsize */
+ true, /* pc_relative */
0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
"R_D10V_18_PCREL", /* name */
- false, /* partial_inplace */
+ false, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
true), /* pcrel_offset */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- false, /* pc_relative */
+ false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
"R_D10V_32", /* name */
- false, /* partial_inplace */
+ false, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
}
static asection *
-elf32_d10v_gc_mark_hook (abfd, info, rel, h, sym)
- bfd *abfd;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- Elf_Internal_Rela *rel;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
+elf32_d10v_gc_mark_hook (sec, info, rel, h, sym)
+ asection *sec;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
+ Elf_Internal_Rela *rel;
+ struct elf_link_hash_entry *h;
+ Elf_Internal_Sym *sym;
{
if (h != NULL)
{
}
}
else
- {
- if (!(elf_bad_symtab (abfd)
- && ELF_ST_BIND (sym->st_info) != STB_LOCAL)
- && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
- && sym->st_shndx != SHN_COMMON))
- {
- return bfd_section_from_elf_index (abfd, sym->st_shndx);
- }
- }
+ return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+
return NULL;
}
static boolean
elf32_d10v_relocate_section (output_bfd, info, input_bfd, input_section,
contents, relocs, local_syms, local_sections)
- bfd *output_bfd ATTRIBUTE_UNUSED;
+ bfd *output_bfd;
struct bfd_link_info *info;
bfd *input_bfd;
asection *input_section;
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- relocation = (sec->output_section->vma
- + sec->output_offset
- + sym->st_value);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
}
else
{
break;
case bfd_reloc_outofrange:
- msg = _ ("internal error: out of range error");
+ msg = _("internal error: out of range error");
goto common_error;
case bfd_reloc_notsupported:
- msg = _ ("internal error: unsupported relocation error");
+ msg = _("internal error: unsupported relocation error");
goto common_error;
case bfd_reloc_dangerous:
- msg = _ ("internal error: dangerous error");
+ msg = _("internal error: dangerous error");
goto common_error;
default:
- msg = _ ("internal error: unknown error");
+ msg = _("internal error: unknown error");
/* fall through */
common_error:
return true;
}
#define ELF_ARCH bfd_arch_d10v
-#define ELF_MACHINE_CODE EM_CYGNUS_D10V
+#define ELF_MACHINE_CODE EM_D10V
+#define ELF_MACHINE_ALT1 EM_CYGNUS_D10V
#define ELF_MAXPAGESIZE 0x1000
#define TARGET_BIG_SYM bfd_elf32_d10v_vec