Root/target/linux/generic/patches-3.7/062-mips_decompressor_build_fix.patch

1From 0db3db45f5bd6df4bdc03bbd5dec672e16164c4e Mon Sep 17 00:00:00 2001
2From: Florian Fainelli <florian@openwrt.org>
3Date: Mon, 12 Nov 2012 12:31:55 +0100
4Subject: [PATCH] MIPS: decompressor: fix build failure on memcpy() in
5 decompress.c
6
7The decompress.c file includes linux/kernel.h which causes the following
8inclusion chain to be pulled:
9linux/kernel.h ->
10    linux/dynamic_debug.h ->
11        linux/string.h ->
12            asm/string.h
13
14We end up having a the GCC builtin + architecture specific memcpy() expanding
15into this:
16
17void *({ size_t __len = (size_t n); void *__ret; if
18(__builtin_constant_p(size_t n) && __len >= 64) __ret = memcpy((void *dest),
19(const void *src), __len); else __ret = __builtin_memcpy((void *dest), (const
20void *src), __len); __ret; })
21{
22 [memcpy implementation in decompress.c starts here]
23 int i;
24 const char *s = src;
25 char *d = dest;
26
27 for (i = 0; i < n; i++)
28  d[i] = s[i];
29 return dest;
30}
31
32raising the following compilation error:
33arch/mips/boot/compressed/decompress.c:46:8: error: expected identifier or '('
34before '{' token
35
36There are at least three possibilities to fix this issue:
37
381) define _LINUX_STRING_H_ at the beginning of decompress.c to prevent
39   further linux/string.h definitions and declarations from being used, and add
40   an explicit strstr() declaration for linux/dynamic_debug.h
41
422) remove the inclusion of linux/kernel.h because we actually use no definition
43   or declaration from this header file
44
453) undefine memcpy or re-define memcpy to memcpy thus resulting in picking up
46   the local memcpy() implementation to this compilation unit
47
48This patch uses the second option which is the less intrusive one.
49
50Signed-off-by: Florian Fainelli <florian@openwrt.org>
51---
52 arch/mips/boot/compressed/decompress.c | 2 --
53 1 file changed, 2 deletions(-)
54
55--- a/arch/mips/boot/compressed/decompress.c
56+++ b/arch/mips/boot/compressed/decompress.c
57@@ -10,9 +10,7 @@
58  * Free Software Foundation; either version 2 of the License, or (at your
59  * option) any later version.
60  */
61-
62 #include <linux/types.h>
63-#include <linux/kernel.h>
64 
65 #include <asm/addrspace.h>
66 
67

Archive Download this file



interactive