From f865a31d1ed571ccb8d17653b150e3a30f22b30d Mon Sep 17 00:00:00 2001 From: Anthony Green Date: Thu, 11 Jun 2009 11:27:58 +0000 Subject: Add PC-relative branch instructions to moxie port. --- bfd/ChangeLog | 10 ++++++++++ bfd/bfd-in2.h | 4 ++++ bfd/elf32-moxie.c | 21 ++++++++++++++++++--- bfd/libbfd.h | 2 ++ bfd/reloc.c | 6 ++++++ 5 files changed, 40 insertions(+), 3 deletions(-) (limited to 'bfd') diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8d59068..e5e3d97 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,13 @@ +2009-06-11 Anthony Green + + * reloc.c: Add BFD_RELOC_MOXIE_10_PCREL. + * bfd-in2.h: Rebuilt. + * libbfd.h: Rebuilt. + * elf32-moxie.c (moxie_elf_howto_table): Add R_MOXIE_PCREL10 + relocation support. + (moxie_reloc_map): Ditto. + Clean up copyright notice. + 2009-06-10 Paul Pluzhnikov * bfd-in2.h: bfd_mmap prototype. diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 6583aa6..4baa1a4 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -2737,6 +2737,10 @@ to compensate for the borrow when the low bits are added. */ BFD_RELOC_MIPS_JUMP_SLOT, +/* Moxie ELF relocations. */ + BFD_RELOC_MOXIE_10_PCREL, + + /* Fujitsu Frv Relocations. */ BFD_RELOC_FRV_LABEL16, BFD_RELOC_FRV_LABEL24, diff --git a/bfd/elf32-moxie.c b/bfd/elf32-moxie.c index e3f01d2..23a16ff 100644 --- a/bfd/elf32-moxie.c +++ b/bfd/elf32-moxie.c @@ -1,5 +1,4 @@ /* moxie-specific support for 32-bit ELF. - Copyright 2008 Anthony Green. Copyright 2009 Free Software Foundation, Inc. Copied from elf32-fr30.c which is.. @@ -62,6 +61,21 @@ static reloc_howto_type moxie_elf_howto_table [] = 0x00000000, /* src_mask */ 0xffffffff, /* dst_mask */ FALSE), /* pcrel_offset */ + + /* A 10 bit PC-relative relocation. */ + HOWTO (R_MOXIE_PCREL10, /* type. */ + 1, /* rightshift. */ + 1, /* size (0 = byte, 1 = short, 2 = long). */ + 10, /* bitsize. */ + TRUE, /* pc_relative. */ + 0, /* bitpos. */ + complain_overflow_signed, /* complain_on_overflow. */ + bfd_elf_generic_reloc, /* special_function. */ + "R_MOXIE_PCREL10", /* name. */ + FALSE, /* partial_inplace. */ + 0, /* src_mask. */ + 0x000003FF, /* dst_mask. */ + TRUE), /* pcrel_offset. */ }; /* Map BFD reloc types to MOXIE ELF reloc types. */ @@ -74,8 +88,9 @@ struct moxie_reloc_map static const struct moxie_reloc_map moxie_reloc_map [] = { - { BFD_RELOC_NONE, R_MOXIE_NONE }, - { BFD_RELOC_32, R_MOXIE_32 }, + { BFD_RELOC_NONE, R_MOXIE_NONE }, + { BFD_RELOC_32, R_MOXIE_32 }, + { BFD_RELOC_MOXIE_10_PCREL, R_MOXIE_PCREL10 }, }; static reloc_howto_type * diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 7d72e3b..a3bb580 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -1033,6 +1033,8 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_MIPS_COPY", "BFD_RELOC_MIPS_JUMP_SLOT", + "BFD_RELOC_MOXIE_10_PCREL", + "BFD_RELOC_FRV_LABEL16", "BFD_RELOC_FRV_LABEL24", "BFD_RELOC_FRV_LO16", diff --git a/bfd/reloc.c b/bfd/reloc.c index ad002d7..fd82c2d 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -2316,6 +2316,12 @@ ENUMDOC COMMENT ENUM + BFD_RELOC_MOXIE_10_PCREL +ENUMDOC + Moxie ELF relocations. +COMMENT + +ENUM BFD_RELOC_FRV_LABEL16 ENUMX BFD_RELOC_FRV_LABEL24 -- cgit v1.1