mirror of
git://git.openembedded.org/meta-openembedded
synced 2026-01-01 13:58:06 +00:00
redis: Fix build with clang on riscv32
clang defines __ILP32__ for rv32 but gcc does not as a result backtracing gets enabled when using clang but not when using gcc so clang build exposes a porting error. Therefore add code to return correct mcontext on rv32 Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
parent
ae0d7b3a0e
commit
b5f20c99be
47
meta-oe/recipes-extended/redis/redis/riscv32.patch
Normal file
47
meta-oe/recipes-extended/redis/redis/riscv32.patch
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
Define correct gregs for RISCV32
|
||||
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
--- a/src/debug.c
|
||||
+++ b/src/debug.c
|
||||
@@ -942,7 +942,9 @@ static void *getMcontextEip(ucontext_t *
|
||||
#endif
|
||||
#elif defined(__linux__)
|
||||
/* Linux */
|
||||
- #if defined(__i386__) || defined(__ILP32__)
|
||||
+ #if defined(__riscv) && __riscv_xlen == 32
|
||||
+ return (void*) uc->uc_mcontext.__gregs[REG_PC];
|
||||
+ #elif defined(__i386__) || defined(__ILP32__)
|
||||
return (void*) uc->uc_mcontext.gregs[14]; /* Linux 32 */
|
||||
#elif defined(__X86_64__) || defined(__x86_64__)
|
||||
return (void*) uc->uc_mcontext.gregs[16]; /* Linux 64 */
|
||||
@@ -1102,8 +1104,28 @@ void logRegisters(ucontext_t *uc) {
|
||||
#endif
|
||||
/* Linux */
|
||||
#elif defined(__linux__)
|
||||
+ /* Linux RISCV32 */
|
||||
+ #if defined(__riscv) && __riscv_xlen == 32
|
||||
+ serverLog(LL_WARNING,
|
||||
+ "\n"
|
||||
+ "RA:%08lx S0:%08lx S1:%08lx S2:%08lx\n"
|
||||
+ "SP:%08lx PC:%08lx A0:%08lx A1:%08lx\n"
|
||||
+ "A2 :%08lx A3:%08lx A4:%08lx",
|
||||
+ (unsigned long) uc->uc_mcontext.__gregs[REG_RA],
|
||||
+ (unsigned long) uc->uc_mcontext.__gregs[REG_S0],
|
||||
+ (unsigned long) uc->uc_mcontext.__gregs[REG_S1],
|
||||
+ (unsigned long) uc->uc_mcontext.__gregs[REG_S2],
|
||||
+ (unsigned long) uc->uc_mcontext.__gregs[REG_SP],
|
||||
+ (unsigned long) uc->uc_mcontext.__gregs[REG_PC],
|
||||
+ (unsigned long) uc->uc_mcontext.__gregs[REG_A0 + 0],
|
||||
+ (unsigned long) uc->uc_mcontext.__gregs[REG_A0 + 1],
|
||||
+ (unsigned long) uc->uc_mcontext.__gregs[REG_A0 + 2],
|
||||
+ (unsigned long) uc->uc_mcontext.__gregs[REG_A0 + 3],
|
||||
+ (unsigned long) uc->uc_mcontext.__gregs[REG_A0 + 4]
|
||||
+ );
|
||||
+ logStackContent((void**)uc->uc_mcontext.__gregs[REG_SP]);
|
||||
/* Linux x86 */
|
||||
- #if defined(__i386__) || defined(__ILP32__)
|
||||
+ #elif defined(__i386__) || defined(__ILP32__)
|
||||
serverLog(LL_WARNING,
|
||||
"\n"
|
||||
"EAX:%08lx EBX:%08lx ECX:%08lx EDX:%08lx\n"
|
||||
|
|
@ -15,6 +15,7 @@ SRC_URI = "http://download.redis.io/releases/${BP}.tar.gz \
|
|||
file://oe-use-libc-malloc.patch \
|
||||
file://0001-src-Do-not-reset-FINAL_LIBS.patch \
|
||||
file://GNU_SOURCE.patch \
|
||||
file://riscv32.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "70113b4b8ea7ee4c7e148be62b5d1e0b"
|
||||
|
|
@ -23,6 +24,7 @@ SRC_URI[sha256sum] = "04fa1fddc39bd1aecb6739dd5dd73858a3515b427acd1e2947a66dadce
|
|||
inherit autotools-brokensep update-rc.d systemd useradd
|
||||
|
||||
FINAL_LIBS_x86_toolchain-clang = "-latomic"
|
||||
FINAL_LIBS_riscv32_toolchain-clang = "-latomic"
|
||||
FINAL_LIBS_mips = "-latomic"
|
||||
FINAL_LIBS_arm = "-latomic"
|
||||
FINAL_LIBS_powerpc = "-latomic"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user