This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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]

[PATCH] [MSP430] Fix incorrect assembly code in _msp430_run_array


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
>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


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