aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-d30v.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf32-d30v.c')
-rw-r--r--bfd/elf32-d30v.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/bfd/elf32-d30v.c b/bfd/elf32-d30v.c
index c7fde2b..43fc9b6 100644
--- a/bfd/elf32-d30v.c
+++ b/bfd/elf32-d30v.c
@@ -280,7 +280,7 @@ bfd_elf_d30v_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
r = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message);
if (r != bfd_reloc_continue)
- return r;
+ return r;
/* a hacked-up version of bfd_perform_reloc() follows */
if (bfd_is_und_section (symbol->section)
@@ -315,11 +315,11 @@ bfd_elf_d30v_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
if (howto->pc_relative == true)
{
- tmp_addr = input_section->output_section->vma + input_section->output_offset
+ tmp_addr = input_section->output_section->vma + input_section->output_offset
+ reloc_entry->address;
relocation -= tmp_addr;
}
-
+
in1 = bfd_get_32 (abfd, (bfd_byte *) data + addr);
in2 = bfd_get_32 (abfd, (bfd_byte *) data + addr + 4);
@@ -329,7 +329,7 @@ bfd_elf_d30v_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
| ((in1 & 0x3F) << 26));
in1 &= 0xFFFFFFC0;
in2 = 0x80000000;
-
+
relocation += num;
if (howto->pc_relative == true && howto->bitsize == 32)
@@ -343,11 +343,11 @@ bfd_elf_d30v_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
make_absolute = 1;
}
}
-
+
in1 |= (relocation >> 26) & 0x3F; /* top 6 bits */
- in2 |= ((relocation & 0x03FC0000) << 2); /* next 8 bits */
+ in2 |= ((relocation & 0x03FC0000) << 2); /* next 8 bits */
in2 |= relocation & 0x0003FFFF; /* bottom 18 bits */
-
+
/* change a PC-relative instruction to its absolute equivalent */
/* with this simple hack */
if (make_absolute)
@@ -355,10 +355,9 @@ bfd_elf_d30v_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
bfd_put_32 (abfd, in1, (bfd_byte *) data + addr);
bfd_put_32 (abfd, in2, (bfd_byte *) data + addr + 4);
-
- return flag;
-}
+ return flag;
+}
static bfd_reloc_status_type
bfd_elf_d30v_reloc_21 (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message)
@@ -386,11 +385,11 @@ bfd_elf_d30v_reloc_21 (abfd, reloc_entry, symbol, data, input_section, output_bf
reloc_entry->address += input_section->output_offset;
return bfd_reloc_ok;
}
-
+
r = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message);
if (r != bfd_reloc_continue)
- return r;
+ return r;
/* a hacked-up version of bfd_perform_reloc() follows */
if (bfd_is_und_section (symbol->section)
@@ -462,16 +461,16 @@ bfd_elf_d30v_reloc_21 (abfd, reloc_entry, symbol, data, input_section, output_bf
if ((int)relocation > max)
flag = bfd_reloc_overflow;
}
- relocation >>= 3;
+ relocation >>= 3;
if (howto->bitsize == 6)
in1 |= ((relocation & (mask >> 12)) << 12);
else
in1 |= relocation & mask;
bfd_put_32 (abfd, in1, (bfd_byte *) data + addr);
-
+
return flag;
-}
+}
/* Map BFD reloc types to D30V ELF reloc types. */
@@ -481,7 +480,6 @@ struct d30v_reloc_map
unsigned char elf_reloc_val;
};
-
static const struct d30v_reloc_map d30v_reloc_map[] =
{
{ BFD_RELOC_NONE, R_D30V_NONE, },