projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
More fixes for illegal memory accesses triggered by running objdump on fuzzed binaries.
[deliverable/binutils-gdb.git]
/
bfd
/
elf32-v850.c
diff --git
a/bfd/elf32-v850.c
b/bfd/elf32-v850.c
index 3e24dca1a5437cf299264aed1c4f9dbbf6cd6016..0155b7d1a072b471e0a649c2797172ea1c8b6913 100644
(file)
--- a/
bfd/elf32-v850.c
+++ b/
bfd/elf32-v850.c
@@
-1,7
+1,5
@@
/* V850-specific support for 32-bit ELF
/* V850-specific support for 32-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006, 2007, 2008, 2009, 2010, 2011, 2012
- Free Software Foundation, Inc.
+ Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This file is part of BFD, the Binary File Descriptor library.
@@
-85,6
+83,10
@@
v850_elf_check_relocs (bfd *abfd,
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;
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;
+
+ /* PR15323, ref flags aren't set for references in the same
+ object. */
+ h->root.non_ir_ref = 1;
}
r_type = ELF32_R_TYPE (rel->r_info);
}
r_type = ELF32_R_TYPE (rel->r_info);
@@
-492,7
+494,7
@@
v850_elf_perform_relocation (bfd *abfd,
{
default:
#ifdef DEBUG
{
default:
#ifdef DEBUG
- fprintf (stderr, "
reloc number %d not recognised\n"
, r_type);
+ fprintf (stderr, "
%B: reloc number %d not recognised\n", abfd
, r_type);
#endif
return bfd_reloc_notsupported;
#endif
return bfd_reloc_notsupported;
@@
-893,11
+895,11
@@
static reloc_howto_type v850_elf_howto_table[] =
/* This reloc does nothing. */
HOWTO (R_V850_NONE, /* Type. */
0, /* Rightshift. */
/* This reloc does nothing. */
HOWTO (R_V850_NONE, /* Type. */
0, /* Rightshift. */
-
2
, /* Size (0 = byte, 1 = short, 2 = long). */
-
32,
/* Bitsize. */
+
3
, /* Size (0 = byte, 1 = short, 2 = long). */
+
0,
/* Bitsize. */
FALSE, /* PC_relative. */
0, /* Bitpos. */
FALSE, /* PC_relative. */
0, /* Bitpos. */
- complain_overflow_
bitfield,
/* Complain_on_overflow. */
+ complain_overflow_
dont,
/* Complain_on_overflow. */
bfd_elf_generic_reloc, /* Special_function. */
"R_V850_NONE", /* Name. */
FALSE, /* Partial_inplace. */
bfd_elf_generic_reloc, /* Special_function. */
"R_V850_NONE", /* Name. */
FALSE, /* Partial_inplace. */
@@
-1894,7
+1896,11
@@
v850_elf_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
unsigned int r_type;
r_type = ELF32_R_TYPE (dst->r_info);
unsigned int r_type;
r_type = ELF32_R_TYPE (dst->r_info);
- BFD_ASSERT (r_type < (unsigned int) R_V850_max);
+ if (r_type >= (unsigned int) R_V850_max)
+ {
+ _bfd_error_handler (_("%B: invalid V850 reloc number: %d"), abfd, r_type);
+ r_type = 0;
+ }
cache_ptr->howto = &v850_elf_howto_table[r_type];
}
cache_ptr->howto = &v850_elf_howto_table[r_type];
}
@@
-1908,7
+1914,11
@@
v850_elf_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED,
unsigned int r_type;
r_type = ELF32_R_TYPE (dst->r_info);
unsigned int r_type;
r_type = ELF32_R_TYPE (dst->r_info);
- BFD_ASSERT (r_type < (unsigned int) R_V850_max);
+ if (r_type >= (unsigned int) R_V850_max)
+ {
+ _bfd_error_handler (_("%B: invalid V850 reloc number: %d"), abfd, r_type);
+ r_type = 0;
+ }
cache_ptr->howto = &v850_elf_howto_table[r_type];
}
\f
cache_ptr->howto = &v850_elf_howto_table[r_type];
}
\f
@@
-1918,6
+1928,12
@@
v850_elf_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name)
return ( (name[0] == '.' && (name[1] == 'L' || name[1] == '.'))
|| (name[0] == '_' && name[1] == '.' && name[2] == 'L' && name[3] == '_'));
}
return ( (name[0] == '.' && (name[1] == 'L' || name[1] == '.'))
|| (name[0] == '_' && name[1] == '.' && name[2] == 'L' && name[3] == '_'));
}
+
+static bfd_boolean
+v850_elf_is_target_special_symbol (bfd *abfd, asymbol *sym)
+{
+ return v850_elf_is_local_label_name (abfd, sym->name);
+}
\f
/* We overload some of the bfd_reloc error codes for own purposes. */
#define bfd_reloc_gp_not_found bfd_reloc_other
\f
/* We overload some of the bfd_reloc error codes for own purposes. */
#define bfd_reloc_gp_not_found bfd_reloc_other
@@
-2131,7
+2147,7
@@
v850_elf_final_link_relocate (reloc_howto_type *howto,
default:
#ifdef DEBUG
default:
#ifdef DEBUG
- fprintf (stderr, "
reloc number %d not recognised\n"
, r_type);
+ fprintf (stderr, "
%B: reloc number %d not recognised\n", input_bfd
, r_type);
#endif
return bfd_reloc_notsupported;
}
#endif
return bfd_reloc_notsupported;
}
@@
-2203,7
+2219,7
@@
v850_elf_relocate_section (bfd *output_bfd,
}
else
{
}
else
{
- bfd_boolean unresolved_reloc, warned;
+ bfd_boolean unresolved_reloc, warned
, ignored
;
/* Note - this check is delayed until now as it is possible and
valid to have a file without any symbols but with relocs that
/* Note - this check is delayed until now as it is possible and
valid to have a file without any symbols but with relocs that
@@
-2220,7
+2236,7
@@
v850_elf_relocate_section (bfd *output_bfd,
RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
r_symndx, symtab_hdr, sym_hashes,
h, sec, relocation,
RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
r_symndx, symtab_hdr, sym_hashes,
h, sec, relocation,
- unresolved_reloc, warned);
+ unresolved_reloc, warned
, ignored
);
}
if (sec != NULL && discarded_section (sec))
}
if (sec != NULL && discarded_section (sec))
@@
-2340,7
+2356,8
@@
v850_elf_object_p (bfd *abfd)
{
case EM_V800:
arch = bfd_arch_v850_rh850;
{
case EM_V800:
arch = bfd_arch_v850_rh850;
- mach = bfd_mach_v850e2v3;
+ mach = (elf_elfheader (abfd)->e_flags & EF_V800_850E3)
+ ? bfd_mach_v850e3v5 : bfd_mach_v850e2v3;
break;
case EM_CYGNUS_V850:
break;
case EM_CYGNUS_V850:
@@
-2354,6
+2371,7
@@
v850_elf_object_p (bfd *abfd)
case E_V850E1_ARCH: mach = bfd_mach_v850e1; break;
case E_V850E2_ARCH: mach = bfd_mach_v850e2; break;
case E_V850E2V3_ARCH: mach = bfd_mach_v850e2v3; break;
case E_V850E1_ARCH: mach = bfd_mach_v850e1; break;
case E_V850E2_ARCH: mach = bfd_mach_v850e2; break;
case E_V850E2V3_ARCH: mach = bfd_mach_v850e2v3; break;
+ case E_V850E3V5_ARCH: mach = bfd_mach_v850e3v5; break;
}
break;
}
break;
@@
-2376,6
+2394,8
@@
v850_elf_final_write_processing (bfd *abfd,
{
case bfd_arch_v850_rh850:
val = EF_RH850_ABI;
{
case bfd_arch_v850_rh850:
val = EF_RH850_ABI;
+ if (bfd_get_mach (abfd) == bfd_mach_v850e3v5)
+ val |= EF_V800_850E3;
elf_elfheader (abfd)->e_flags |= val;
break;
elf_elfheader (abfd)->e_flags |= val;
break;
@@
-2388,6
+2408,7
@@
v850_elf_final_write_processing (bfd *abfd,
case bfd_mach_v850e1: val = E_V850E1_ARCH; break;
case bfd_mach_v850e2: val = E_V850E2_ARCH; break;
case bfd_mach_v850e2v3: val = E_V850E2V3_ARCH; break;
case bfd_mach_v850e1: val = E_V850E1_ARCH; break;
case bfd_mach_v850e2: val = E_V850E2_ARCH; break;
case bfd_mach_v850e2v3: val = E_V850E2V3_ARCH; break;
+ case bfd_mach_v850e3v5: val = E_V850E3V5_ARCH; break;
}
elf_elfheader (abfd)->e_flags &=~ EF_V850_ARCH;
elf_elfheader (abfd)->e_flags |= val;
}
elf_elfheader (abfd)->e_flags &=~ EF_V850_ARCH;
elf_elfheader (abfd)->e_flags |= val;
@@
-2507,6
+2528,17
@@
v850_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
return TRUE;
}
return TRUE;
}
+ if (( (in_flags & EF_V850_ARCH) == E_V850_ARCH
+ || (in_flags & EF_V850_ARCH) == E_V850E_ARCH
+ || (in_flags & EF_V850_ARCH) == E_V850E2_ARCH
+ || (in_flags & EF_V850_ARCH) == E_V850E2V3_ARCH)
+ && (out_flags & EF_V850_ARCH) == E_V850E3V5_ARCH)
+ {
+ elf_elfheader (obfd)->e_flags =
+ ((out_flags & ~ EF_V850_ARCH) | E_V850E3V5_ARCH);
+ return TRUE;
+ }
+
_bfd_error_handler (_("%B: Architecture mismatch with previous modules"),
ibfd);
}
_bfd_error_handler (_("%B: Architecture mismatch with previous modules"),
ibfd);
}
@@
-2550,6
+2582,7
@@
v850_elf_print_private_bfd_data (bfd *abfd, void * ptr)
case E_V850E1_ARCH: fprintf (file, _("v850e1 architecture")); break;
case E_V850E2_ARCH: fprintf (file, _("v850e2 architecture")); break;
case E_V850E2V3_ARCH: fprintf (file, _("v850e2v3 architecture")); break;
case E_V850E1_ARCH: fprintf (file, _("v850e1 architecture")); break;
case E_V850E2_ARCH: fprintf (file, _("v850e2 architecture")); break;
case E_V850E2V3_ARCH: fprintf (file, _("v850e2v3 architecture")); break;
+ case E_V850E3V5_ARCH: fprintf (file, _("v850e3v5 architecture")); break;
}
}
}
}
@@
-3116,7
+3149,7
@@
v850_elf_relax_section (bfd *abfd,
if (alignmoveto < alignto)
{
if (alignmoveto < alignto)
{
-
unsigned int
i;
+
bfd_vma
i;
align_pad_size = alignto - alignmoveto;
#ifdef DEBUG_RELAX
align_pad_size = alignto - alignmoveto;
#ifdef DEBUG_RELAX
@@
-3745,7
+3778,7
@@
static const struct bfd_elf_special_section v850_elf_special_sections[] =
{ NULL, 0, 0, 0, 0 }
};
\f
{ NULL, 0, 0, 0, 0 }
};
\f
-#define TARGET_LITTLE_SYM
bfd_elf32_v850
_vec
+#define TARGET_LITTLE_SYM
v850_elf32
_vec
#define TARGET_LITTLE_NAME "elf32-v850"
#define ELF_ARCH bfd_arch_v850
#define ELF_MACHINE_CODE EM_V850
#define TARGET_LITTLE_NAME "elf32-v850"
#define ELF_ARCH bfd_arch_v850
#define ELF_MACHINE_CODE EM_V850
@@
-3772,6
+3805,8
@@
static const struct bfd_elf_special_section v850_elf_special_sections[] =
#define elf_backend_rela_normal 1
#define bfd_elf32_bfd_is_local_label_name v850_elf_is_local_label_name
#define elf_backend_rela_normal 1
#define bfd_elf32_bfd_is_local_label_name v850_elf_is_local_label_name
+#define bfd_elf32_bfd_is_target_special_symbol v850_elf_is_target_special_symbol
+
#define bfd_elf32_bfd_reloc_type_lookup v850_elf_reloc_type_lookup
#define bfd_elf32_bfd_reloc_name_lookup v850_elf_reloc_name_lookup
#define bfd_elf32_bfd_merge_private_bfd_data v850_elf_merge_private_bfd_data
#define bfd_elf32_bfd_reloc_type_lookup v850_elf_reloc_type_lookup
#define bfd_elf32_bfd_reloc_name_lookup v850_elf_reloc_name_lookup
#define bfd_elf32_bfd_merge_private_bfd_data v850_elf_merge_private_bfd_data
@@
-3878,7
+3913,7
@@
v800_elf_info_to_howto (bfd * abfd,
\f
#undef TARGET_LITTLE_SYM
\f
#undef TARGET_LITTLE_SYM
-#define TARGET_LITTLE_SYM
bfd_elf32_v850_rh850
_vec
+#define TARGET_LITTLE_SYM
v800_elf32
_vec
#undef TARGET_LITTLE_NAME
#define TARGET_LITTLE_NAME "elf32-v850-rh850"
#undef ELF_ARCH
#undef TARGET_LITTLE_NAME
#define TARGET_LITTLE_NAME "elf32-v850-rh850"
#undef ELF_ARCH
This page took
0.028025 seconds
and
4
git commands to generate.