X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Felf32-bfin.c;h=c4f8874b24fe4e728bca7a5d0ddbde5e71ed247e;hb=b61121178ec07f9da1242e439fe1a23a314ad30e;hp=478b8d4731bb8a1cafdd5151cb80f6f0517c498f;hpb=219d1afa89d0d53ca93a684cac341f16470f3ca0;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c index 478b8d4731..c4f8874b24 100644 --- a/bfd/elf32-bfin.c +++ b/bfd/elf32-bfin.c @@ -1,5 +1,5 @@ /* ADI Blackfin BFD support for 32-bit ELF. - Copyright (C) 2005-2018 Free Software Foundation, Inc. + Copyright (C) 2005-2019 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -25,6 +25,7 @@ #include "elf/bfin.h" #include "dwarf2.h" #include "hashtab.h" +#include "elf32-bfin.h" /* FUNCTION : bfin_pltpc_reloc ABSTRACT : TODO : figure out how to handle pltpc relocs. */ @@ -142,12 +143,12 @@ bfin_pcrel24_reloc (bfd *abfd, static bfd_reloc_status_type bfin_imm16_reloc (bfd *abfd, - arelent *reloc_entry, - asymbol *symbol, - void * data, - asection *input_section, - bfd *output_bfd, - char **error_message ATTRIBUTE_UNUSED) + arelent *reloc_entry, + asymbol *symbol, + void * data, + asection *input_section, + bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { bfd_vma relocation, x; bfd_size_type reloc_addr = reloc_entry->address; @@ -281,11 +282,11 @@ bfin_byte4_reloc (bfd *abfd, static bfd_reloc_status_type bfin_bfd_reloc (bfd *abfd, arelent *reloc_entry, - asymbol *symbol, - void * data, - asection *input_section, - bfd *output_bfd, - char **error_message ATTRIBUTE_UNUSED) + asymbol *symbol, + void * data, + asection *input_section, + bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { bfd_vma relocation; bfd_size_type addr = reloc_entry->address; @@ -1040,8 +1041,8 @@ static const struct bfin_reloc_map bfin_reloc_map [] = }; -static void -bfin_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, +static bfd_boolean +bfin_info_to_howto (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst) { @@ -1056,7 +1057,15 @@ bfin_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, cache_ptr->howto = &bfin_gnuext_howto_table [r_type - BFIN_GNUEXT_RELOC_MIN]; else - cache_ptr->howto = (reloc_howto_type *) NULL; + { + /* xgettext:c-format */ + _bfd_error_handler (_("%pB: unsupported relocation type %#x"), + abfd, r_type); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + return TRUE; } /* Given a BFD reloc type, return the howto. */ @@ -1125,14 +1134,14 @@ bfd_boolean elf32_bfin_code_in_l1 = 0; /* Set by ld emulation if --data-in-l1. */ bfd_boolean elf32_bfin_data_in_l1 = 0; -static void -elf32_bfin_final_write_processing (bfd *abfd, - bfd_boolean linker ATTRIBUTE_UNUSED) +static bfd_boolean +elf32_bfin_final_write_processing (bfd *abfd) { if (elf32_bfin_code_in_l1) elf_elfheader (abfd)->e_flags |= EF_BFIN_CODE_IN_L1; if (elf32_bfin_data_in_l1) elf_elfheader (abfd)->e_flags |= EF_BFIN_DATA_IN_L1; + return _bfd_elf_final_write_processing (abfd); } /* Return TRUE if the name is a local label. @@ -1202,9 +1211,7 @@ bfin_check_relocs (bfd * abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_BFIN_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; @@ -1574,9 +1581,10 @@ bfin_relocate_section (bfd * output_bfd, { _bfd_error_handler /* xgettext:c-format */ - (_("%B(%A+%#Lx): unresolvable relocation against symbol `%s'"), - input_bfd, - input_section, rel->r_offset, h->root.root.string); + (_("%pB(%pA+%#" PRIx64 "): " + "unresolvable relocation against symbol `%s'"), + input_bfd, input_section, (uint64_t) rel->r_offset, + h->root.root.string); return FALSE; } @@ -1594,7 +1602,7 @@ bfin_relocate_section (bfd * output_bfd, if (name == NULL) return FALSE; if (*name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } if (r == bfd_reloc_overflow) @@ -1605,8 +1613,9 @@ bfin_relocate_section (bfd * output_bfd, { _bfd_error_handler /* xgettext:c-format */ - (_("%B(%A+%#Lx): reloc against `%s': error %d"), - input_bfd, input_section, rel->r_offset, name, (int) r); + (_("%pB(%pA+%#" PRIx64 "): reloc against `%s': error %d"), + input_bfd, input_section, (uint64_t) rel->r_offset, + name, (int) r); return FALSE; } } @@ -2552,7 +2561,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + name = name == NULL ? bfd_section_name (sec) : name; } else { @@ -2625,8 +2634,9 @@ bfinfdpic_relocate_section (bfd * output_bfd, { _bfd_error_handler /* xgettext:c-format */ - (_("%B: relocation at `%A+%#Lx' references symbol `%s' with nonzero addend"), - input_bfd, input_section, rel->r_offset, name); + (_("%pB: relocation at `%pA+%#" PRIx64 "' " + "references symbol `%s' with nonzero addend"), + input_bfd, input_section, (uint64_t) rel->r_offset, name); return FALSE; } @@ -2769,8 +2779,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, bfd_vma offset; addend += bfinfdpic_got_section (info)->output_section->vma; - if ((bfd_get_section_flags (output_bfd, - input_section->output_section) + if ((bfd_section_flags (input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { if (_bfinfdpic_osec_readonly_p (output_bfd, @@ -2798,8 +2807,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, picrel); } } - else if ((bfd_get_section_flags (output_bfd, - input_section->output_section) + else if ((bfd_section_flags (input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { bfd_vma offset; @@ -2892,8 +2900,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, if (osec) addend += osec->output_section->vma; if (IS_FDPIC (input_bfd) - && (bfd_get_section_flags (output_bfd, - input_section->output_section) + && (bfd_section_flags (input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { if (_bfinfdpic_osec_readonly_p (output_bfd, @@ -2930,8 +2937,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, } else { - if ((bfd_get_section_flags (output_bfd, - input_section->output_section) + if ((bfd_section_flags (input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { if (_bfinfdpic_osec_readonly_p (output_bfd, @@ -3192,7 +3198,7 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".got", flags); elf_hash_table (info)->sgot = s; if (s == NULL - || !bfd_set_section_alignment (abfd, s, ptralign)) + || !bfd_set_section_alignment (s, ptralign)) return FALSE; if (bed->want_got_sym) @@ -3229,7 +3235,7 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".rel.got", (flags | SEC_READONLY)); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, 2)) + || !bfd_set_section_alignment (s, 2)) return FALSE; bfinfdpic_gotrel_section (info) = s; @@ -3238,7 +3244,7 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".rofixup", (flags | SEC_READONLY)); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, 2)) + || !bfd_set_section_alignment (s, 2)) return FALSE; bfinfdpic_gotfixup_section (info) = s; @@ -3252,7 +3258,7 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) + || !bfd_set_section_alignment (s, bed->plt_alignment)) return FALSE; /* Blackfin-specific: remember it. */ bfinfdpic_plt_section (info) = s; @@ -3280,7 +3286,7 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".rel.plt", flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; /* Blackfin-specific: remember it. */ bfinfdpic_pltrel_section (info) = s; @@ -3346,7 +3352,7 @@ elf32_bfinfdpic_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) ".rela.bss", flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; } } @@ -4607,7 +4613,7 @@ bfinfdpic_check_relocs (bfd *abfd, struct bfd_link_info *info, case R_BFIN_FUNCDESC_VALUE: picrel->relocsfdv++; - if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) + if (bfd_section_flags (sec) & SEC_ALLOC) picrel->relocs32--; /* Fall through. */ @@ -4616,7 +4622,7 @@ bfinfdpic_check_relocs (bfd *abfd, struct bfd_link_info *info, break; picrel->sym++; - if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) + if (bfd_section_flags (sec) & SEC_ALLOC) picrel->relocs32++; break; @@ -4684,7 +4690,7 @@ bfinfdpic_check_relocs (bfd *abfd, struct bfd_link_info *info, bad_reloc: _bfd_error_handler /* xgettext:c-format */ - (_("%B: unsupported relocation type %d"), + (_("%pB: unsupported relocation type %#x"), abfd, (int) ELF32_R_TYPE (rel->r_info)); return FALSE; } @@ -4759,7 +4765,7 @@ elf32_bfin_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info) if (0) #endif _bfd_error_handler - ("old_flags = 0x%.8x, new_flags = 0x%.8x, init = %s, filename = %B", + ("old_flags = 0x%.8x, new_flags = 0x%.8x, init = %s, filename = %pB", old_flags, new_flags, elf_flags_init (obfd) ? "yes" : "no", ibfd); if (!elf_flags_init (obfd)) /* First call, no flags set. */ @@ -4773,11 +4779,11 @@ elf32_bfin_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info) error = TRUE; if (IS_FDPIC (obfd)) _bfd_error_handler - (_("%B: cannot link non-fdpic object file into fdpic executable"), + (_("%pB: cannot link non-fdpic object file into fdpic executable"), ibfd); else _bfd_error_handler - (_("%B: cannot link fdpic object file into non-fdpic executable"), + (_("%pB: cannot link fdpic object file into non-fdpic executable"), ibfd); } @@ -5055,9 +5061,9 @@ bfin_adjust_dynamic_symbol (struct bfd_link_info *info, /* Apply the required alignment. */ s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); - if (power_of_two > bfd_get_section_alignment (dynobj, s)) + if (power_of_two > bfd_section_alignment (s)) { - if (!bfd_set_section_alignment (dynobj, s, power_of_two)) + if (!bfd_set_section_alignment (s, power_of_two)) return FALSE; } @@ -5191,7 +5197,7 @@ bfin_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED, /* It's OK to base decisions on the section name, because none of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); + name = bfd_section_name (s); strip = FALSE; @@ -5337,7 +5343,7 @@ bfd_bfin_elf32_create_embedded_relocs (bfd *abfd, /* We can only relocate absolute longword relocs at run time. */ if (ELF32_R_TYPE (irel->r_info) != (int) R_BFIN_BYTE4_DATA) { - *errmsg = _("unsupported reloc type"); + *errmsg = _("unsupported relocation type"); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -5421,7 +5427,7 @@ struct bfd_elf_special_section const elf32_bfin_special_sections[] = #define bfd_elf32_bfd_reloc_name_lookup \ bfin_bfd_reloc_name_lookup #define elf_info_to_howto bfin_info_to_howto -#define elf_info_to_howto_rel 0 +#define elf_info_to_howto_rel NULL #define elf_backend_object_p elf32_bfin_object_p #define bfd_elf32_bfd_is_local_label_name \