[binutils-gdb] Add a linker branch optimization for the MSP430.

Nick Clifton nickc@sourceware.org
Tue Jul 25 08:41:00 GMT 2017


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

commit cfe7b9bd58c634bda974e291ce95030b1e42a690
Author: Benjamin Green <bengreen5mx@gmail.com>
Date:   Tue Jul 25 09:41:23 2017 +0100

    Add a linker branch optimization for the MSP430.
    
    	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      | 7 +++++++
 bfd/elf32-msp430.c | 4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index d224022..aacae0f 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2017-07-25  Benjamin Green  <bengreen5mx@gmail.com>
+
+	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-07-25  Alan Modra  <amodra@gmail.com>
 
 	* elf64-ppc.c (struct map_stub): Add tls_get_addr_opt_bctrl.
diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c
index 9fae015..75a6288 100644
--- a/bfd/elf32-msp430.c
+++ b/bfd/elf32-msp430.c
@@ -2227,8 +2227,8 @@ 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 (ELF32_R_TYPE (irel->r_info) == R_MSP430X_ABS16
+	    || ELF32_R_TYPE (irel->r_info) == R_MSP430_16)
 	  {
 	    bfd_vma value = symval;



More information about the Binutils-cvs mailing list