diff options
author | Khem Raj <raj.khem@gmail.com> | 2020-10-26 21:32:22 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2020-10-27 08:39:09 -0700 |
commit | b5f20c99bedd1c101c778e7a046c152d93c1dd2f (patch) | |
tree | 04fd8d6532a569136281221586ff8e1aa8068c55 /meta-oe/recipes-extended/redis | |
parent | ae0d7b3a0ef1611b721276c0821e8299d8d51623 (diff) | |
download | meta-openembedded-b5f20c99bedd1c101c778e7a046c152d93c1dd2f.tar.gz |
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>
Diffstat (limited to 'meta-oe/recipes-extended/redis')
-rw-r--r-- | meta-oe/recipes-extended/redis/redis/riscv32.patch | 47 | ||||
-rw-r--r-- | meta-oe/recipes-extended/redis/redis_6.0.8.bb | 2 |
2 files changed, 49 insertions, 0 deletions
diff --git a/meta-oe/recipes-extended/redis/redis/riscv32.patch b/meta-oe/recipes-extended/redis/redis/riscv32.patch new file mode 100644 index 000000000..79ec7423d --- /dev/null +++ b/meta-oe/recipes-extended/redis/redis/riscv32.patch | |||
@@ -0,0 +1,47 @@ | |||
1 | Define correct gregs for RISCV32 | ||
2 | |||
3 | Upstream-Status: Pending | ||
4 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
5 | --- a/src/debug.c | ||
6 | +++ b/src/debug.c | ||
7 | @@ -942,7 +942,9 @@ static void *getMcontextEip(ucontext_t * | ||
8 | #endif | ||
9 | #elif defined(__linux__) | ||
10 | /* Linux */ | ||
11 | - #if defined(__i386__) || defined(__ILP32__) | ||
12 | + #if defined(__riscv) && __riscv_xlen == 32 | ||
13 | + return (void*) uc->uc_mcontext.__gregs[REG_PC]; | ||
14 | + #elif defined(__i386__) || defined(__ILP32__) | ||
15 | return (void*) uc->uc_mcontext.gregs[14]; /* Linux 32 */ | ||
16 | #elif defined(__X86_64__) || defined(__x86_64__) | ||
17 | return (void*) uc->uc_mcontext.gregs[16]; /* Linux 64 */ | ||
18 | @@ -1102,8 +1104,28 @@ void logRegisters(ucontext_t *uc) { | ||
19 | #endif | ||
20 | /* Linux */ | ||
21 | #elif defined(__linux__) | ||
22 | + /* Linux RISCV32 */ | ||
23 | + #if defined(__riscv) && __riscv_xlen == 32 | ||
24 | + serverLog(LL_WARNING, | ||
25 | + "\n" | ||
26 | + "RA:%08lx S0:%08lx S1:%08lx S2:%08lx\n" | ||
27 | + "SP:%08lx PC:%08lx A0:%08lx A1:%08lx\n" | ||
28 | + "A2 :%08lx A3:%08lx A4:%08lx", | ||
29 | + (unsigned long) uc->uc_mcontext.__gregs[REG_RA], | ||
30 | + (unsigned long) uc->uc_mcontext.__gregs[REG_S0], | ||
31 | + (unsigned long) uc->uc_mcontext.__gregs[REG_S1], | ||
32 | + (unsigned long) uc->uc_mcontext.__gregs[REG_S2], | ||
33 | + (unsigned long) uc->uc_mcontext.__gregs[REG_SP], | ||
34 | + (unsigned long) uc->uc_mcontext.__gregs[REG_PC], | ||
35 | + (unsigned long) uc->uc_mcontext.__gregs[REG_A0 + 0], | ||
36 | + (unsigned long) uc->uc_mcontext.__gregs[REG_A0 + 1], | ||
37 | + (unsigned long) uc->uc_mcontext.__gregs[REG_A0 + 2], | ||
38 | + (unsigned long) uc->uc_mcontext.__gregs[REG_A0 + 3], | ||
39 | + (unsigned long) uc->uc_mcontext.__gregs[REG_A0 + 4] | ||
40 | + ); | ||
41 | + logStackContent((void**)uc->uc_mcontext.__gregs[REG_SP]); | ||
42 | /* Linux x86 */ | ||
43 | - #if defined(__i386__) || defined(__ILP32__) | ||
44 | + #elif defined(__i386__) || defined(__ILP32__) | ||
45 | serverLog(LL_WARNING, | ||
46 | "\n" | ||
47 | "EAX:%08lx EBX:%08lx ECX:%08lx EDX:%08lx\n" | ||
diff --git a/meta-oe/recipes-extended/redis/redis_6.0.8.bb b/meta-oe/recipes-extended/redis/redis_6.0.8.bb index 64b137c1b..546332851 100644 --- a/meta-oe/recipes-extended/redis/redis_6.0.8.bb +++ b/meta-oe/recipes-extended/redis/redis_6.0.8.bb | |||
@@ -15,6 +15,7 @@ SRC_URI = "http://download.redis.io/releases/${BP}.tar.gz \ | |||
15 | file://oe-use-libc-malloc.patch \ | 15 | file://oe-use-libc-malloc.patch \ |
16 | file://0001-src-Do-not-reset-FINAL_LIBS.patch \ | 16 | file://0001-src-Do-not-reset-FINAL_LIBS.patch \ |
17 | file://GNU_SOURCE.patch \ | 17 | file://GNU_SOURCE.patch \ |
18 | file://riscv32.patch \ | ||
18 | " | 19 | " |
19 | 20 | ||
20 | SRC_URI[md5sum] = "70113b4b8ea7ee4c7e148be62b5d1e0b" | 21 | SRC_URI[md5sum] = "70113b4b8ea7ee4c7e148be62b5d1e0b" |
@@ -23,6 +24,7 @@ SRC_URI[sha256sum] = "04fa1fddc39bd1aecb6739dd5dd73858a3515b427acd1e2947a66dadce | |||
23 | inherit autotools-brokensep update-rc.d systemd useradd | 24 | inherit autotools-brokensep update-rc.d systemd useradd |
24 | 25 | ||
25 | FINAL_LIBS_x86_toolchain-clang = "-latomic" | 26 | FINAL_LIBS_x86_toolchain-clang = "-latomic" |
27 | FINAL_LIBS_riscv32_toolchain-clang = "-latomic" | ||
26 | FINAL_LIBS_mips = "-latomic" | 28 | FINAL_LIBS_mips = "-latomic" |
27 | FINAL_LIBS_arm = "-latomic" | 29 | FINAL_LIBS_arm = "-latomic" |
28 | FINAL_LIBS_powerpc = "-latomic" | 30 | FINAL_LIBS_powerpc = "-latomic" |