(reloc_type): Temporarily disable definition of standard relocation since

they are now defined in elf/mips.h.
This commit is contained in:
Ulrich Drepper
1998-07-22 01:34:44 +00:00
parent 7422fa0cc8
commit 5e37b2da13

View File

@ -85,6 +85,10 @@ static bfd_reloc_status_type mips16_jump_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
static bfd_reloc_status_type mips16_gprel_reloc static bfd_reloc_status_type mips16_gprel_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
/* start-sanitize-sky */
static bfd_reloc_status_type dvp_u15_s3_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
/* end-sanitize-sky */
static boolean mips_elf_adjust_dynindx static boolean mips_elf_adjust_dynindx
PARAMS ((struct elf_link_hash_entry *, PTR)); PARAMS ((struct elf_link_hash_entry *, PTR));
static boolean mips_elf_relocate_section static boolean mips_elf_relocate_section
@ -291,6 +295,8 @@ static void bfd_elf32_swap_crinfo_out
enum reloc_type enum reloc_type
{ {
#if 0
/* These are now in elf/mips.h. */
R_MIPS_NONE = 0, R_MIPS_NONE = 0,
R_MIPS_16, R_MIPS_32, R_MIPS_16, R_MIPS_32,
R_MIPS_REL32, R_MIPS_26, R_MIPS_REL32, R_MIPS_26,
@ -298,9 +304,10 @@ enum reloc_type
R_MIPS_GPREL16, R_MIPS_LITERAL, R_MIPS_GPREL16, R_MIPS_LITERAL,
R_MIPS_GOT16, R_MIPS_PC16, R_MIPS_GOT16, R_MIPS_PC16,
R_MIPS_CALL16, R_MIPS_GPREL32, R_MIPS_CALL16, R_MIPS_GPREL32,
#endif
/* The remaining relocs are defined on Irix, although they are not /* The remaining relocs are defined on Irix, although they are not
in the MIPS ELF ABI. */ in the MIPS ELF ABI. */
R_MIPS_UNUSED1, R_MIPS_UNUSED2, R_MIPS_UNUSED1 = 13, R_MIPS_UNUSED2,
R_MIPS_UNUSED3, R_MIPS_UNUSED3,
R_MIPS_SHIFT5, R_MIPS_SHIFT6, R_MIPS_SHIFT5, R_MIPS_SHIFT6,
R_MIPS_64, R_MIPS_GOT_DISP, R_MIPS_64, R_MIPS_GOT_DISP,
@ -322,6 +329,8 @@ enum reloc_type
/* These relocs are for the dvp. */ /* These relocs are for the dvp. */
R_MIPS_DVP_11_PCREL = 120, R_MIPS_DVP_11_PCREL = 120,
R_MIPS_DVP_27_S4 = 121, R_MIPS_DVP_27_S4 = 121,
R_MIPS_DVP_11_S4 = 122,
R_MIPS_DVP_U15_S3 = 123,
/* end-sanitize-sky */ /* end-sanitize-sky */
/* These are GNU extensions to enable C++ vtable garbage collection. */ /* These are GNU extensions to enable C++ vtable garbage collection. */
R_MIPS_GNU_VTINHERIT = 253, R_MIPS_GNU_VTINHERIT = 253,
@ -815,6 +824,34 @@ static reloc_howto_type elf_mips_dvp_27_s4_howto =
0x7ffffff0, /* src_mask */ 0x7ffffff0, /* src_mask */
0x7ffffff0, /* dst_mask */ 0x7ffffff0, /* dst_mask */
false); /* pcrel_offset */ false); /* pcrel_offset */
static reloc_howto_type elf_mips_dvp_11_s4_howto =
HOWTO (R_MIPS_DVP_11_S4, /* type */
4, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
11, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_DVP_11_S4", /* name */
false, /* partial_inplace */
0x03ff, /* src_mask */
0x03ff, /* dst_mask */
false); /* pcrel_offset */
static reloc_howto_type elf_mips_dvp_u15_s3_howto =
HOWTO (R_MIPS_DVP_U15_S3, /* type */
3, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_unsigned, /* complain_on_overflow */
dvp_u15_s3_reloc, /* special_function */
"R_MIPS_DVP_U15_S3", /* name */
false, /* partial_inplace */
0xf03ff, /* src_mask */
0xf03ff, /* dst_mask */
false); /* pcrel_offset */
/* end-sanitize-sky */ /* end-sanitize-sky */
/* GNU extension to record C++ vtable hierarchy */ /* GNU extension to record C++ vtable hierarchy */
@ -1566,6 +1603,62 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section,
return ret; return ret;
} }
/* start-sanitize-sky */
/* Handle a dvp R_MIPS_DVP_U15_S3 reloc.
This is needed because the bits aren't contiguous. */
static bfd_reloc_status_type
dvp_u15_s3_reloc (abfd, reloc_entry, symbol, data, input_section,
output_bfd, error_message)
bfd *abfd;
arelent *reloc_entry;
asymbol *symbol;
PTR data;
asection *input_section;
bfd *output_bfd;
char **error_message;
{
boolean relocateable;
bfd_reloc_status_type ret;
bfd_vma relocation;
bfd_vma x;
/* If we're relocating, and this is an external symbol with no
addend, we don't want to change anything. We will only have an
addend if this is a newly created reloc, not read from an ELF
file. See bfd_elf_generic_reloc. */
if (output_bfd != NULL
&& (symbol->flags & BSF_SECTION_SYM) == 0
/* partial_inplace is false, so this test always succeeds,
but for clarity and consistency with bfd_elf_generic_reloc
this is left as is. */
&& (! reloc_entry->howto->partial_inplace
|| reloc_entry->addend == 0))
{
reloc_entry->address += input_section->output_offset;
return bfd_reloc_ok;
}
if (reloc_entry->address > input_section->_cooked_size)
return bfd_reloc_outofrange;
relocation = (symbol->value
+ symbol->section->output_section->vma
+ symbol->section->output_offset);
relocation += reloc_entry->addend;
relocation >>= 3;
x = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
x |= (((relocation & 0x7800) << 10)
| (relocation & 0x7ff));
bfd_put_32 (abfd, x, (bfd_byte *) data + reloc_entry->address);
if (relocation & ~(bfd_vma) 0x7fff)
return bfd_reloc_overflow;
return bfd_reloc_ok;
}
/* end-sanitize-sky */
/* Return the ISA for a MIPS e_flags value. */ /* Return the ISA for a MIPS e_flags value. */
static INLINE int static INLINE int
@ -1717,6 +1810,10 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code)
return &elf_mips_dvp_11_pcrel_howto; return &elf_mips_dvp_11_pcrel_howto;
case BFD_RELOC_MIPS_DVP_27_S4: case BFD_RELOC_MIPS_DVP_27_S4:
return &elf_mips_dvp_27_s4_howto; return &elf_mips_dvp_27_s4_howto;
case BFD_RELOC_MIPS_DVP_11_S4:
return &elf_mips_dvp_11_s4_howto;
case BFD_RELOC_MIPS_DVP_U15_S3:
return &elf_mips_dvp_u15_s3_howto;
/* end-sanitize-sky */ /* end-sanitize-sky */
case BFD_RELOC_VTABLE_INHERIT: case BFD_RELOC_VTABLE_INHERIT:
return &elf_mips_gnu_vtinherit_howto; return &elf_mips_gnu_vtinherit_howto;
@ -1753,6 +1850,12 @@ mips_info_to_howto_rel (abfd, cache_ptr, dst)
case R_MIPS_DVP_27_S4: case R_MIPS_DVP_27_S4:
cache_ptr->howto = &elf_mips_dvp_27_s4_howto; cache_ptr->howto = &elf_mips_dvp_27_s4_howto;
break; break;
case R_MIPS_DVP_11_S4:
cache_ptr->howto = &elf_mips_dvp_11_s4_howto;
break;
case R_MIPS_DVP_U15_S3:
cache_ptr->howto = &elf_mips_dvp_u15_s3_howto;
break;
/* end-sanitize-sky */ /* end-sanitize-sky */
case R_MIPS_GNU_VTINHERIT: case R_MIPS_GNU_VTINHERIT:
cache_ptr->howto = &elf_mips_gnu_vtinherit_howto; cache_ptr->howto = &elf_mips_gnu_vtinherit_howto;
@ -4872,6 +4975,8 @@ mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
/* start-sanitize-sky */ /* start-sanitize-sky */
&& r_type != R_MIPS_DVP_11_PCREL && r_type != R_MIPS_DVP_11_PCREL
&& r_type != R_MIPS_DVP_27_S4 && r_type != R_MIPS_DVP_27_S4
&& r_type != R_MIPS_DVP_11_S4
&& r_type != R_MIPS_DVP_U15_S3
/* end-sanitize-sky */ /* end-sanitize-sky */
&& r_type != R_MIPS16_26 && r_type != R_MIPS16_26
&& r_type != R_MIPS16_GPREL) && r_type != R_MIPS16_GPREL)
@ -4888,6 +4993,10 @@ mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
howto = &elf_mips_dvp_11_pcrel_howto; howto = &elf_mips_dvp_11_pcrel_howto;
else if (r_type == R_MIPS_DVP_27_S4) else if (r_type == R_MIPS_DVP_27_S4)
howto = &elf_mips_dvp_27_s4_howto; howto = &elf_mips_dvp_27_s4_howto;
else if (r_type == R_MIPS_DVP_11_S4)
howto = &elf_mips_dvp_11_s4_howto;
else if (r_type == R_MIPS_DVP_U15_S3)
howto = &elf_mips_dvp_u15_s3_howto;
/* end-sanitize-sky */ /* end-sanitize-sky */
else else
howto = elf_mips_howto_table + r_type; howto = elf_mips_howto_table + r_type;
@ -5591,6 +5700,32 @@ mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
contents + rel->r_offset + 2); contents + rel->r_offset + 2);
} }
} }
/* start-sanitize-sky */
else if (r_type == R_MIPS_DVP_U15_S3)
{
if (rel->r_offset > input_section->_raw_size)
r = bfd_reloc_outofrange;
else
{
bfd_vma x;
relocation += rel->r_addend;
relocation >>= 3;
x = bfd_get_32 (input_bfd, contents + rel->r_offset);
relocation += ((x & (0xf << 21)) >> 10) + (x & 0x7ff);
x &= ~ ((0xf << 21) | 0x7ff);
x |= (((relocation & 0x7800) << 10)
| (relocation & 0x7ff));
bfd_put_32 (input_bfd, x, contents + rel->r_offset);
if (relocation & ~ (bfd_vma) 0x7fff)
r = bfd_reloc_overflow;
else
r = bfd_reloc_ok;
}
}
/* end-sanitize-sky */
else else
r = _bfd_final_link_relocate (howto, input_bfd, input_section, r = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents, rel->r_offset, contents, rel->r_offset,
@ -7832,4 +7967,7 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap =
#define elf_backend_gc_mark_hook mips_elf_gc_mark_hook #define elf_backend_gc_mark_hook mips_elf_gc_mark_hook
#define elf_backend_gc_sweep_hook mips_elf_gc_sweep_hook #define elf_backend_gc_sweep_hook mips_elf_gc_sweep_hook
#define elf_backend_got_header_size (4*MIPS_RESERVED_GOTNO)
#define elf_backend_plt_header_size 0
#include "elf32-target.h" #include "elf32-target.h"