/* MSP430-specific support for 32-bit ELF
- Copyright (C) 2002-2018 Free Software Foundation, Inc.
+ Copyright (C) 2002-2019 Free Software Foundation, Inc.
Contributed by Dmitry Diky <diwil@mail.ru>
This file is part of BFD, the Binary File Descriptor library.
/* Set the howto pointer for an MSP430 ELF reloc. */
-static void
+static bfd_boolean
msp430_info_to_howto_rela (bfd * abfd,
arelent * cache_ptr,
Elf_Internal_Rela * dst)
/* 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_msp430x_howto_table + r_type;
- return;
}
-
- if (r_type >= (unsigned int) R_MSP430_max)
+ else if (r_type >= (unsigned int) R_MSP430_max)
{
/* 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_msp430_howto_table[r_type];
+ else
+ cache_ptr->howto = &elf_msp430_howto_table[r_type];
+
+ return TRUE;
}
/* Look through the relocs for a section during the first phase.
{
info->callbacks->warning
(info,
- _("Try enabling relaxation to avoid relocation truncations"),
+ _("try enabling relaxation to avoid relocation truncations"),
NULL, input_bfd, input_section, relocation);
warned = TRUE;
}
{
info->callbacks->warning
(info,
- _("Try enabling relaxation to avoid relocation truncations"),
+ _("try enabling relaxation to avoid relocation truncations"),
NULL, input_bfd, input_section, relocation);
warned = TRUE;
}
file. This gets the MSP430 architecture right based on the machine
number. */
-static void
-bfd_elf_msp430_final_write_processing (bfd * abfd,
- bfd_boolean linker ATTRIBUTE_UNUSED)
+static bfd_boolean
+bfd_elf_msp430_final_write_processing (bfd *abfd)
{
unsigned long val;
elf_elfheader (abfd)->e_machine = EM_MSP430;
elf_elfheader (abfd)->e_flags &= ~EF_MSP430_MACH;
elf_elfheader (abfd)->e_flags |= val;
+ return _bfd_elf_final_write_processing (abfd);
}
/* Set the right machine number. */
{
_bfd_error_handler
/* xgettext:c-format */
- (_("Warning: %pB: Unknown MSPABI object attribute %d"),
+ (_("warning: %pB: unknown MSPABI object attribute %d"),
abfd, tag);
return TRUE;
}
if (ibfd->flags & BFD_LINKER_CREATED)
return TRUE;
+ /* LTO can create temporary files for linking which may not have an attribute
+ section. */
+ if (ibfd->lto_output
+ && bfd_get_section_by_name (ibfd, ".MSP430.attributes") == NULL)
+ return TRUE;
+
/* If this is the first real object just copy the attributes. */
if (!elf_known_obj_attributes_proc (obfd)[0].i)
{