This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix the address size computation for the MSP430 port.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=79559014b26f3c6bc64f29dabce613fa89418ee5

commit 79559014b26f3c6bc64f29dabce613fa89418ee5
Author: Nick Clifton <nickc@redhat.com>
Date:   Mon Jul 27 15:15:28 2015 +0100

    Fix the address size computation for the MSP430 port.
    
    	* elf32-msp430.c (uses_large_model): New function.
    	(msp430_elf_eh_frame_address_size): New function.
    	(elf_backend_eh_frame_address_size): Define.

Diff:
---
 bfd/ChangeLog      |  6 ++++++
 bfd/elf32-msp430.c | 22 ++++++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index afe2f0f..2aa9fe5 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2015-07-27  Nick Clifton  <nickc@redhat.com>
+
+	* elf32-msp430.c (uses_large_model): New function.
+	(msp430_elf_eh_frame_address_size): New function.
+	(elf_backend_eh_frame_address_size): Define.
+
 2015-07-27  Szabolcs Nagy  <szabolcs.nagy@arm.com>
 
 	PR ld/18705
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]