From e94a7cc34912faeab063324371595c8b78525297 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 16 Jan 2019 22:51:58 -0800 Subject: busybox: Fix UB due to modifying const pointer see https://bugs.llvm.org/show_bug.cgi?id=39919 Signed-off-by: Khem Raj --- ...a-const-variable-is-undefined-behavior-C9.patch | 27 ++++++++++++++++++++++ recipes-core/busybox/busybox_%.bbappend | 3 ++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 recipes-core/busybox/busybox/0001-writing-to-a-const-variable-is-undefined-behavior-C9.patch diff --git a/recipes-core/busybox/busybox/0001-writing-to-a-const-variable-is-undefined-behavior-C9.patch b/recipes-core/busybox/busybox/0001-writing-to-a-const-variable-is-undefined-behavior-C9.patch new file mode 100644 index 0000000..6b933da --- /dev/null +++ b/recipes-core/busybox/busybox/0001-writing-to-a-const-variable-is-undefined-behavior-C9.patch @@ -0,0 +1,27 @@ +From 64c27d12dab4d5a31103f48773733f17c84b0a77 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 16 Jan 2019 22:39:24 -0800 +Subject: [PATCH] writing to a const variable is undefined behavior (C99 6.7.3 + paragraph 5). + +Signed-off-by: Khem Raj +--- + include/libbb.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/libbb.h b/include/libbb.h +index 3366df30f..6b925eb2d 100644 +--- a/include/libbb.h ++++ b/include/libbb.h +@@ -2092,7 +2092,7 @@ struct globals; + /* '*const' ptr makes gcc optimize code much better. + * Magic prevents ptr_to_globals from going into rodata. + * If you want to assign a value, use SET_PTR_TO_GLOBALS(x) */ +-extern struct globals *const ptr_to_globals; ++extern struct globals *ptr_to_globals; + /* At least gcc 3.4.6 on mipsel system needs optimization barrier */ + #define barrier() __asm__ __volatile__("":::"memory") + #define SET_PTR_TO_GLOBALS(x) do { \ +-- +2.20.1 + diff --git a/recipes-core/busybox/busybox_%.bbappend b/recipes-core/busybox/busybox_%.bbappend index d7b9ca1..7fbb631 100644 --- a/recipes-core/busybox/busybox_%.bbappend +++ b/recipes-core/busybox/busybox_%.bbappend @@ -1 +1,2 @@ -ARM_INSTRUCTION_SET_toolchain-clang = "arm" +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" +SRC_URI_append_toolchain-clang = " file://0001-writing-to-a-const-variable-is-undefined-behavior-C9.patch" -- cgit v1.2.3-54-g00ecf