mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-07-13 19:30:53 +08:00
* elf32-bfin.c (bfd_const_reloc, bfd_oper_reloc, bfin_push_reloc,
RELOC_STACK_SIZE, reloc_stack, reloc_stack_tos, is_reloc_stack_empty, reloc_stack_push, reloc_stack_pop, reloc_stack_operate, bfin_areloc_howto_table): Delete. All uses deleted as well. (bfin_reloc_map): Delete all stack relocs. (bfin_info_to_howto, bfin_bfd_reloc_type_lookup, bfin_reloc_type_lookup): Don't support them. (bfin_relocate_section): Don't try to handle them.
This commit is contained in:
@ -1,3 +1,15 @@
|
|||||||
|
2006-03-25 Bernd Schmidt <bernd.schmidt@analog.com>
|
||||||
|
|
||||||
|
* elf32-bfin.c (bfd_const_reloc, bfd_oper_reloc, bfin_push_reloc,
|
||||||
|
RELOC_STACK_SIZE, reloc_stack, reloc_stack_tos, is_reloc_stack_empty,
|
||||||
|
reloc_stack_push, reloc_stack_pop, reloc_stack_operate,
|
||||||
|
bfin_areloc_howto_table): Delete. All
|
||||||
|
uses deleted as well.
|
||||||
|
(bfin_reloc_map): Delete all stack relocs.
|
||||||
|
(bfin_info_to_howto, bfin_bfd_reloc_type_lookup,
|
||||||
|
bfin_reloc_type_lookup): Don't support them.
|
||||||
|
(bfin_relocate_section): Don't try to handle them.
|
||||||
|
|
||||||
2006-03-25 Richard Sandiford <richard@codesourcery.com>
|
2006-03-25 Richard Sandiford <richard@codesourcery.com>
|
||||||
|
|
||||||
* cpu-m68k.c (bfd_m68k_compatible): Treat ISA A+ and ISA B code as
|
* cpu-m68k.c (bfd_m68k_compatible): Treat ISA A+ and ISA B code as
|
||||||
|
679
bfd/elf32-bfin.c
679
bfd/elf32-bfin.c
@ -24,167 +24,6 @@
|
|||||||
#include "elf-bfd.h"
|
#include "elf-bfd.h"
|
||||||
#include "elf/bfin.h"
|
#include "elf/bfin.h"
|
||||||
|
|
||||||
/* Handling expression relocations for blackfin. Blackfin
|
|
||||||
will generate relocations in an expression form with a stack.
|
|
||||||
A relocation such as P1.H = _typenames-4000000;
|
|
||||||
will generate the following relocs at offset 4:
|
|
||||||
00000004 R_expst_push _typenames
|
|
||||||
00000004 R_expst_const .__constant
|
|
||||||
00000004 R_expst_sub .__operator
|
|
||||||
00000006 R_huimm16 .__operator
|
|
||||||
|
|
||||||
The .__constant and .__operator symbol names are fake.
|
|
||||||
Special case is a single relocation
|
|
||||||
P1.L = _typenames; generates
|
|
||||||
00000002 R_luimm16 _typenames
|
|
||||||
|
|
||||||
Thus, if you get a R_luimm16, R_huimm16, R_imm16,
|
|
||||||
if the stack is not empty, pop the stack and
|
|
||||||
put the value, else do the normal thing
|
|
||||||
We will currently assume that the max the stack
|
|
||||||
would grow to is 100. . */
|
|
||||||
|
|
||||||
#define RELOC_STACK_SIZE 100
|
|
||||||
static bfd_vma reloc_stack[RELOC_STACK_SIZE];
|
|
||||||
static unsigned int reloc_stack_tos = 0;
|
|
||||||
|
|
||||||
#define is_reloc_stack_empty() ((reloc_stack_tos > 0) ? 0 : 1)
|
|
||||||
|
|
||||||
static void
|
|
||||||
reloc_stack_push (bfd_vma value)
|
|
||||||
{
|
|
||||||
reloc_stack[reloc_stack_tos++] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bfd_vma
|
|
||||||
reloc_stack_pop (void)
|
|
||||||
{
|
|
||||||
return reloc_stack[--reloc_stack_tos];
|
|
||||||
}
|
|
||||||
|
|
||||||
static bfd_vma
|
|
||||||
reloc_stack_operate (unsigned int oper)
|
|
||||||
{
|
|
||||||
bfd_vma value;
|
|
||||||
switch (oper)
|
|
||||||
{
|
|
||||||
case R_add:
|
|
||||||
{
|
|
||||||
value =
|
|
||||||
reloc_stack[reloc_stack_tos - 2] + reloc_stack[reloc_stack_tos - 1];
|
|
||||||
reloc_stack_tos -= 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case R_sub:
|
|
||||||
{
|
|
||||||
value =
|
|
||||||
reloc_stack[reloc_stack_tos - 2] - reloc_stack[reloc_stack_tos - 1];
|
|
||||||
reloc_stack_tos -= 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case R_mult:
|
|
||||||
{
|
|
||||||
value =
|
|
||||||
reloc_stack[reloc_stack_tos - 2] * reloc_stack[reloc_stack_tos - 1];
|
|
||||||
reloc_stack_tos -= 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case R_div:
|
|
||||||
{
|
|
||||||
if (reloc_stack[reloc_stack_tos - 1] == 0)
|
|
||||||
{
|
|
||||||
_bfd_abort (__FILE__, __LINE__, _("Division by zero. "));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
value =
|
|
||||||
reloc_stack[reloc_stack_tos - 2] / reloc_stack[reloc_stack_tos - 1];
|
|
||||||
reloc_stack_tos -= 2;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case R_mod:
|
|
||||||
{
|
|
||||||
value =
|
|
||||||
reloc_stack[reloc_stack_tos - 2] % reloc_stack[reloc_stack_tos - 1];
|
|
||||||
reloc_stack_tos -= 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case R_lshift:
|
|
||||||
{
|
|
||||||
value =
|
|
||||||
reloc_stack[reloc_stack_tos - 2] << reloc_stack[reloc_stack_tos -
|
|
||||||
1];
|
|
||||||
reloc_stack_tos -= 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case R_rshift:
|
|
||||||
{
|
|
||||||
value =
|
|
||||||
reloc_stack[reloc_stack_tos - 2] >> reloc_stack[reloc_stack_tos -
|
|
||||||
1];
|
|
||||||
reloc_stack_tos -= 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case R_and:
|
|
||||||
{
|
|
||||||
value =
|
|
||||||
reloc_stack[reloc_stack_tos - 2] & reloc_stack[reloc_stack_tos - 1];
|
|
||||||
reloc_stack_tos -= 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case R_or:
|
|
||||||
{
|
|
||||||
value =
|
|
||||||
reloc_stack[reloc_stack_tos - 2] | reloc_stack[reloc_stack_tos - 1];
|
|
||||||
reloc_stack_tos -= 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case R_xor:
|
|
||||||
{
|
|
||||||
value =
|
|
||||||
reloc_stack[reloc_stack_tos - 2] ^ reloc_stack[reloc_stack_tos - 1];
|
|
||||||
reloc_stack_tos -= 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case R_land:
|
|
||||||
{
|
|
||||||
value = reloc_stack[reloc_stack_tos - 2]
|
|
||||||
&& reloc_stack[reloc_stack_tos - 1];
|
|
||||||
reloc_stack_tos -= 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case R_lor:
|
|
||||||
{
|
|
||||||
value = reloc_stack[reloc_stack_tos - 2]
|
|
||||||
|| reloc_stack[reloc_stack_tos - 1];
|
|
||||||
reloc_stack_tos -= 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case R_neg:
|
|
||||||
{
|
|
||||||
value = -reloc_stack[reloc_stack_tos - 1];
|
|
||||||
reloc_stack_tos--;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case R_comp:
|
|
||||||
{
|
|
||||||
value = ~reloc_stack[reloc_stack_tos - 1];
|
|
||||||
reloc_stack_tos -= 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
fprintf (stderr, "bfin relocation : Internal bug\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
reloc_stack_push (value);
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FUNCTION : bfin_pltpc_reloc
|
/* FUNCTION : bfin_pltpc_reloc
|
||||||
ABSTRACT : TODO : figure out how to handle pltpc relocs. */
|
ABSTRACT : TODO : figure out how to handle pltpc relocs. */
|
||||||
static bfd_reloc_status_type
|
static bfd_reloc_status_type
|
||||||
@ -221,10 +60,6 @@ bfin_pcrel24_reloc (bfd *abfd,
|
|||||||
if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
|
if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
|
||||||
return bfd_reloc_outofrange;
|
return bfd_reloc_outofrange;
|
||||||
|
|
||||||
if (!is_reloc_stack_empty ())
|
|
||||||
relocation = reloc_stack_pop();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (bfd_is_und_section (symbol->section)
|
if (bfd_is_und_section (symbol->section)
|
||||||
&& (symbol->flags & BSF_WEAK) == 0
|
&& (symbol->flags & BSF_WEAK) == 0
|
||||||
&& !relocatable)
|
&& !relocatable)
|
||||||
@ -247,7 +82,6 @@ bfin_pcrel24_reloc (bfd *abfd,
|
|||||||
|
|
||||||
if (!relocatable && !strcmp (symbol->name, symbol->section->name))
|
if (!relocatable && !strcmp (symbol->name, symbol->section->name))
|
||||||
relocation += reloc_entry->addend;
|
relocation += reloc_entry->addend;
|
||||||
}
|
|
||||||
|
|
||||||
relocation -= input_section->output_section->vma + input_section->output_offset;
|
relocation -= input_section->output_section->vma + input_section->output_offset;
|
||||||
relocation -= reloc_entry->address;
|
relocation -= reloc_entry->address;
|
||||||
@ -255,7 +89,7 @@ bfin_pcrel24_reloc (bfd *abfd,
|
|||||||
if (howto->complain_on_overflow != complain_overflow_dont)
|
if (howto->complain_on_overflow != complain_overflow_dont)
|
||||||
{
|
{
|
||||||
bfd_reloc_status_type status;
|
bfd_reloc_status_type status;
|
||||||
status= bfd_check_overflow (howto->complain_on_overflow,
|
status = bfd_check_overflow (howto->complain_on_overflow,
|
||||||
howto->bitsize,
|
howto->bitsize,
|
||||||
howto->rightshift,
|
howto->rightshift,
|
||||||
bfd_arch_bits_per_address(abfd),
|
bfd_arch_bits_per_address(abfd),
|
||||||
@ -304,96 +138,6 @@ bfin_pcrel24_reloc (bfd *abfd,
|
|||||||
return bfd_reloc_ok;
|
return bfd_reloc_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bfd_reloc_status_type
|
|
||||||
bfin_push_reloc (bfd *abfd ATTRIBUTE_UNUSED,
|
|
||||||
arelent *reloc_entry,
|
|
||||||
asymbol *symbol,
|
|
||||||
PTR data ATTRIBUTE_UNUSED,
|
|
||||||
asection *input_section,
|
|
||||||
bfd *output_bfd,
|
|
||||||
char **error_message ATTRIBUTE_UNUSED)
|
|
||||||
{
|
|
||||||
bfd_vma relocation;
|
|
||||||
bfd_vma output_base = 0;
|
|
||||||
asection *output_section;
|
|
||||||
bfd_boolean relocatable = (output_bfd != NULL);
|
|
||||||
|
|
||||||
if (bfd_is_und_section (symbol->section)
|
|
||||||
&& (symbol->flags & BSF_WEAK) == 0
|
|
||||||
&& !relocatable)
|
|
||||||
return bfd_reloc_undefined;
|
|
||||||
|
|
||||||
/* Is the address of the relocation really within the section? */
|
|
||||||
if (reloc_entry->address > bfd_get_section_limit(abfd, input_section))
|
|
||||||
return bfd_reloc_outofrange;
|
|
||||||
|
|
||||||
output_section = symbol->section->output_section;
|
|
||||||
relocation = symbol->value;
|
|
||||||
|
|
||||||
/* Convert input-section-relative symbol value to absolute. */
|
|
||||||
if (relocatable)
|
|
||||||
output_base = 0;
|
|
||||||
else
|
|
||||||
output_base = output_section->vma;
|
|
||||||
|
|
||||||
if (!relocatable || !strcmp(symbol->name, symbol->section->name))
|
|
||||||
relocation += output_base + symbol->section->output_offset;
|
|
||||||
|
|
||||||
/* Add in supplied addend. */
|
|
||||||
relocation += reloc_entry->addend;
|
|
||||||
|
|
||||||
if (relocatable)
|
|
||||||
{
|
|
||||||
reloc_entry->address += input_section->output_offset;
|
|
||||||
reloc_entry->addend += symbol->section->output_offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now that we have the value, push it. */
|
|
||||||
reloc_stack_push (relocation);
|
|
||||||
|
|
||||||
return bfd_reloc_ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bfd_reloc_status_type
|
|
||||||
bfin_oper_reloc (bfd *abfd ATTRIBUTE_UNUSED,
|
|
||||||
arelent *reloc_entry,
|
|
||||||
asymbol *symbol ATTRIBUTE_UNUSED,
|
|
||||||
PTR data ATTRIBUTE_UNUSED,
|
|
||||||
asection *input_section,
|
|
||||||
bfd *output_bfd,
|
|
||||||
char **error_message ATTRIBUTE_UNUSED)
|
|
||||||
{
|
|
||||||
bfd_boolean relocatable = (output_bfd != NULL);
|
|
||||||
|
|
||||||
/* Just call the operation based on the reloc_type. */
|
|
||||||
reloc_stack_operate (reloc_entry->howto->type);
|
|
||||||
|
|
||||||
if (relocatable)
|
|
||||||
reloc_entry->address += input_section->output_offset;
|
|
||||||
|
|
||||||
return bfd_reloc_ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bfd_reloc_status_type
|
|
||||||
bfin_const_reloc (bfd *abfd ATTRIBUTE_UNUSED,
|
|
||||||
arelent *reloc_entry,
|
|
||||||
asymbol *symbol ATTRIBUTE_UNUSED,
|
|
||||||
PTR data ATTRIBUTE_UNUSED,
|
|
||||||
asection *input_section,
|
|
||||||
bfd *output_bfd,
|
|
||||||
char **error_message ATTRIBUTE_UNUSED)
|
|
||||||
{
|
|
||||||
bfd_boolean relocatable = (output_bfd != NULL);
|
|
||||||
|
|
||||||
/* Push the addend portion of the relocation. */
|
|
||||||
reloc_stack_push (reloc_entry->addend);
|
|
||||||
|
|
||||||
if (relocatable)
|
|
||||||
reloc_entry->address += input_section->output_offset;
|
|
||||||
|
|
||||||
return bfd_reloc_ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bfd_reloc_status_type
|
static bfd_reloc_status_type
|
||||||
bfin_imm16_reloc (bfd *abfd,
|
bfin_imm16_reloc (bfd *abfd,
|
||||||
arelent *reloc_entry,
|
arelent *reloc_entry,
|
||||||
@ -414,8 +158,6 @@ bfin_imm16_reloc (bfd *abfd,
|
|||||||
if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
|
if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
|
||||||
return bfd_reloc_outofrange;
|
return bfd_reloc_outofrange;
|
||||||
|
|
||||||
if (is_reloc_stack_empty ())
|
|
||||||
{
|
|
||||||
if (bfd_is_und_section (symbol->section)
|
if (bfd_is_und_section (symbol->section)
|
||||||
&& (symbol->flags & BSF_WEAK) == 0
|
&& (symbol->flags & BSF_WEAK) == 0
|
||||||
&& !relocatable)
|
&& !relocatable)
|
||||||
@ -435,11 +177,6 @@ bfin_imm16_reloc (bfd *abfd,
|
|||||||
|
|
||||||
/* Add in supplied addend. */
|
/* Add in supplied addend. */
|
||||||
relocation += reloc_entry->addend;
|
relocation += reloc_entry->addend;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
relocation = reloc_stack_pop ();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (relocatable)
|
if (relocatable)
|
||||||
{
|
{
|
||||||
@ -463,7 +200,6 @@ bfin_imm16_reloc (bfd *abfd,
|
|||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Here the variable relocation holds the final address of the
|
/* Here the variable relocation holds the final address of the
|
||||||
symbol we are relocating against, plus any addend. */
|
symbol we are relocating against, plus any addend. */
|
||||||
|
|
||||||
@ -493,8 +229,6 @@ bfin_byte4_reloc (bfd *abfd,
|
|||||||
if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
|
if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
|
||||||
return bfd_reloc_outofrange;
|
return bfd_reloc_outofrange;
|
||||||
|
|
||||||
if (is_reloc_stack_empty ())
|
|
||||||
{
|
|
||||||
if (bfd_is_und_section (symbol->section)
|
if (bfd_is_und_section (symbol->section)
|
||||||
&& (symbol->flags & BSF_WEAK) == 0
|
&& (symbol->flags & BSF_WEAK) == 0
|
||||||
&& !relocatable)
|
&& !relocatable)
|
||||||
@ -517,12 +251,6 @@ bfin_byte4_reloc (bfd *abfd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
relocation += reloc_entry->addend;
|
relocation += reloc_entry->addend;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
relocation = reloc_stack_pop();
|
|
||||||
relocation += reloc_entry->addend;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (relocatable)
|
if (relocatable)
|
||||||
{
|
{
|
||||||
@ -568,8 +296,6 @@ bfin_bfd_reloc (bfd *abfd,
|
|||||||
if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
|
if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
|
||||||
return bfd_reloc_outofrange;
|
return bfd_reloc_outofrange;
|
||||||
|
|
||||||
if (is_reloc_stack_empty())
|
|
||||||
{
|
|
||||||
if (bfd_is_und_section (symbol->section)
|
if (bfd_is_und_section (symbol->section)
|
||||||
&& (symbol->flags & BSF_WEAK) == 0
|
&& (symbol->flags & BSF_WEAK) == 0
|
||||||
&& !relocatable)
|
&& !relocatable)
|
||||||
@ -598,12 +324,6 @@ bfin_bfd_reloc (bfd *abfd,
|
|||||||
relocation += reloc_entry->addend;
|
relocation += reloc_entry->addend;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
relocation = reloc_stack_pop();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Here the variable relocation holds the final address of the
|
/* Here the variable relocation holds the final address of the
|
||||||
symbol we are relocating against, plus any addend. */
|
symbol we are relocating against, plus any addend. */
|
||||||
|
|
||||||
@ -676,38 +396,6 @@ bfin_bfd_reloc (bfd *abfd,
|
|||||||
return bfd_reloc_ok;
|
return bfd_reloc_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static bfd_reloc_status_type bfin_bfd_reloc
|
|
||||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
|
||||||
|
|
||||||
static bfd_reloc_status_type bfin_imm16_reloc
|
|
||||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
|
||||||
|
|
||||||
static bfd_reloc_status_type bfin_pcrel24_reloc
|
|
||||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
|
||||||
|
|
||||||
static bfd_reloc_status_type bfin_pltpc_reloc
|
|
||||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
|
||||||
|
|
||||||
static bfd_reloc_status_type bfin_const_reloc
|
|
||||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
|
||||||
|
|
||||||
static bfd_reloc_status_type bfin_oper_reloc
|
|
||||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
|
||||||
|
|
||||||
static bfd_reloc_status_type bfin_byte4_reloc
|
|
||||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
|
||||||
|
|
||||||
static bfd_reloc_status_type bfin_push_reloc
|
|
||||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
|
||||||
|
|
||||||
static bfd_boolean bfin_is_local_label_name
|
|
||||||
PARAMS ((bfd *, const char *));
|
|
||||||
#endif
|
|
||||||
bfd_boolean bfd_bfin_elf32_create_embedded_relocs
|
|
||||||
PARAMS ((bfd *, struct bfd_link_info *, asection *, asection *, char **));
|
|
||||||
|
|
||||||
|
|
||||||
/* HOWTO Table for blackfin.
|
/* HOWTO Table for blackfin.
|
||||||
Blackfin relocations are fairly complicated.
|
Blackfin relocations are fairly complicated.
|
||||||
Some of the salient features are
|
Some of the salient features are
|
||||||
@ -1016,289 +704,6 @@ static reloc_howto_type bfin_howto_table [] =
|
|||||||
FALSE), /* pcrel_offset. */
|
FALSE), /* pcrel_offset. */
|
||||||
};
|
};
|
||||||
|
|
||||||
static reloc_howto_type bfin_areloc_howto_table [] =
|
|
||||||
{
|
|
||||||
HOWTO (R_push,
|
|
||||||
0,
|
|
||||||
2,
|
|
||||||
0,
|
|
||||||
FALSE,
|
|
||||||
0,
|
|
||||||
complain_overflow_dont,
|
|
||||||
bfin_push_reloc,
|
|
||||||
"R_expst_push",
|
|
||||||
FALSE,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
FALSE),
|
|
||||||
|
|
||||||
HOWTO (R_const,
|
|
||||||
0,
|
|
||||||
2,
|
|
||||||
0,
|
|
||||||
FALSE,
|
|
||||||
0,
|
|
||||||
complain_overflow_dont,
|
|
||||||
bfin_const_reloc,
|
|
||||||
"R_expst_const",
|
|
||||||
FALSE,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
FALSE),
|
|
||||||
|
|
||||||
HOWTO (R_add,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
FALSE,
|
|
||||||
0,
|
|
||||||
complain_overflow_dont,
|
|
||||||
bfin_oper_reloc,
|
|
||||||
"R_expst_add",
|
|
||||||
FALSE,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
FALSE),
|
|
||||||
|
|
||||||
HOWTO (R_sub,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
FALSE,
|
|
||||||
0,
|
|
||||||
complain_overflow_dont,
|
|
||||||
bfin_oper_reloc,
|
|
||||||
"R_expst_sub",
|
|
||||||
FALSE,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
FALSE),
|
|
||||||
|
|
||||||
HOWTO (R_mult,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
FALSE,
|
|
||||||
0,
|
|
||||||
complain_overflow_dont,
|
|
||||||
bfin_oper_reloc,
|
|
||||||
"R_expst_mult",
|
|
||||||
FALSE,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
FALSE),
|
|
||||||
|
|
||||||
HOWTO (R_div, /* type. */
|
|
||||||
0, /* rightshift. */
|
|
||||||
0, /* size (0 = byte, 1 = short, 2 = long). */
|
|
||||||
0, /* bitsize. */
|
|
||||||
FALSE, /* pc_relative. */
|
|
||||||
0, /* bitpos. */
|
|
||||||
complain_overflow_dont, /* complain_on_overflow. */
|
|
||||||
bfin_oper_reloc, /* special_function. */
|
|
||||||
"R_expst_div", /* name. */
|
|
||||||
FALSE, /* partial_inplace. */
|
|
||||||
0, /* src_mask. */
|
|
||||||
0, /* dst_mask. */
|
|
||||||
FALSE), /* pcrel_offset. */
|
|
||||||
|
|
||||||
HOWTO (R_mod, /* type. */
|
|
||||||
0, /* rightshift. */
|
|
||||||
0, /* size (0 = byte, 1 = short, 2 = long). */
|
|
||||||
0, /* bitsize. */
|
|
||||||
FALSE, /* pc_relative. */
|
|
||||||
0, /* bitpos. */
|
|
||||||
complain_overflow_dont, /* complain_on_overflow. */
|
|
||||||
bfin_oper_reloc, /* special_function. */
|
|
||||||
"R_expst_mod", /* name. */
|
|
||||||
FALSE, /* partial_inplace. */
|
|
||||||
0, /* src_mask. */
|
|
||||||
0, /* dst_mask. */
|
|
||||||
FALSE), /* pcrel_offset. */
|
|
||||||
|
|
||||||
HOWTO (R_lshift, /* type. */
|
|
||||||
0, /* rightshift. */
|
|
||||||
0, /* size (0 = byte, 1 = short, 2 = long). */
|
|
||||||
0, /* bitsize. */
|
|
||||||
FALSE, /* pc_relative. */
|
|
||||||
0, /* bitpos. */
|
|
||||||
complain_overflow_dont, /* complain_on_overflow. */
|
|
||||||
bfin_oper_reloc, /* special_function. */
|
|
||||||
"R_expst_lshift", /* name. */
|
|
||||||
FALSE, /* partial_inplace. */
|
|
||||||
0, /* src_mask. */
|
|
||||||
0, /* dst_mask. */
|
|
||||||
FALSE), /* pcrel_offset. */
|
|
||||||
|
|
||||||
HOWTO (R_rshift, /* type. */
|
|
||||||
0, /* rightshift. */
|
|
||||||
0, /* size (0 = byte, 1 = short, 2 = long). */
|
|
||||||
0, /* bitsize. */
|
|
||||||
FALSE, /* pc_relative. */
|
|
||||||
0, /* bitpos. */
|
|
||||||
complain_overflow_dont, /* complain_on_overflow. */
|
|
||||||
bfin_oper_reloc, /* special_function. */
|
|
||||||
"R_expst_rshift", /* name. */
|
|
||||||
FALSE, /* partial_inplace. */
|
|
||||||
0, /* src_mask. */
|
|
||||||
0, /* dst_mask. */
|
|
||||||
FALSE), /* pcrel_offset. */
|
|
||||||
|
|
||||||
HOWTO (R_and, /* type. */
|
|
||||||
0, /* rightshift. */
|
|
||||||
0, /* size (0 = byte, 1 = short, 2 = long). */
|
|
||||||
0, /* bitsize. */
|
|
||||||
FALSE, /* pc_relative. */
|
|
||||||
0, /* bitpos. */
|
|
||||||
complain_overflow_dont, /* complain_on_overflow. */
|
|
||||||
bfin_oper_reloc, /* special_function. */
|
|
||||||
"R_expst_and", /* name. */
|
|
||||||
FALSE, /* partial_inplace. */
|
|
||||||
0, /* src_mask. */
|
|
||||||
0, /* dst_mask. */
|
|
||||||
FALSE), /* pcrel_offset. */
|
|
||||||
|
|
||||||
HOWTO (R_or, /* type. */
|
|
||||||
0, /* rightshift. */
|
|
||||||
0, /* size (0 = byte, 1 = short, 2 = long). */
|
|
||||||
0, /* bitsize. */
|
|
||||||
FALSE, /* pc_relative. */
|
|
||||||
0, /* bitpos. */
|
|
||||||
complain_overflow_dont, /* complain_on_overflow. */
|
|
||||||
bfin_oper_reloc, /* special_function. */
|
|
||||||
"R_expst_or", /* name. */
|
|
||||||
FALSE, /* partial_inplace. */
|
|
||||||
0, /* src_mask. */
|
|
||||||
0, /* dst_mask. */
|
|
||||||
FALSE), /* pcrel_offset. */
|
|
||||||
|
|
||||||
HOWTO (R_xor, /* type. */
|
|
||||||
0, /* rightshift. */
|
|
||||||
0, /* size (0 = byte, 1 = short, 2 = long). */
|
|
||||||
0, /* bitsize. */
|
|
||||||
FALSE, /* pc_relative. */
|
|
||||||
0, /* bitpos. */
|
|
||||||
complain_overflow_dont, /* complain_on_overflow. */
|
|
||||||
bfin_oper_reloc, /* special_function. */
|
|
||||||
"R_expst_xor", /* name. */
|
|
||||||
FALSE, /* partial_inplace. */
|
|
||||||
0, /* src_mask. */
|
|
||||||
0, /* dst_mask. */
|
|
||||||
FALSE), /* pcrel_offset. */
|
|
||||||
|
|
||||||
HOWTO (R_land, /* type. */
|
|
||||||
0, /* rightshift. */
|
|
||||||
0, /* size (0 = byte, 1 = short, 2 = long). */
|
|
||||||
0, /* bitsize. */
|
|
||||||
FALSE, /* pc_relative. */
|
|
||||||
0, /* bitpos. */
|
|
||||||
complain_overflow_dont, /* complain_on_overflow. */
|
|
||||||
bfin_oper_reloc, /* special_function. */
|
|
||||||
"R_expst_land", /* name. */
|
|
||||||
FALSE, /* partial_inplace. */
|
|
||||||
0, /* src_mask. */
|
|
||||||
0, /* dst_mask. */
|
|
||||||
FALSE), /* pcrel_offset. */
|
|
||||||
|
|
||||||
HOWTO (R_lor, /* type. */
|
|
||||||
0, /* rightshift. */
|
|
||||||
0, /* size (0 = byte, 1 = short, 2 = long). */
|
|
||||||
0, /* bitsize. */
|
|
||||||
FALSE, /* pc_relative. */
|
|
||||||
0, /* bitpos. */
|
|
||||||
complain_overflow_dont, /* complain_on_overflow. */
|
|
||||||
bfin_oper_reloc, /* special_function. */
|
|
||||||
"R_expst_lor", /* name. */
|
|
||||||
FALSE, /* partial_inplace. */
|
|
||||||
0, /* src_mask. */
|
|
||||||
0, /* dst_mask. */
|
|
||||||
FALSE), /* pcrel_offset. */
|
|
||||||
|
|
||||||
HOWTO (R_len, /* type. */
|
|
||||||
0, /* rightshift. */
|
|
||||||
0, /* size (0 = byte, 1 = short, 2 = long). */
|
|
||||||
0, /* bitsize. */
|
|
||||||
FALSE, /* pc_relative. */
|
|
||||||
0, /* bitpos. */
|
|
||||||
complain_overflow_dont, /* complain_on_overflow. */
|
|
||||||
bfin_oper_reloc, /* special_function. */
|
|
||||||
"R_expst_len", /* name. */
|
|
||||||
FALSE, /* partial_inplace. */
|
|
||||||
0, /* src_mask. */
|
|
||||||
0, /* dst_mask. */
|
|
||||||
FALSE), /* pcrel_offset. */
|
|
||||||
|
|
||||||
HOWTO (R_neg, /* type. */
|
|
||||||
0, /* rightshift. */
|
|
||||||
0, /* size (0 = byte, 1 = short, 2 = long). */
|
|
||||||
0, /* bitsize. */
|
|
||||||
FALSE, /* pc_relative. */
|
|
||||||
0, /* bitpos. */
|
|
||||||
complain_overflow_dont, /* complain_on_overflow. */
|
|
||||||
bfin_oper_reloc, /* special_function. */
|
|
||||||
"R_expst_neg", /* name. */
|
|
||||||
FALSE, /* partial_inplace. */
|
|
||||||
0, /* src_mask. */
|
|
||||||
0, /* dst_mask. */
|
|
||||||
FALSE), /* pcrel_offset. */
|
|
||||||
|
|
||||||
HOWTO (R_comp, /* type. */
|
|
||||||
0, /* rightshift. */
|
|
||||||
0, /* size (0 = byte, 1 = short, 2 = long). */
|
|
||||||
0, /* bitsize. */
|
|
||||||
FALSE, /* pc_relative. */
|
|
||||||
0, /* bitpos. */
|
|
||||||
complain_overflow_dont, /* complain_on_overflow. */
|
|
||||||
bfin_oper_reloc, /* special_function. */
|
|
||||||
"R_expst_comp", /* name. */
|
|
||||||
FALSE, /* partial_inplace. */
|
|
||||||
0, /* src_mask. */
|
|
||||||
0, /* dst_mask. */
|
|
||||||
FALSE), /* pcrel_offset. */
|
|
||||||
|
|
||||||
HOWTO (R_page, /* type. */
|
|
||||||
0, /* rightshift. */
|
|
||||||
0, /* size (0 = byte, 1 = short, 2 = long). */
|
|
||||||
0, /* bitsize. */
|
|
||||||
FALSE, /* pc_relative. */
|
|
||||||
0, /* bitpos. */
|
|
||||||
complain_overflow_dont, /* complain_on_overflow. */
|
|
||||||
bfin_oper_reloc, /* special_function. */
|
|
||||||
"R_expst_page", /* name. */
|
|
||||||
FALSE, /* partial_inplace. */
|
|
||||||
0, /* src_mask. */
|
|
||||||
0, /* dst_mask. */
|
|
||||||
FALSE), /* pcrel_offset. */
|
|
||||||
|
|
||||||
HOWTO (R_hwpage, /* type. */
|
|
||||||
0, /* rightshift. */
|
|
||||||
0, /* size (0 = byte, 1 = short, 2 = long). */
|
|
||||||
0, /* bitsize. */
|
|
||||||
FALSE, /* pc_relative. */
|
|
||||||
0, /* bitpos. */
|
|
||||||
complain_overflow_dont, /* complain_on_overflow. */
|
|
||||||
bfin_oper_reloc, /* special_function. */
|
|
||||||
"R_expst_hwpage", /* name. */
|
|
||||||
FALSE, /* partial_inplace. */
|
|
||||||
0, /* src_mask. */
|
|
||||||
0, /* dst_mask. */
|
|
||||||
FALSE), /* pcrel_offset. */
|
|
||||||
|
|
||||||
HOWTO (R_addr, /* type. */
|
|
||||||
0, /* rightshift. */
|
|
||||||
0, /* size (0 = byte, 1 = short, 2 = long). */
|
|
||||||
0, /* bitsize. */
|
|
||||||
FALSE, /* pc_relative. */
|
|
||||||
0, /* bitpos. */
|
|
||||||
complain_overflow_dont, /* complain_on_overflow. */
|
|
||||||
bfin_oper_reloc, /* special_function. */
|
|
||||||
"R_expst_addr", /* name. */
|
|
||||||
FALSE, /* partial_inplace. */
|
|
||||||
0, /* src_mask. */
|
|
||||||
0, /* dst_mask. */
|
|
||||||
FALSE), /* pcrel_offset. */
|
|
||||||
};
|
|
||||||
|
|
||||||
static reloc_howto_type bfin_gnuext_howto_table [] =
|
static reloc_howto_type bfin_gnuext_howto_table [] =
|
||||||
{
|
{
|
||||||
HOWTO (R_pltpc, /* type. */
|
HOWTO (R_pltpc, /* type. */
|
||||||
@ -1391,27 +796,6 @@ static const struct bfin_reloc_map bfin_reloc_map [] =
|
|||||||
{ BFD_RELOC_BFIN_PLTPC, R_pltpc },
|
{ BFD_RELOC_BFIN_PLTPC, R_pltpc },
|
||||||
{ BFD_RELOC_VTABLE_INHERIT, R_BFIN_GNU_VTINHERIT },
|
{ BFD_RELOC_VTABLE_INHERIT, R_BFIN_GNU_VTINHERIT },
|
||||||
{ BFD_RELOC_VTABLE_ENTRY, R_BFIN_GNU_VTENTRY },
|
{ BFD_RELOC_VTABLE_ENTRY, R_BFIN_GNU_VTENTRY },
|
||||||
{ BFD_ARELOC_BFIN_PUSH, R_push },
|
|
||||||
{ BFD_ARELOC_BFIN_CONST, R_const },
|
|
||||||
{ BFD_ARELOC_BFIN_ADD, R_add },
|
|
||||||
{ BFD_ARELOC_BFIN_SUB, R_sub },
|
|
||||||
{ BFD_ARELOC_BFIN_MULT, R_mult },
|
|
||||||
{ BFD_ARELOC_BFIN_DIV, R_div },
|
|
||||||
{ BFD_ARELOC_BFIN_MOD, R_mod },
|
|
||||||
{ BFD_ARELOC_BFIN_LSHIFT, R_lshift },
|
|
||||||
{ BFD_ARELOC_BFIN_RSHIFT, R_rshift },
|
|
||||||
{ BFD_ARELOC_BFIN_AND, R_and },
|
|
||||||
{ BFD_ARELOC_BFIN_OR, R_or },
|
|
||||||
{ BFD_ARELOC_BFIN_XOR, R_xor },
|
|
||||||
{ BFD_ARELOC_BFIN_LAND, R_land },
|
|
||||||
{ BFD_ARELOC_BFIN_LOR, R_lor },
|
|
||||||
{ BFD_ARELOC_BFIN_LEN, R_len },
|
|
||||||
{ BFD_ARELOC_BFIN_NEG, R_neg },
|
|
||||||
{ BFD_ARELOC_BFIN_COMP, R_comp },
|
|
||||||
{ BFD_ARELOC_BFIN_PAGE, R_page },
|
|
||||||
{ BFD_ARELOC_BFIN_HWPAGE, R_hwpage },
|
|
||||||
{ BFD_ARELOC_BFIN_ADDR, R_addr }
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1427,9 +811,6 @@ bfin_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
|
|||||||
if (r_type <= BFIN_RELOC_MAX)
|
if (r_type <= BFIN_RELOC_MAX)
|
||||||
cache_ptr->howto = &bfin_howto_table [r_type];
|
cache_ptr->howto = &bfin_howto_table [r_type];
|
||||||
|
|
||||||
else if (r_type >= BFIN_ARELOC_MIN && r_type <= BFIN_ARELOC_MAX)
|
|
||||||
cache_ptr->howto = &bfin_areloc_howto_table [r_type - BFIN_ARELOC_MIN];
|
|
||||||
|
|
||||||
else if (r_type >= BFIN_GNUEXT_RELOC_MIN && r_type <= BFIN_GNUEXT_RELOC_MAX)
|
else if (r_type >= BFIN_GNUEXT_RELOC_MIN && r_type <= BFIN_GNUEXT_RELOC_MAX)
|
||||||
cache_ptr->howto = &bfin_gnuext_howto_table [r_type - BFIN_GNUEXT_RELOC_MIN];
|
cache_ptr->howto = &bfin_gnuext_howto_table [r_type - BFIN_GNUEXT_RELOC_MIN];
|
||||||
|
|
||||||
@ -1452,9 +833,6 @@ bfin_bfd_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
|
|||||||
if (r_type <= BFIN_RELOC_MAX && r_type > BFIN_RELOC_MIN)
|
if (r_type <= BFIN_RELOC_MAX && r_type > BFIN_RELOC_MIN)
|
||||||
return &bfin_howto_table [r_type];
|
return &bfin_howto_table [r_type];
|
||||||
|
|
||||||
else if (r_type >= BFIN_ARELOC_MIN && r_type <= BFIN_ARELOC_MAX)
|
|
||||||
return &bfin_areloc_howto_table [r_type - BFIN_ARELOC_MIN];
|
|
||||||
|
|
||||||
else if (r_type >= BFIN_GNUEXT_RELOC_MIN && r_type <= BFIN_GNUEXT_RELOC_MAX)
|
else if (r_type >= BFIN_GNUEXT_RELOC_MIN && r_type <= BFIN_GNUEXT_RELOC_MAX)
|
||||||
return &bfin_gnuext_howto_table [r_type - BFIN_GNUEXT_RELOC_MIN];
|
return &bfin_gnuext_howto_table [r_type - BFIN_GNUEXT_RELOC_MIN];
|
||||||
|
|
||||||
@ -1469,9 +847,6 @@ bfin_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
|
|||||||
if (r_type <= BFIN_RELOC_MAX)
|
if (r_type <= BFIN_RELOC_MAX)
|
||||||
return &bfin_howto_table [r_type];
|
return &bfin_howto_table [r_type];
|
||||||
|
|
||||||
else if (r_type >= BFIN_ARELOC_MIN && r_type <= BFIN_ARELOC_MAX)
|
|
||||||
return &bfin_areloc_howto_table [r_type - BFIN_ARELOC_MIN];
|
|
||||||
|
|
||||||
else if (r_type >= BFIN_GNUEXT_RELOC_MIN && r_type <= BFIN_GNUEXT_RELOC_MAX)
|
else if (r_type >= BFIN_GNUEXT_RELOC_MIN && r_type <= BFIN_GNUEXT_RELOC_MAX)
|
||||||
return &bfin_gnuext_howto_table [r_type - BFIN_GNUEXT_RELOC_MIN];
|
return &bfin_gnuext_howto_table [r_type - BFIN_GNUEXT_RELOC_MIN];
|
||||||
|
|
||||||
@ -1734,16 +1109,6 @@ bfin_relocate_section (bfd * output_bfd,
|
|||||||
relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
|
relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
|
|
||||||
|
|
||||||
while (h->root.type == bfd_link_hash_indirect
|
|
||||||
|| h->root.type == bfd_link_hash_warning)
|
|
||||||
h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
|
||||||
|
|
||||||
if (!
|
|
||||||
(!strcmp (h->root.root.string, ".__constant")
|
|
||||||
|| !strcmp (h->root.root.string, ".__operator")))
|
|
||||||
{
|
{
|
||||||
bfd_boolean warned;
|
bfd_boolean warned;
|
||||||
h = NULL;
|
h = NULL;
|
||||||
@ -1751,47 +1116,9 @@ bfin_relocate_section (bfd * output_bfd,
|
|||||||
r_symndx, symtab_hdr, sym_hashes,
|
r_symndx, symtab_hdr, sym_hashes,
|
||||||
h, sec, relocation,
|
h, sec, relocation,
|
||||||
unresolved_reloc, warned);
|
unresolved_reloc, warned);
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
address = rel->r_offset;
|
address = rel->r_offset;
|
||||||
/* First, get stack relocs out of the way. */
|
|
||||||
switch (r_type)
|
|
||||||
{
|
|
||||||
case R_push:
|
|
||||||
reloc_stack_push (relocation + rel->r_addend);
|
|
||||||
r = bfd_reloc_ok;
|
|
||||||
goto done_reloc;
|
|
||||||
case R_const:
|
|
||||||
reloc_stack_push (rel->r_addend);
|
|
||||||
r = bfd_reloc_ok;
|
|
||||||
goto done_reloc;
|
|
||||||
case R_add:
|
|
||||||
case R_sub:
|
|
||||||
case R_mult:
|
|
||||||
case R_div:
|
|
||||||
case R_mod:
|
|
||||||
case R_lshift:
|
|
||||||
case R_rshift:
|
|
||||||
case R_neg:
|
|
||||||
case R_and:
|
|
||||||
case R_or:
|
|
||||||
case R_xor:
|
|
||||||
case R_land:
|
|
||||||
case R_lor:
|
|
||||||
case R_comp:
|
|
||||||
case R_page:
|
|
||||||
case R_hwpage:
|
|
||||||
reloc_stack_operate (r_type);
|
|
||||||
r = bfd_reloc_ok;
|
|
||||||
goto done_reloc;
|
|
||||||
|
|
||||||
default:
|
|
||||||
if (!is_reloc_stack_empty())
|
|
||||||
relocation = reloc_stack_pop ();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Then, process normally. */
|
/* Then, process normally. */
|
||||||
switch (r_type)
|
switch (r_type)
|
||||||
@ -1947,7 +1274,6 @@ bfin_relocate_section (bfd * output_bfd,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
done_reloc:
|
|
||||||
/* Dynamic relocs are not propagated for SEC_DEBUGGING sections
|
/* Dynamic relocs are not propagated for SEC_DEBUGGING sections
|
||||||
because such sections are not SEC_ALLOC and thus ld.so will
|
because such sections are not SEC_ALLOC and thus ld.so will
|
||||||
not process them. */
|
not process them. */
|
||||||
@ -2668,6 +1994,9 @@ bfin_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
|
|||||||
after the add_symbols entry point has been called for all the
|
after the add_symbols entry point has been called for all the
|
||||||
objects, and before the final_link entry point is called. */
|
objects, and before the final_link entry point is called. */
|
||||||
|
|
||||||
|
bfd_boolean bfd_bfin_elf32_create_embedded_relocs
|
||||||
|
PARAMS ((bfd *, struct bfd_link_info *, asection *, asection *, char **));
|
||||||
|
|
||||||
bfd_boolean
|
bfd_boolean
|
||||||
bfd_bfin_elf32_create_embedded_relocs (
|
bfd_bfin_elf32_create_embedded_relocs (
|
||||||
bfd *abfd,
|
bfd *abfd,
|
||||||
|
Reference in New Issue
Block a user