From: Florian Fainelli <florian@openwrt.org>
To: ralf@linux-mips.org
Cc: linux-mips@linux-mips.org, blogic@openwrt.org, wuzhangjin@gmail.com
Subject: Re: [PATCH] MIPS: decompressor: fix build failure on memcpy() in decompress.c
Date: Tue, 13 Nov 2012 12:25:15 +0100 [thread overview]
Message-ID: <2522606.hXbg5cgH5o@flexo> (raw)
In-Reply-To: <1352720818-9192-1-git-send-email-florian@openwrt.org>
On Monday 12 November 2012 12:46:58 Florian Fainelli wrote:
> The decompress.c file includes linux/kernel.h which causes the following
> inclusion chain to be pulled:
> linux/kernel.h ->
> linux/dynamic_debug.h ->
> linux/string.h ->
> asm/string.h
>
> We end up having a the GCC builtin + architecture specific memcpy() expanding
> into this:
>
> void *({ size_t __len = (size_t n); void *__ret; if
> (__builtin_constant_p(size_t n) && __len >= 64) __ret = memcpy((void *dest),
> (const void *src), __len); else __ret = __builtin_memcpy((void *dest), (const
> void *src), __len); __ret; })
After some more debugging, this expansion "failure" actually comes from one
of our OpenWrt patch which allows the use of GCC builtins for memcpy and
friends. The fix remains valid anyway.
> {
> [memcpy implementation in decompress.c starts here]
> int i;
> const char *s = src;
> char *d = dest;
>
> for (i = 0; i < n; i++)
> d[i] = s[i];
> return dest;
> }
>
> raising the following compilation error:
> arch/mips/boot/compressed/decompress.c:46:8: error: expected identifier or '('
> before '{' token
>
> There are at least three possibilities to fix this issue:
>
> 1) define _LINUX_STRING_H_ at the beginning of decompress.c to prevent
> further linux/string.h definitions and declarations from being used, and add
> an explicit strstr() declaration for linux/dynamic_debug.h
>
> 2) remove the inclusion of linux/kernel.h because we actually use no definition
> or declaration from this header file
>
> 3) undefine memcpy or re-define memcpy to memcpy thus resulting in picking up
> the local memcpy() implementation to this compilation unit
>
> This patch uses the second option which is the less intrusive one.
>
> Signed-off-by: Florian Fainelli <florian@openwrt.org>
> ---
> arch/mips/boot/compressed/decompress.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c
> index 5cad0fa..d6c5586 100644
> --- a/arch/mips/boot/compressed/decompress.c
> +++ b/arch/mips/boot/compressed/decompress.c
> @@ -10,9 +10,7 @@
> * Free Software Foundation; either version 2 of the License, or (at your
> * option) any later version.
> */
> -
> #include <linux/types.h>
> -#include <linux/kernel.h>
>
> #include <asm/addrspace.h>
>
> --
> 1.7.10.4
>
next prev parent reply other threads:[~2012-11-13 11:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-12 11:46 [PATCH] MIPS: decompressor: fix build failure on memcpy() in decompress.c Florian Fainelli
2012-11-13 11:25 ` Florian Fainelli [this message]
2012-11-16 12:30 ` [PATCH v2] MIPS: decompressor: remove unused linux/kernel.h header Florian Fainelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2522606.hXbg5cgH5o@flexo \
--to=florian@openwrt.org \
--cc=blogic@openwrt.org \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
--cc=wuzhangjin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox