From: Wang Nan <wangnan0@huawei.com>
To: Wang Nan <wangnan0@huawei.com>, kumagai-atsushi@mxc.nes.nec.co.jp
Cc: kexec@lists.infradead.org, Geng Hui <hui.geng@huawei.com>
Subject: Re: [PATCH] makedumpfile: inhibit predefined macros when cross building
Date: Tue, 1 Apr 2014 12:39:09 +0800 [thread overview]
Message-ID: <533A42ED.3070604@huawei.com> (raw)
In-Reply-To: <1396326520-42618-1-git-send-email-wangnan0@huawei.com>
On 2014/4/1 12:28, Wang Nan wrote:
> When cross building makedumpfile, for example, build x86_64 exec for
> dealing with arm vmcore, makefile passes a "-D__arm__" to gcc, but gcc
> predefined macros still take effect, defines "__x86_64__". Which makes
> definitions for x86_64 and arm mixed together in makedumpfile.h, causes
> many problems.
>
> This patch changes Makefile: if host arch and target arch are different,
> passes "-U__$(HOST_ARCH)__" to gcc.
>
> I have tested by running following command on x86_64 machine:
>
> make ARCH=arm
Sorry, should be TARGET=arm. I have tested and build okay.
>
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> Cc: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
> Cc: kexec@lists.infradead.org
> Cc: Geng Hui <hui.geng@huawei.com>
> ---
> Makefile | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 2f4845c..f85cc21 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -15,10 +15,11 @@ CFLAGS_ARCH = -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
> -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
> # LDFLAGS = -L/usr/local/lib -I/usr/local/include
>
> +HOST_ARCH := $(shell uname -m)
> # Use TARGET as the target architecture if specified.
> # Defaults to uname -m
> ifeq ($(strip($TARGET)),)
> -TARGET := $(shell uname -m)
> +TARGET := $(HOST_ARCH)
> endif
>
> ARCH := $(shell echo ${TARGET} | sed -e s/i.86/x86/ -e s/sun4u/sparc64/ \
> @@ -26,8 +27,13 @@ ARCH := $(shell echo ${TARGET} | sed -e s/i.86/x86/ -e s/sun4u/sparc64/ \
> -e s/s390x/s390/ -e s/parisc64/parisc/ \
> -e s/ppc64/powerpc64/ -e s/ppc/powerpc32/)
>
> -CFLAGS += -D__$(ARCH)__
> -CFLAGS_ARCH += -D__$(ARCH)__
> +CROSS :=
> +ifneq ($(TARGET), $(HOST_ARCH))
> +CROSS := -U__$(HOST_ARCH)__
> +endif
> +
> +CFLAGS += -D__$(ARCH)__ $(CROSS)
> +CFLAGS_ARCH += -D__$(ARCH)__ $(CROSS)
>
> ifeq ($(ARCH), powerpc64)
> CFLAGS += -m64
>
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2014-04-01 4:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-01 4:28 [PATCH] makedumpfile: inhibit predefined macros when cross building Wang Nan
2014-04-01 4:39 ` Wang Nan [this message]
2014-04-04 3:59 ` Atsushi Kumagai
2014-04-04 5:48 ` Wang Nan
2014-04-04 8:32 ` Atsushi Kumagai
2014-04-04 9:00 ` Wang Nan
2014-04-08 2:30 ` Atsushi Kumagai
2014-04-08 7:42 ` Wang Nan
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=533A42ED.3070604@huawei.com \
--to=wangnan0@huawei.com \
--cc=hui.geng@huawei.com \
--cc=kexec@lists.infradead.org \
--cc=kumagai-atsushi@mxc.nes.nec.co.jp \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.