summaryrefslogtreecommitdiff
path: root/bfd/elf32-tic6x.c
diff options
context:
space:
mode:
authorBernd Schmidt <bernd.schmidt@analog.com>2011-05-20 10:09:57 +0000
committerBernd Schmidt <bernd.schmidt@analog.com>2011-05-20 10:09:57 +0000
commit007790abbb362d0a598901e7fce4742a3d49ad26 (patch)
tree3bdd94f22871ab26c3b4a0f184e26726510c4672 /bfd/elf32-tic6x.c
parent8981ada0fb407235c5af168912ede90f31e5f9e2 (diff)
downloadbinutils-redhat-007790abbb362d0a598901e7fce4742a3d49ad26.tar.gz
ld/testsuite/
* ld-tic6x/pcr-reloc.d: New test. * ld-tic6x/pcr-reloc.s: New test. gas/testsuite/ * gas/tic6x/pcr-relocs.d: New test. * gas/tic6x/pcr-relocs.s: New test. * gas/tic6x/pcr-relocs-undef.d: New test. * gas/tic6x/pcr-relocs-undef.s: New test. * gas/tic6x/reloc-bad-2.s: Update for pcr_offset. * gas/tic6x/reloc-bad-2.l: Update for pcr_offset. bfd/ * elf32-tic6x.c (elf32_tic6x_howto_table): Add entries for R_C6000_PCR_H16 and R_C6000_PCR_L16. (elf32_tic6x_relocate_section): Handle them. gas/ * config/tc-tic6x.c (tic6x_operators): Add "pcr_offset". (tic6x_parse_name): Handle it. (tic6x_fix_new_exp): Handle O_pcr_offset. (tic6x_fix_adjustable): Return 0 for the new relocs. (md_apply_fix): Handle them. (tc_gen_reloc): Likewise. * config/tc-tic6x.h (tic6x_fix_info): Add a fix_subsy member.
Diffstat (limited to 'bfd/elf32-tic6x.c')
-rw-r--r--bfd/elf32-tic6x.c48
1 files changed, 43 insertions, 5 deletions
diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c
index efacfb9fb9..9b2b0f03c9 100644
--- a/bfd/elf32-tic6x.c
+++ b/bfd/elf32-tic6x.c
@@ -528,8 +528,32 @@ static reloc_howto_type elf32_tic6x_howto_table[] =
0, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
- EMPTY_HOWTO (29),
- EMPTY_HOWTO (30),
+ HOWTO (R_C6000_PCR_H16, /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ TRUE, /* pc_relative */
+ 7, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_C6000_PCR_H16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x007fff80, /* dst_mask */
+ TRUE), /* pcrel_offset */
+ HOWTO (R_C6000_PCR_L16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ TRUE, /* pc_relative */
+ 7, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_C6000_PCR_L16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x007fff80, /* dst_mask */
+ TRUE), /* pcrel_offset */
EMPTY_HOWTO (31),
EMPTY_HOWTO (32),
EMPTY_HOWTO (33),
@@ -1112,8 +1136,8 @@ static reloc_howto_type elf32_tic6x_howto_table_rel[] =
0, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
- EMPTY_HOWTO (29),
- EMPTY_HOWTO (30),
+ EMPTY_HOWTO (R_C6000_PCR_H16),
+ EMPTY_HOWTO (R_C6000_PCR_L16),
EMPTY_HOWTO (31),
EMPTY_HOWTO (32),
EMPTY_HOWTO (33),
@@ -2264,7 +2288,7 @@ elf32_tic6x_relocate_section (bfd *output_bfd,
Elf_Internal_Sym *sym;
asection *sec;
struct elf_link_hash_entry *h;
- bfd_vma off, relocation;
+ bfd_vma off, off2, relocation;
bfd_boolean unresolved_reloc;
bfd_reloc_status_type r;
struct bfd_link_hash_entry *sbh;
@@ -2378,6 +2402,20 @@ elf32_tic6x_relocate_section (bfd *output_bfd,
unresolved_reloc = FALSE;
break;
+ case R_C6000_PCR_H16:
+ case R_C6000_PCR_L16:
+ off = (input_section->output_section->vma
+ + input_section->output_offset
+ + rel->r_offset);
+ /* These must be calculated as R = S - FP(FP(PC) - A).
+ PC, here, is the value we just computed in OFF. RELOCATION
+ has the address of S + A. */
+ relocation -= rel->r_addend;
+ off2 = ((off & ~(bfd_vma)0x1f) - rel->r_addend) & (bfd_vma)~0x1f;
+ off2 = relocation - off2;
+ relocation = off + off2;
+ break;
+
case R_C6000_DSBT_INDEX:
relocation = elf32_tic6x_hash_table (info)->params.dsbt_index;
if (!info->shared || relocation != 0)