summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2019-01-16 22:51:58 -0800
committerKhem Raj <raj.khem@gmail.com>2019-01-18 09:32:32 -0800
commite94a7cc34912faeab063324371595c8b78525297 (patch)
tree2d794d2471db9433660a12e9df0c6a4cee13a706
parent7605528104c318d80afa96e321f035ef8e022785 (diff)
downloadmeta-clang-kraj/clang-8.tar.gz
busybox: Fix UB due to modifying const pointerkraj/clang-8
see https://bugs.llvm.org/show_bug.cgi?id=39919 Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--recipes-core/busybox/busybox/0001-writing-to-a-const-variable-is-undefined-behavior-C9.patch27
-rw-r--r--recipes-core/busybox/busybox_%.bbappend3
2 files changed, 29 insertions, 1 deletions
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 @@
1From 64c27d12dab4d5a31103f48773733f17c84b0a77 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 16 Jan 2019 22:39:24 -0800
4Subject: [PATCH] writing to a const variable is undefined behavior (C99 6.7.3
5 paragraph 5).
6
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 include/libbb.h | 2 +-
10 1 file changed, 1 insertion(+), 1 deletion(-)
11
12diff --git a/include/libbb.h b/include/libbb.h
13index 3366df30f..6b925eb2d 100644
14--- a/include/libbb.h
15+++ b/include/libbb.h
16@@ -2092,7 +2092,7 @@ struct globals;
17 /* '*const' ptr makes gcc optimize code much better.
18 * Magic prevents ptr_to_globals from going into rodata.
19 * If you want to assign a value, use SET_PTR_TO_GLOBALS(x) */
20-extern struct globals *const ptr_to_globals;
21+extern struct globals *ptr_to_globals;
22 /* At least gcc 3.4.6 on mipsel system needs optimization barrier */
23 #define barrier() __asm__ __volatile__("":::"memory")
24 #define SET_PTR_TO_GLOBALS(x) do { \
25--
262.20.1
27
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 @@
1ARM_INSTRUCTION_SET_toolchain-clang = "arm" 1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2SRC_URI_append_toolchain-clang = " file://0001-writing-to-a-const-variable-is-undefined-behavior-C9.patch"