X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=bfd%2Felf32-v850.c;h=f80b18753d5b0ce76b6341c6b6664f7da03891ce;hb=c88960d081f0b37ec03c66a13115e2a68e40d1ad;hp=3e24dca1a5437cf299264aed1c4f9dbbf6cd6016;hpb=68ffbac672c0d7f2566e715f878e65ed9b44795f;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index 3e24dca1a5..f80b18753d 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -1,7 +1,5 @@ /* 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-2016 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -59,7 +57,7 @@ v850_elf_check_relocs (bfd *abfd, int other = 0; const char *common = NULL; - if (info->relocatable) + if (bfd_link_relocatable (info)) return TRUE; #ifdef DEBUG @@ -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; + + /* 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); @@ -492,7 +494,7 @@ v850_elf_perform_relocation (bfd *abfd, { 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; @@ -893,11 +895,11 @@ static reloc_howto_type v850_elf_howto_table[] = /* 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. */ - 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. */ @@ -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); - 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]; } @@ -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); - 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]; } @@ -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] == '_')); } + +static bfd_boolean +v850_elf_is_target_special_symbol (bfd *abfd, asymbol *sym) +{ + return v850_elf_is_local_label_name (abfd, sym->name); +} /* 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 - 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; } @@ -2203,7 +2219,7 @@ v850_elf_relocate_section (bfd *output_bfd, } 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 @@ -2220,14 +2236,14 @@ 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, - unresolved_reloc, warned); + unresolved_reloc, warned, ignored); } if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, rel, 1, relend, howto, 0, contents); - if (info->relocatable) + if (bfd_link_relocatable (info)) continue; /* FIXME: We should use the addend, but the COFF relocations don't. */ @@ -2255,18 +2271,14 @@ v850_elf_relocate_section (bfd *output_bfd, switch ((int) r) { case bfd_reloc_overflow: - if (! ((*info->callbacks->reloc_overflow) - (info, (h ? &h->root : NULL), name, howto->name, - (bfd_vma) 0, input_bfd, input_section, - rel->r_offset))) - return FALSE; + (*info->callbacks->reloc_overflow) + (info, (h ? &h->root : NULL), name, howto->name, + (bfd_vma) 0, input_bfd, input_section, rel->r_offset); break; case bfd_reloc_undefined: - if (! ((*info->callbacks->undefined_symbol) - (info, name, input_bfd, input_section, - rel->r_offset, TRUE))) - return FALSE; + (*info->callbacks->undefined_symbol) + (info, name, input_bfd, input_section, rel->r_offset, TRUE); break; case bfd_reloc_outofrange: @@ -2298,10 +2310,8 @@ v850_elf_relocate_section (bfd *output_bfd, /* fall through */ common_error: - if (!((*info->callbacks->warning) - (info, msg, name, input_bfd, input_section, - rel->r_offset))) - return FALSE; + (*info->callbacks->warning) (info, msg, name, input_bfd, + input_section, rel->r_offset); break; } } @@ -2328,6 +2338,335 @@ v850_elf_gc_mark_hook (asection *sec, return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym); } +static void +v850_set_note (bfd * abfd, asection * s, enum v850_notes note, unsigned int val) +{ + bfd_byte * data = s->contents + ((note - 1) * SIZEOF_V850_NOTE); + + bfd_put_32 (abfd, 4, data + 0); + bfd_put_32 (abfd, 4, data + 4); + bfd_put_32 (abfd, note, data + 8); + memcpy (data + 12, V850_NOTE_NAME, 4); + bfd_put_32 (abfd, val, data + 16); +} + +/* Create the note section if not already present. This is done early so + that the linker maps the sections to the right place in the output. */ + +static asection * +v850_elf_make_note_section (bfd * abfd) +{ + asection *s; + bfd_byte *data; + flagword flags; + enum v850_notes id; + + /* Make the note section. */ + flags = SEC_READONLY | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_MERGE; + + s = bfd_make_section_anyway_with_flags (abfd, V850_NOTE_SECNAME, flags); + if (s == NULL) + return NULL; + + if (!bfd_set_section_alignment (abfd, s, 2)) + return NULL; + + /* Allocate space for all known notes. */ + if (!bfd_set_section_size (abfd, s, NUM_V850_NOTES * SIZEOF_V850_NOTE)) + return NULL; + + data = bfd_zalloc (abfd, NUM_V850_NOTES * SIZEOF_V850_NOTE); + if (data == NULL) + return NULL; + + s->contents = data; + + /* Provide default (= uninitilaised) values for all of the notes. */ + for (id = V850_NOTE_ALIGNMENT; id <= NUM_V850_NOTES; id++) + v850_set_note (abfd, s, id, 0); + + return s; +} + +/* Create the note section if not already present. This is done early so + that the linker maps the sections to the right place in the output. */ + +bfd_boolean +v850_elf_create_sections (struct bfd_link_info * info) +{ + bfd * ibfd; + + /* If we already have a note section, do not make another. */ + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next) + if (bfd_get_section_by_name (ibfd, V850_NOTE_SECNAME) != NULL) + return TRUE; + + return v850_elf_make_note_section (info->input_bfds) != NULL; +} + +bfd_boolean +v850_elf_set_note (bfd * abfd, enum v850_notes note, unsigned int val) +{ + asection * notes = bfd_get_section_by_name (abfd, V850_NOTE_SECNAME); + + if (val > 2) + /* At the moment, no known note has a value over 2. */ + return FALSE; + + if (notes == NULL) + notes = v850_elf_make_note_section (abfd); + if (notes == NULL) + return FALSE; + + v850_set_note (abfd, notes, note, val); + return TRUE; +} + +/* Copy a v850 note section from one object module to another. */ + +static void +v850_elf_copy_notes (bfd *ibfd, bfd *obfd) +{ + asection * onotes; + asection * inotes; + + /* If the output bfd does not have a note section, then + skip the merge. The normal input to output section + copying will take care of everythng for us. */ + if ((onotes = bfd_get_section_by_name (obfd, V850_NOTE_SECNAME)) == NULL) + return; + + if ((inotes = bfd_get_section_by_name (ibfd, V850_NOTE_SECNAME)) == NULL) + return; + + if (bfd_section_size (ibfd, inotes) == bfd_section_size (obfd, onotes)) + { + bfd_byte * icont; + bfd_byte * ocont; + + if ((icont = elf_section_data (inotes)->this_hdr.contents) == NULL) + BFD_ASSERT (bfd_malloc_and_get_section (ibfd, inotes, & icont)); + + if ((ocont = elf_section_data (onotes)->this_hdr.contents) == NULL) + BFD_ASSERT (bfd_malloc_and_get_section (obfd, onotes, & ocont)); + + /* Copy/overwrite notes from the input to the output. */ + memcpy (ocont, icont, bfd_section_size (obfd, onotes)); + } +} + +/* Copy backend specific data from one object module to another. */ + +static bfd_boolean +v850_elf_copy_private_bfd_data (bfd *ibfd, bfd *obfd) +{ + v850_elf_copy_notes (ibfd, obfd); + return _bfd_elf_copy_private_bfd_data (ibfd, obfd); +} +#define bfd_elf32_bfd_copy_private_bfd_data v850_elf_copy_private_bfd_data + +static bfd_boolean +v850_elf_merge_notes (bfd * ibfd, bfd *obfd) +{ + asection * onotes; + asection * inotes; + bfd_boolean result = TRUE; + + /* If the output bfd does not have a note section, then + skip the merge. The normal input to output section + copying will take care of everythng for us. */ + if ((onotes = bfd_get_section_by_name (obfd, V850_NOTE_SECNAME)) == NULL) + return TRUE; + + if ((inotes = bfd_get_section_by_name (ibfd, V850_NOTE_SECNAME)) != NULL) + { + enum v850_notes id; + bfd_byte * icont; + bfd_byte * ocont; + + BFD_ASSERT (bfd_section_size (ibfd, inotes) == bfd_section_size (obfd, onotes)); + + if ((icont = elf_section_data (inotes)->this_hdr.contents) == NULL) + BFD_ASSERT (bfd_malloc_and_get_section (ibfd, inotes, & icont)); + + if ((ocont = elf_section_data (onotes)->this_hdr.contents) == NULL) + BFD_ASSERT (bfd_malloc_and_get_section (obfd, onotes, & ocont)); + + for (id = V850_NOTE_ALIGNMENT; id <= NUM_V850_NOTES; id++) + { + unsigned int ival; + unsigned int oval; + bfd_byte * idata = icont + ((id - 1) * SIZEOF_V850_NOTE) + 16; + bfd_byte * odata = ocont + ((id - 1) * SIZEOF_V850_NOTE) + 16; + + ival = bfd_get_32 (ibfd, idata); + oval = bfd_get_32 (obfd, odata); + + if (ival == 0 || ival == oval) + continue; + + if (oval == 0) + { + bfd_put_32 (obfd, ival, odata); + v850_set_note (obfd, onotes, id, ival); + continue; + } + + /* We have a mismatch. The ABI defines how to handle + this siutation on a per note type basis. */ + switch (id) + { + case V850_NOTE_ALIGNMENT: + if (oval == EF_RH850_DATA_ALIGN4) + { + _bfd_error_handler + (_("error: %B needs 8-byte aligment but %B is set for 4-byte alignment"), + ibfd, obfd); + result = FALSE; + } + else + /* ibfd uses 4-byte alignment, obfd uses 8-byte alignment. + Leave the obfd alignment as it is. */ + BFD_ASSERT (oval == EF_RH850_DATA_ALIGN8); + + break; + + case V850_NOTE_DATA_SIZE: + if (oval == EF_RH850_DOUBLE32) + { + _bfd_error_handler (_("error: %B uses 64-bit doubles but %B uses 32-bit doubles"), + ibfd, obfd); + result = FALSE; + } + else + /* ibfd uses 32-bit doubles, obfd uses 64-bit doubles. + This is acceptable. Honest, that is what the ABI says. */ + BFD_ASSERT (oval == EF_RH850_DOUBLE64); + break; + + case V850_NOTE_FPU_INFO: + if (oval == EF_RH850_FPU20) + { + _bfd_error_handler (_("error: %B uses FPU-3.0 but %B only supports FPU-2.0"), + ibfd, obfd); + result = FALSE; + } + else + /* ibfd uses FPU-2.0, obfd uses FPU-3.0. Leave obfd as it is. */ + BFD_ASSERT (oval == EF_RH850_FPU30); + + break; + + default: + /* None of the other conflicts matter. + Stick with the current output values. */ + break; + } + } + + /* FIXME: We should also check for conflicts between the notes + and the EF flags in the ELF header. */ + } + + return result; +} + +static void +print_v850_note (bfd * abfd, FILE * file, bfd_byte * data, enum v850_notes id) +{ + unsigned int value = bfd_get_32 (abfd, data + ((id - 1) * SIZEOF_V850_NOTE) + 16); + + switch (id) + { + case V850_NOTE_ALIGNMENT: + fprintf (file, _(" alignment of 8-byte entities: ")); + switch (value) + { + case EF_RH850_DATA_ALIGN4: fprintf (file, _("4-byte")); break; + case EF_RH850_DATA_ALIGN8: fprintf (file, _("8-byte")); break; + case 0: fprintf (file, _("not set")); break; + default: fprintf (file, _("unknown: %x"), value); break; + } + fputc ('\n', file); + break; + + case V850_NOTE_DATA_SIZE: + fprintf (file, _(" size of doubles: ")); + switch (value) + { + case EF_RH850_DOUBLE32: fprintf (file, _("4-bytes")); break; + case EF_RH850_DOUBLE64: fprintf (file, _("8-bytes")); break; + case 0: fprintf (file, _("not set")); break; + default: fprintf (file, _("unknown: %x"), value); break; + } + fputc ('\n', file); + break; + + case V850_NOTE_FPU_INFO: + fprintf (file, _(" FPU support required: ")); + switch (value) + { + case EF_RH850_FPU20: fprintf (file, _("FPU-2.0")); break; + case EF_RH850_FPU30: fprintf (file, _("FPU-3.0")); break; + case 0: fprintf (file, _("none")); break; + default: fprintf (file, _("unknown: %x"), value); break; + } + fputc ('\n', file); + break; + + case V850_NOTE_SIMD_INFO: + fprintf (file, _("SIMD use: ")); + switch (value) + { + case EF_RH850_SIMD: fprintf (file, _("yes")); break; + case 0: fprintf (file, _("no")); break; + default: fprintf (file, _("unknown: %x"), value); break; + } + fputc ('\n', file); + break; + + case V850_NOTE_CACHE_INFO: + fprintf (file, _("CACHE use: ")); + switch (value) + { + case EF_RH850_CACHE: fprintf (file, _("yes")); break; + case 0: fprintf (file, _("no")); break; + default: fprintf (file, _("unknown: %x"), value); break; + } + fputc ('\n', file); + break; + + case V850_NOTE_MMU_INFO: + fprintf (file, _("MMU use: ")); + switch (value) + { + case EF_RH850_MMU: fprintf (file, _("yes")); break; + case 0: fprintf (file, _("no")); break; + default: fprintf (file, _("unknown: %x"), value); break; + } + fputc ('\n', file); + break; + + default: + BFD_ASSERT (0); + } +} + +static void +v850_elf_print_notes (bfd * abfd, FILE * file) +{ + asection * notes = bfd_get_section_by_name (abfd, V850_NOTE_SECNAME); + enum v850_notes id; + + if (notes == NULL || notes->contents == NULL) + return; + + BFD_ASSERT (bfd_section_size (abfd, notes) == NUM_V850_NOTES * SIZEOF_V850_NOTE); + + for (id = V850_NOTE_ALIGNMENT; id <= NUM_V850_NOTES; id++) + print_v850_note (abfd, file, notes->contents, id); +} + /* Set the right machine number and architecture. */ static bfd_boolean @@ -2340,7 +2679,8 @@ v850_elf_object_p (bfd *abfd) { 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: @@ -2354,6 +2694,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_V850E3V5_ARCH: mach = bfd_mach_v850e3v5; break; } break; @@ -2376,6 +2717,8 @@ v850_elf_final_write_processing (bfd *abfd, { 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; @@ -2388,6 +2731,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_v850e3v5: val = E_V850E3V5_ARCH; break; } elf_elfheader (abfd)->e_flags &=~ EF_V850_ARCH; elf_elfheader (abfd)->e_flags |= val; @@ -2418,11 +2762,14 @@ v850_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) { flagword out_flags; flagword in_flags; + bfd_boolean result = TRUE; if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour || bfd_get_flavour (obfd) != bfd_target_elf_flavour) return TRUE; + result &= v850_elf_merge_notes (ibfd, obfd); + in_flags = elf_elfheader (ibfd)->e_flags; out_flags = elf_elfheader (obfd)->e_flags; @@ -2442,14 +2789,14 @@ v850_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) if (bfd_get_arch (obfd) == bfd_get_arch (ibfd) && bfd_get_arch_info (obfd)->the_default) - return bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), bfd_get_mach (ibfd)); + result &= bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), bfd_get_mach (ibfd)); - return TRUE; + return result; } /* Check flag compatibility. */ if (in_flags == out_flags) - return TRUE; + return result; if (bfd_get_arch (obfd) == bfd_arch_v850_rh850) { @@ -2460,14 +2807,7 @@ v850_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) elf_elfheader (obfd)->e_flags |= EF_V800_850E3; } - if ((in_flags & EF_RH850_DATA_ALIGN8) != (out_flags & EF_RH850_DATA_ALIGN8)) - { - _bfd_error_handler (_("%B: Alignment mismatch with previous modules"), - ibfd); - elf_elfheader (obfd)->e_flags |= EF_RH850_DATA_ALIGN8; - } - - return TRUE; + return result; } if ((in_flags & EF_V850_ARCH) != (out_flags & EF_V850_ARCH) @@ -2478,14 +2818,14 @@ v850_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) which we set to v850e. */ if ( (in_flags & EF_V850_ARCH) == E_V850E1_ARCH && (out_flags & EF_V850_ARCH) == E_V850E_ARCH) - return TRUE; + return result; if ( (in_flags & EF_V850_ARCH) == E_V850_ARCH && (out_flags & EF_V850_ARCH) == E_V850E_ARCH) { elf_elfheader (obfd)->e_flags = ((out_flags & ~ EF_V850_ARCH) | E_V850E_ARCH); - return TRUE; + return result; } if (( (in_flags & EF_V850_ARCH) == E_V850_ARCH @@ -2494,7 +2834,7 @@ v850_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) { elf_elfheader (obfd)->e_flags = ((out_flags & ~ EF_V850_ARCH) | E_V850E2_ARCH); - return TRUE; + return result; } if (( (in_flags & EF_V850_ARCH) == E_V850_ARCH @@ -2504,14 +2844,25 @@ v850_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) { elf_elfheader (obfd)->e_flags = ((out_flags & ~ EF_V850_ARCH) | E_V850E2V3_ARCH); - return TRUE; + return result; + } + + 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 result; } _bfd_error_handler (_("%B: Architecture mismatch with previous modules"), ibfd); } - return TRUE; + return result; } /* Display the flags field. */ @@ -2536,9 +2887,6 @@ v850_elf_print_private_bfd_data (bfd *abfd, void * ptr) fprintf (file, _("v850 E3 architecture")); else fprintf (file, _("v850 architecture")); - - if (elf_elfheader (abfd)->e_flags & EF_RH850_DATA_ALIGN8) - fprintf (file, _(", 8-byte data alignment")); } else { @@ -2550,11 +2898,14 @@ 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_V850E3V5_ARCH: fprintf (file, _("v850e3v5 architecture")); break; } } fputc ('\n', file); + v850_elf_print_notes (abfd, file); + return TRUE; } @@ -2827,6 +3178,12 @@ v850_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED, hdr->sh_type = SHT_V850_TCOMMON; else if (strcmp (name, ".zcommon") == 0) hdr->sh_type = SHT_V850_ZCOMMON; + /* Tweak the section type of .note.renesas. */ + else if (strcmp (name, V850_NOTE_SECNAME) == 0) + { + hdr->sh_type = SHT_RENESAS_INFO; + hdr->sh_entsize = SIZEOF_V850_NOTE; + } return TRUE; } @@ -2850,7 +3207,6 @@ v850_elf_relax_delete_bytes (bfd *abfd, Elf_Internal_Rela *irel; Elf_Internal_Rela *irelend; struct elf_link_hash_entry *sym_hash; - Elf_Internal_Shdr *shndx_hdr; Elf_External_Sym_Shndx *shndx; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; @@ -2875,8 +3231,17 @@ v850_elf_relax_delete_bytes (bfd *abfd, /* Adjust all the relocs. */ irel = elf_section_data (sec)->relocs; irelend = irel + sec->reloc_count; - shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr; - shndx = (Elf_External_Sym_Shndx *) shndx_hdr->contents; + if (elf_symtab_shndx_list (abfd)) + { + Elf_Internal_Shdr *shndx_hdr; + + shndx_hdr = & elf_symtab_shndx_list (abfd)->hdr; + shndx = (Elf_External_Sym_Shndx *) shndx_hdr->contents; + } + else + { + shndx = NULL; + } for (; irel < irelend; irel++) { @@ -3078,7 +3443,7 @@ v850_elf_relax_section (bfd *abfd, *again = FALSE; - if (link_info->relocatable + if (bfd_link_relocatable (link_info) || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0) return TRUE; @@ -3116,7 +3481,7 @@ v850_elf_relax_section (bfd *abfd, if (alignmoveto < alignto) { - unsigned int i; + bfd_vma i; align_pad_size = alignto - alignmoveto; #ifdef DEBUG_RELAX @@ -3745,7 +4110,7 @@ static const struct bfd_elf_special_section v850_elf_special_sections[] = { NULL, 0, 0, 0, 0 } }; -#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 @@ -3768,10 +4133,12 @@ static const struct bfd_elf_special_section v850_elf_special_sections[] = #define elf_backend_gc_mark_hook v850_elf_gc_mark_hook #define elf_backend_special_sections v850_elf_special_sections -#define elf_backend_can_gc_sections 1 -#define elf_backend_rela_normal 1 +#define elf_backend_can_gc_sections 1 +#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 @@ -3876,9 +4243,8 @@ v800_elf_info_to_howto (bfd * abfd, cache_ptr->howto = v800_elf_howto_table + r_type; } - #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