[MSP430] Fix incorrect assembly code in _msp430_run_array

Message ID 20190415181304.7da2bb45@jozef-kubuntu
State New
Headers show
Series
  • [MSP430] Fix incorrect assembly code in _msp430_run_array
Related show

Commit Message

Jozef Lawrynowicz April 15, 2019, 5:13 p.m.
The attached patch fixes incorrect assembly code in _msp430_run_array from
crt0.S.

When {.preinit,.init,.fini}_array sections contain pointers to functions that
need to be executed, _msp430_run_array is supposed to run through the table
and call these functions. However, currently the assembly code is wrong and
the CPU exhibits undefined behaviour when trying to execute the required
functions from these arrays.

If the patch is acceptable, I would appreciate if someone could commit it
for me, as I do not have write access.

Thanks,
Jozef

Comments

Corinna Vinschen April 16, 2019, 11:24 a.m. | #1
On Apr 15 18:13, Jozef Lawrynowicz wrote:
> >From 0b0a51a95c73dcff21639eb5f66e0686b88456bd Mon Sep 17 00:00:00 2001

> From: Jozef Lawrynowicz <jozef.l@mittosystems.com>

> Date: Mon, 15 Apr 2019 18:06:09 +0100

> Subject: [PATCH] [MSP430] Fix incorrect assembly code in _msp430_run_array

> 

> ---

>  libgloss/msp430/crt0.S | 4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)

> 

> diff --git a/libgloss/msp430/crt0.S b/libgloss/msp430/crt0.S

> index f5ab8d335..53162e6bd 100644

> --- a/libgloss/msp430/crt0.S

> +++ b/libgloss/msp430/crt0.S

> @@ -246,8 +246,8 @@ _msp430_run_array:

>  	jeq	_msp430_run_done

>  	mov_	@R4, R7

>  	add_	R6, R4

> -	call_	@R7

> -	br_	_msp430_run_array

> +	call_	R7

> +	br_	#_msp430_run_array

>  

>  _msp430_run_done:

>  	ret_

> -- 

> 2.17.1

> 


Pushed.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Patch

From 0b0a51a95c73dcff21639eb5f66e0686b88456bd Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
Date: Mon, 15 Apr 2019 18:06:09 +0100
Subject: [PATCH] [MSP430] Fix incorrect assembly code in _msp430_run_array

---
 libgloss/msp430/crt0.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libgloss/msp430/crt0.S b/libgloss/msp430/crt0.S
index f5ab8d335..53162e6bd 100644
--- a/libgloss/msp430/crt0.S
+++ b/libgloss/msp430/crt0.S
@@ -246,8 +246,8 @@  _msp430_run_array:
 	jeq	_msp430_run_done
 	mov_	@R4, R7
 	add_	R6, R4
-	call_	@R7
-	br_	_msp430_run_array
+	call_	R7
+	br_	#_msp430_run_array
 
 _msp430_run_done:
 	ret_
-- 
2.17.1