From 41ef02b0c594f2e77fb17c1e71cc061e835101bc Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Tue, 10 Sep 2019 19:12:00 -0700 Subject: busybox: Update non-const patch to remaining patterns This was noticed when /bin/ash crashed that there are more instances of this optimization which causes same kind of failures in few other applets As a side benefit busybox compiled with clang works totally fine on riscv64 now Signed-off-by: Khem Raj --- ...r_to_globals-and-bb_errno-to-be-non-const.patch | 56 ++++++++++++++++++++-- recipes-core/busybox/busybox_%.bbappend | 6 ++- 2 files changed, 55 insertions(+), 7 deletions(-) (limited to 'recipes-core') diff --git a/recipes-core/busybox/busybox/0001-Turn-ptr_to_globals-and-bb_errno-to-be-non-const.patch b/recipes-core/busybox/busybox/0001-Turn-ptr_to_globals-and-bb_errno-to-be-non-const.patch index 481b125..c14950a 100644 --- a/recipes-core/busybox/busybox/0001-Turn-ptr_to_globals-and-bb_errno-to-be-non-const.patch +++ b/recipes-core/busybox/busybox/0001-Turn-ptr_to_globals-and-bb_errno-to-be-non-const.patch @@ -1,4 +1,4 @@ -From c7580fdb4be69a872291ccf22334091cace749fc Mon Sep 17 00:00:00 2001 +From d941b59087d34cb93053b638c066bf080122e7bb Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 16 Jan 2019 22:39:24 -0800 Subject: [PATCH] Turn ptr_to_globals and bb_errno to be non const @@ -107,9 +107,25 @@ r14 is 0x0 and writing to this ofcourse ends up in segfault Signed-off-by: Khem Raj --- - include/libbb.h | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - + coreutils/test.c | 2 +- + include/libbb.h | 4 ++-- + libbb/lineedit.c | 2 +- + shell/ash.c | 5 ++--- + 4 files changed, 6 insertions(+), 7 deletions(-) + +diff --git a/coreutils/test.c b/coreutils/test.c +index 868ffbecb..d11fccf5b 100644 +--- a/coreutils/test.c ++++ b/coreutils/test.c +@@ -401,7 +401,7 @@ struct test_statics { + }; + + /* See test_ptr_hack.c */ +-extern struct test_statics *const test_ptr_to_statics; ++extern struct test_statics *test_ptr_to_statics; + + #define S (*test_ptr_to_statics) + #define args (S.args ) diff --git a/include/libbb.h b/include/libbb.h index 111d1b790..a52265e77 100644 --- a/include/libbb.h @@ -132,6 +148,36 @@ index 111d1b790..a52265e77 100644 /* At least gcc 3.4.6 on mipsel system needs optimization barrier */ #define barrier() __asm__ __volatile__("":::"memory") #define SET_PTR_TO_GLOBALS(x) do { \ +diff --git a/libbb/lineedit.c b/libbb/lineedit.c +index fbabc6c12..026c42c4c 100644 +--- a/libbb/lineedit.c ++++ b/libbb/lineedit.c +@@ -181,7 +181,7 @@ struct lineedit_statics { + }; + + /* See lineedit_ptr_hack.c */ +-extern struct lineedit_statics *const lineedit_ptr_to_statics; ++extern struct lineedit_statics * lineedit_ptr_to_statics; + + #define S (*lineedit_ptr_to_statics) + #define state (S.state ) +diff --git a/shell/ash.c b/shell/ash.c +index c5588ea66..6f07f7d6d 100644 +--- a/shell/ash.c ++++ b/shell/ash.c +@@ -297,10 +297,9 @@ typedef long arith_t; + * set "-DBB_GLOBAL_CONST=''" in CONFIG_EXTRA_CFLAGS to disable + * this optimization. + */ +-#ifndef BB_GLOBAL_CONST +-# define BB_GLOBAL_CONST const +-#endif + ++#undef BB_GLOBAL_CONST ++#define BB_GLOBAL_CONST + + /* ============ Hash table sizes. Configurable. */ + -- -2.22.0 +2.23.0 diff --git a/recipes-core/busybox/busybox_%.bbappend b/recipes-core/busybox/busybox_%.bbappend index 959466e..f26df7e 100644 --- a/recipes-core/busybox/busybox_%.bbappend +++ b/recipes-core/busybox/busybox_%.bbappend @@ -1,7 +1,9 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" SRC_URI_append_toolchain-clang = "\ file://0001-Turn-ptr_to_globals-and-bb_errno-to-be-non-const.patch \ - " +" +# networking/tls_pstm_sqr_comba.c:514:4: error: inline assembly requires more registers than available +# SQRADD2(*tmpx++, *tmpy--); +# ^ TOOLCHAIN_x86 = "gcc" -TOOLCHAIN_riscv64 = "gcc" -- cgit v1.2.3-54-g00ecf