Hi Zvika,

> I've encountered another BFD problem, similar to the one reported by Eric a
> few months back (2015-03-25 13:43:23).

>    /usr/libexec/gcc/msp430-elf/ld: BFD (Gentoo 2.25.1 p1.0) 2.25.1 internal
> error, aborting at
> /var/tmp/portage/cross-msp430-elf/binutils-2.25.1/work/binutils-2.25.1/bfd/elf-eh-frame.c
> line 1732 in _bfd_elf_write_section_eh_frame

> I've narrowed it down to an [.eh_frame] in one of the object files, which
> has a size of 74 (0x4a) while ptr_size is 4.

Please could you try the patch found in this email (and copied here for 
ease of access):

   https://www.sourceware.org/ml/binutils/2015-07/msg00319.html

The issue is the the MSP430 has two different sizes for its pointers, 
depending upon whether large mode has been enabled or not, but the BFD 
library was assuming that pointers were always 4 bytes long...


Cheers
   Nick

diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c
index 9e69791..83bb9ce 100644
--- a/bfd/elf32-msp430.c
+++ b/bfd/elf32-msp430.c
@@ -2532,6 +2532,27 @@ msp430_elf_is_target_special_symbol (bfd *abfd, 
asymbol *sym)
    return _bfd_elf_is_local_label_name (abfd, sym->name);
  }

+static bfd_boolean
+uses_large_model (bfd *abfd)
+{
+  obj_attribute * attr;
+
+  if (abfd->flags & BFD_LINKER_CREATED)
+    return FALSE;
+
+  attr = elf_known_obj_attributes_proc (abfd);
+  if (attr == NULL)
+    return FALSE;
+
+  return attr[OFBA_MSPABI_Tag_Code_Model].i == 2;
+}
+
+static unsigned int
+elf32_msp430_eh_frame_address_size (bfd *abfd, asection *sec 
ATTRIBUTE_UNUSED)
+{
+  return uses_large_model (abfd) ? 4 : 2;
+}
+
  /* This is gross.  The MSP430 EABI says that (sec 11.5):

       "An implementation may choose to use Rel or Rela
@@ -2563,6 +2584,7 @@ msp430_elf_is_target_special_symbol (bfd *abfd, 
asymbol *sym)
  #undef  elf_backend_obj_attrs_arg_type
  #define elf_backend_obj_attrs_arg_type                
elf32_msp430_obj_attrs_arg_type
  #define bfd_elf32_bfd_merge_private_bfd_data 
elf32_msp430_merge_private_bfd_data
+#define elf_backend_eh_frame_address_size 
elf32_msp430_eh_frame_address_size

  #define ELF_ARCH              bfd_arch_msp430
  #define ELF_MACHINE_CODE      EM_MSP430



------------------------------------------------------------------------------
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to