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/binutils-2_29-branch] Import patch from mainline to allows 16-bit MSP430 absolute branches to be relaxed ino 1-bit PC-rela


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

commit 3a6dbb3b26286620530c131430f5052949e5c6a6
Author: Nick Clifton <nickc@redhat.com>
Date:   Mon Sep 4 16:43:00 2017 +0100

    Import patch from mainline to allows 16-bit MSP430 absolute branches to be relaxed ino 1-bit PC-relative branches.
    
    	PR 21824
    	* elf32-msp430.c (msp430_elf_relax_section): Allow conversion of
    	16-bit absolute branches into 10-bit pc-relative branches on the
    	MSP430 as well as the MSP430X.

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

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ac1e404..870962c 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -47,6 +47,11 @@
 	(alpha_vms_slurp_relocs): Likewise.
 	(alpha_vms_object_p): Check for a truncated record.
 
+	PR 21824
+	* elf32-msp430.c (msp430_elf_relax_section): Allow conversion of
+	16-bit absolute branches into 10-bit pc-relative branches on the
+	MSP430 as well as the MSP430X.
+
 2017-09-04  Alan Modra  <amodra@gmail.com>
 
 	PR 22067
diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c
index 9fae015..e1e6ed0 100644
--- a/bfd/elf32-msp430.c
+++ b/bfd/elf32-msp430.c
@@ -2227,8 +2227,10 @@ msp430_elf_relax_section (bfd * abfd, asection * sec,
 
 	/* Try to turn a 16-bit absolute branch into a 10-bit pc-relative
 	   branch.  */
-	if (uses_msp430x_relocs (abfd)
-	    && ELF32_R_TYPE (irel->r_info) == R_MSP430X_ABS16)
+	if ((uses_msp430x_relocs (abfd)
+	     && ELF32_R_TYPE (irel->r_info) == R_MSP430X_ABS16)
+	    || (! uses_msp430x_relocs (abfd)
+		&& ELF32_R_TYPE (irel->r_info) == R_MSP430_16))
 	  {
 	    bfd_vma value = symval;


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