X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=bfd%2Felf32-m68hc11.c;h=7bbb48962d2e86f3df36624d342cd6032541140b;hb=cf6f3e86ded2cd950f59a0f2c164f2c953ef534b;hp=4c57fe8235477f6a9b6df1023472c7d0b3de738c;hpb=0aa13feeeb78fc9323bee329c4d91c30f25de121;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c index 4c57fe8235..7bbb48962d 100644 --- a/bfd/elf32-m68hc11.c +++ b/bfd/elf32-m68hc11.c @@ -1,5 +1,5 @@ /* Motorola 68HC11-specific support for 32-bit ELF - Copyright (C) 1999-2018 Free Software Foundation, Inc. + Copyright (C) 1999-2020 Free Software Foundation, Inc. Contributed by Stephane Carrez (stcarrez@nerim.fr) (Heavily copied from the D10V port by Martin Hunt (hunt@cygnus.com)) @@ -32,7 +32,7 @@ /* Relocation functions. */ static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup (bfd *, bfd_reloc_code_real_type); -static void m68hc11_info_to_howto_rel +static bfd_boolean m68hc11_info_to_howto_rel (bfd *, arelent *, Elf_Internal_Rela *); /* Trampoline generation. */ @@ -377,7 +377,7 @@ bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, /* Set the howto pointer for an M68HC11 ELF reloc. */ -static void +static bfd_boolean m68hc11_info_to_howto_rel (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst) { @@ -389,9 +389,11 @@ m68hc11_info_to_howto_rel (bfd *abfd, /* xgettext:c-format */ _bfd_error_handler (_("%pB: unsupported relocation type %#x"), abfd, r_type); - r_type = 0; + bfd_set_error (bfd_error_bad_value); + return FALSE; } cache_ptr->howto = &elf_m68hc11_howto_table[r_type]; + return TRUE; } @@ -413,6 +415,14 @@ m68hc11_elf_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) stub_entry = (struct elf32_m68hc11_stub_hash_entry *) gen_entry; info = (struct bfd_link_info *) in_arg; + /* Fail if the target section could not be assigned to an output + section. The user should fix his linker script. */ + if (stub_entry->target_section->output_section == NULL + && info->non_contiguous_regions) + info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. " + "Retry without --enable-non-contiguous-regions.\n"), + stub_entry->target_section); + htab = m68hc11_elf_hash_table (info); if (htab == NULL) return FALSE; @@ -1072,11 +1082,8 @@ m68hc11_elf_relax_section (bfd *abfd, asection *sec, prev_insn_group = 0; } - if (free_relocs != NULL) - { - free (free_relocs); - free_relocs = NULL; - } + free (free_relocs); + free_relocs = NULL; if (free_contents != NULL) { @@ -1105,12 +1112,9 @@ m68hc11_elf_relax_section (bfd *abfd, asection *sec, return TRUE; error_return: - if (free_relocs != NULL) - free (free_relocs); - if (free_contents != NULL) - free (free_contents); - if (free_extsyms != NULL) - free (free_extsyms); + free (free_relocs); + free (free_contents); + free (free_extsyms); return FALSE; } @@ -1297,14 +1301,13 @@ static const struct bfd_elf_special_section elf32_m68hc11_special_sections[] = #define TARGET_BIG_SYM m68hc11_elf32_vec #define TARGET_BIG_NAME "elf32-m68hc11" -#define elf_info_to_howto 0 +#define elf_info_to_howto NULL #define elf_info_to_howto_rel m68hc11_info_to_howto_rel #define bfd_elf32_bfd_relax_section m68hc11_elf_relax_section #define elf_backend_check_relocs elf32_m68hc11_check_relocs #define elf_backend_relocate_section elf32_m68hc11_relocate_section #define elf_backend_add_symbol_hook elf32_m68hc11_add_symbol_hook #define elf_backend_object_p 0 -#define elf_backend_final_write_processing 0 #define elf_backend_can_gc_sections 1 #define elf_backend_special_sections elf32_m68hc11_special_sections #define elf_backend_merge_symbol_attribute elf32_m68hc11_merge_symbol_attribute