This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[PATCH 1/2] RISC-V: Fix alignment issue in sigjmp_buf
- From: Kito Cheng <kito dot cheng at gmail dot com>
- To: Newlib <newlib at sourceware dot org>, patches at groups dot riscv dot org
- Date: Thu, 18 Jan 2018 11:04:20 +0800
- Subject: [PATCH 1/2] RISC-V: Fix alignment issue in sigjmp_buf
- Authentication-results: sourceware.org; auth=none
This patch fix a potential mis-alignment issue in sigjump_buf, load a
double floating value required 8 bytes align, but we just align to
size of long, it's may cause mis-align memory access in rv32imafd.
From d23ba9ea7f842dda65b89cb80c396d1254b4e934 Mon Sep 17 00:00:00 2001
From: Kito Cheng <kito.cheng@gmail.com>
Date: Fri, 17 Nov 2017 14:50:52 +0800
Subject: [PATCH 1/2] RISC-V: Fix alignment issue in sigjmp_buf
---
newlib/libc/include/machine/setjmp.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/newlib/libc/include/machine/setjmp.h b/newlib/libc/include/machine/setjmp.h
index b33f437..9212f84 100644
--- a/newlib/libc/include/machine/setjmp.h
+++ b/newlib/libc/include/machine/setjmp.h
@@ -359,7 +359,9 @@ _BEGIN_STD_C
#endif
#ifdef __riscv
-#define _JBTYPE long
+/* _JBTYPE using long long to make sure the alignment is align to 8 byte,
+ otherwise in rv32imafd, store/restore FPR may mis-align. */
+#define _JBTYPE long long
#ifdef __riscv_32e
#define _JBLEN ((4*sizeof(long))/sizeof(long))
#else
--
2.7.4