Before include system specific ELF header define

START_RELOC_NUMBERS, RELOC_NUMBER, and END_RELOC_NUMBERS.
This commit is contained in:
Ulrich Drepper 1998-07-22 20:11:16 +00:00
parent e4d7741205
commit 767af63c2c
2 changed files with 47 additions and 27 deletions

View File

@ -1,3 +1,8 @@
1998-07-22 13:08 Ulrich Drepper <drepper@cygnus.com>
* elf-mn10300.c: Before include system specific ELF header define
START_RELOC_NUMBERS, RELOC_NUMBER, and END_RELOC_NUMBERS.
Wed Jul 22 13:46:51 1998 Ian Lance Taylor <ian@cygnus.com> Wed Jul 22 13:46:51 1998 Ian Lance Taylor <ian@cygnus.com>
* elf64-mips.c (mips_elf64_reloc_type): Copy Ulrich's elf32-mips.c * elf64-mips.c (mips_elf64_reloc_type): Copy Ulrich's elf32-mips.c

View File

@ -21,6 +21,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h" #include "sysdep.h"
#include "libbfd.h" #include "libbfd.h"
#include "elf-bfd.h" #include "elf-bfd.h"
#define START_RELOC_NUMBERS(name) enum name {
#define RELOC_NUMBER(name, number) name = number ,
#define END_RELOC_NUMBERS R_MN10300_MAX };
#include "elf/mn10300.h" #include "elf/mn10300.h"
struct elf32_mn10300_link_hash_entry struct elf32_mn10300_link_hash_entry
@ -112,22 +116,6 @@ static void compute_function_info
does absolutely nothing. */ does absolutely nothing. */
#define USE_RELA #define USE_RELA
enum reloc_type
{
R_MN10300_NONE = 0,
R_MN10300_32,
R_MN10300_16,
R_MN10300_8,
R_MN10300_PCREL32,
R_MN10300_PCREL16,
R_MN10300_PCREL8,
/* These are GNU extensions to enable C++ vtable garbage collection. */
R_MN10300_GNU_VTINHERIT,
R_MN10300_GNU_VTENTRY,
R_MN10300_MAX
};
static reloc_howto_type elf_mn10300_howto_table[] = static reloc_howto_type elf_mn10300_howto_table[] =
{ {
@ -458,7 +446,7 @@ mn10300_elf_final_link_relocate (howto, input_bfd, output_bfd,
case R_MN10300_8: case R_MN10300_8:
value += addend; value += addend;
if ((long)value > 0x7fff || (long)value < -0x8000) if ((long)value > 0x7f || (long)value < -0x80)
return bfd_reloc_overflow; return bfd_reloc_overflow;
bfd_put_8 (input_bfd, value, hit_data); bfd_put_8 (input_bfd, value, hit_data);
@ -765,7 +753,7 @@ elf32_mn10300_finish_hash_table_entry (gen_entry, in_args)
We don't handle imm16->imm8 or d16->d8 as they're very rare We don't handle imm16->imm8 or d16->d8 as they're very rare
and somewhat more difficult to support. */ and somewhat more difficult to support. */
static boolean static boolean
mn10300_elf_relax_section (abfd, sec, link_info, again) mn10300_elf_relax_section (abfd, sec, link_info, again)
bfd *abfd; bfd *abfd;
asection *sec; asection *sec;
@ -925,7 +913,7 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
new_name = alloca (strlen (sym_name) + 10); new_name = alloca (strlen (sym_name) + 10);
sprintf (new_name, "%s_%08x", sym_name, (int)sym_sec); sprintf (new_name, "%s_%08x", sym_name, (int)sym_sec);
sym_name = new_name; sym_name = new_name;
hash = (struct elf32_mn10300_link_hash_entry *) hash = (struct elf32_mn10300_link_hash_entry *)
elf_link_hash_lookup (&hash_table->static_hash_table->root, elf_link_hash_lookup (&hash_table->static_hash_table->root,
sym_name, true, sym_name, true,
@ -945,7 +933,7 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
contents + irel->r_offset - 1); contents + irel->r_offset - 1);
if (code != 0xdd && code != 0xcd) if (code != 0xdd && code != 0xcd)
hash->flags |= MN10300_CONVERT_CALL_TO_CALLS; hash->flags |= MN10300_CONVERT_CALL_TO_CALLS;
/* If this is a jump/call, then bump the direct_calls /* If this is a jump/call, then bump the direct_calls
counter. Else force "call" to "calls" conversions. */ counter. Else force "call" to "calls" conversions. */
if (r_type == R_MN10300_PCREL32 if (r_type == R_MN10300_PCREL32
@ -964,7 +952,7 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
Elf32_External_Sym *esym, *esymend; Elf32_External_Sym *esym, *esymend;
int idx, shndx; int idx, shndx;
shndx = _bfd_elf_section_from_bfd_section (input_bfd, shndx = _bfd_elf_section_from_bfd_section (input_bfd,
section); section);
@ -1118,7 +1106,7 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
int shndx; int shndx;
Elf32_External_Sym *esym, *esymend; Elf32_External_Sym *esym, *esymend;
int idx; int idx;
/* Skip non-code sections and empty sections. */ /* Skip non-code sections and empty sections. */
if ((section->flags & SEC_CODE) == 0 || section->_raw_size == 0) if ((section->flags & SEC_CODE) == 0 || section->_raw_size == 0)
continue; continue;
@ -1201,7 +1189,7 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
if (sym_hash == NULL) if (sym_hash == NULL)
continue; continue;
if (! ((sym_hash)->flags & MN10300_CONVERT_CALL_TO_CALLS) if (! ((sym_hash)->flags & MN10300_CONVERT_CALL_TO_CALLS)
&& ! ((sym_hash)->flags & MN10300_DELETED_PROLOGUE_BYTES)) && ! ((sym_hash)->flags & MN10300_DELETED_PROLOGUE_BYTES))
{ {
@ -1774,7 +1762,7 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
continue; continue;
/* Now make sure we are a conditional branch. This may not /* Now make sure we are a conditional branch. This may not
be necessary, but why take the chance. be necessary, but why take the chance.
Note these checks assume that R_MN10300_PCREL8 relocs Note these checks assume that R_MN10300_PCREL8 relocs
only occur on bCC and bCCx insns. If they occured only occur on bCC and bCCx insns. If they occured
@ -1851,7 +1839,7 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
break; break;
} }
bfd_put_8 (abfd, code, contents + irel->r_offset - 1); bfd_put_8 (abfd, code, contents + irel->r_offset - 1);
/* Set the reloc type and symbol for the first branch /* Set the reloc type and symbol for the first branch
from the second branch. */ from the second branch. */
irel->r_info = nrel->r_info; irel->r_info = nrel->r_info;
@ -1877,7 +1865,7 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
bfd_vma value = symval; bfd_vma value = symval;
value += irel->r_addend; value += irel->r_addend;
/* See if the value will fit in 16 bits. /* See if the value will fit in 16 bits.
We allow any 16bit match here. We prune those we can't We allow any 16bit match here. We prune those we can't
handle below. */ handle below. */
if ((long)value < 0x7fff && (long)value > -0x8000) if ((long)value < 0x7fff && (long)value > -0x8000)
@ -1886,7 +1874,7 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
/* Most insns which have 32bit operands are 6 bytes long; /* Most insns which have 32bit operands are 6 bytes long;
exceptions are pcrel insns and bit insns. exceptions are pcrel insns and bit insns.
We handle pcrel insns above. We don't bother trying We handle pcrel insns above. We don't bother trying
to handle the bit insns here. to handle the bit insns here.
@ -2704,6 +2692,30 @@ _bfd_mn10300_elf_object_p (abfd)
return true; return true;
} }
/* Merge backend specific data from an object file to the output
object file when linking. */
boolean
_bfd_mn10300_elf_merge_private_bfd_data (ibfd, obfd)
bfd *ibfd;
bfd *obfd;
{
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
return true;
if (bfd_get_arch (obfd) == bfd_get_arch (ibfd)
&& bfd_get_mach (obfd) < bfd_get_mach (ibfd))
{
if (! bfd_set_arch_mach (obfd, bfd_get_arch (ibfd),
bfd_get_mach (ibfd)))
return false;
}
return true;
}
#define TARGET_LITTLE_SYM bfd_elf32_mn10300_vec #define TARGET_LITTLE_SYM bfd_elf32_mn10300_vec
#define TARGET_LITTLE_NAME "elf32-mn10300" #define TARGET_LITTLE_NAME "elf32-mn10300"
#define ELF_ARCH bfd_arch_mn10300 #define ELF_ARCH bfd_arch_mn10300
@ -2729,5 +2741,8 @@ _bfd_mn10300_elf_object_p (abfd)
_bfd_mn10300_elf_final_write_processing _bfd_mn10300_elf_final_write_processing
#define elf_backend_object_p _bfd_mn10300_elf_object_p #define elf_backend_object_p _bfd_mn10300_elf_object_p
#define bfd_elf32_bfd_merge_private_bfd_data \
_bfd_mn10300_elf_merge_private_bfd_data
#include "elf32-target.h" #include "elf32-target.h"