/* 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
-msp430_info_to_howto_rela (bfd * abfd ATTRIBUTE_UNUSED,
+static bfd_boolean
+msp430_info_to_howto_rela (bfd * abfd,
arelent * cache_ptr,
Elf_Internal_Rela * dst)
{
if (r_type >= (unsigned int) R_MSP430x_max)
{
/* xgettext:c-format */
- _bfd_error_handler (_("%B: invalid MSP430X reloc number: %d"), abfd, r_type);
- r_type = 0;
+ _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
+ abfd, r_type);
+ 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 (_("%B: invalid MSP430 reloc number: %d"), abfd, r_type);
- r_type = 0;
+ _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
+ abfd, r_type);
+ 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;
}
{
_bfd_error_handler
/* xgettext:c-format */
- (_("Warning: %B: 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)
{
{
_bfd_error_handler
/* xgettext:c-format */
- (_("error: %B uses %s instructions but %B uses %s"),
+ (_("error: %pB uses %s instructions but %pB uses %s"),
ibfd, isa_type (in_attr[OFBA_MSPABI_Tag_ISA].i),
first_input_bfd, isa_type (out_attr[OFBA_MSPABI_Tag_ISA].i));
result = FALSE;
{
_bfd_error_handler
/* xgettext:c-format */
- (_("error: %B uses the %s code model whereas %B uses the %s code model"),
+ (_("error: %pB uses the %s code model whereas %pB uses the %s code model"),
ibfd, code_model (in_attr[OFBA_MSPABI_Tag_Code_Model].i),
first_input_bfd, code_model (out_attr[OFBA_MSPABI_Tag_Code_Model].i));
result = FALSE;
{
_bfd_error_handler
/* xgettext:c-format */
- (_("error: %B uses the large code model but %B uses MSP430 instructions"),
+ (_("error: %pB uses the large code model but %pB uses MSP430 instructions"),
ibfd, first_input_bfd);
result = FALSE;
}
{
_bfd_error_handler
/* xgettext:c-format */
- (_("error: %B uses the %s data model whereas %B uses the %s data model"),
+ (_("error: %pB uses the %s data model whereas %pB uses the %s data model"),
ibfd, data_model (in_attr[OFBA_MSPABI_Tag_Data_Model].i),
first_input_bfd, data_model (out_attr[OFBA_MSPABI_Tag_Data_Model].i));
result = FALSE;
{
_bfd_error_handler
/* xgettext:c-format */
- (_("error: %B uses the small code model but %B uses the %s data model"),
+ (_("error: %pB uses the small code model but %pB uses the %s data model"),
ibfd, first_input_bfd,
data_model (out_attr[OFBA_MSPABI_Tag_Data_Model].i));
result = FALSE;
{
_bfd_error_handler
/* xgettext:c-format */
- (_("error: %B uses the %s data model but %B only uses MSP430 instructions"),
+ (_("error: %pB uses the %s data model but %pB only uses MSP430 instructions"),
ibfd, data_model (in_attr[OFBA_MSPABI_Tag_Data_Model].i),
first_input_bfd);
result = FALSE;