Subject: [PATCH -perf/perf/makefile 0/2] Perf bugfixes for cross-builds

Hi,

Here are some bugfixes related to cross builds.
- Introduce ARCH=XX for cross-builds instead of obsolate
EXTRA_CFLAGS=-mXX option.
- Rename obsolate NO_PERL to NO_LIBPERL

Still not sure how I can do cross-builds i386 binary with
perl/python support on x86-64. Anyway, now we can do without
that as below;

$ make ARCH=i386 NO_LIBPERL=1 NO_LIBPYTHON=1

Thank you,

---

Masami Hiramatsu (2):
perf tools: Rename old NO_PERL option to NO_LIBPERL
perf tools: Introduce ARCH= option for cross building


tools/perf/Makefile | 48 +++++++++++++++++++++++++-------------
tools/perf/arch/arm/Makefile | 2 +-
tools/perf/arch/powerpc/Makefile | 2 +-
tools/perf/arch/s390/Makefile | 2 +-
tools/perf/arch/sh/Makefile | 2 +-
tools/perf/arch/sparc/Makefile | 2 +-
tools/perf/arch/x86/Makefile | 2 +-
7 files changed, 38 insertions(+), 22 deletions(-)

--
Masami HIRAMATSU
2nd Dept. Linux Technology Center
Hitachi, Ltd., Systems Development Laboratory
E-mail: [email protected]


Subject: [PATCH -perf/perf/makefile 2/2] perf tools: Rename old NO_PERL option to NO_LIBPERL

Since the valid option is NO_LIBPERL, NO_PERL should be
relpaced with NO_LIBPERL.

Signed-off-by: Masami Hiramatsu <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: [email protected]
---

tools/perf/Makefile | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index f7e8a41..aea0c93 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -34,7 +34,7 @@ endif
#
# Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72.
#
-# Define NO_PERL if you do not want Perl scripts or libraries at all.
+# Define NO_LIBPERL if you do not want Perl scripts or libraries at all.
#
# Define LDFLAGS=-static to build a static binary.
#
@@ -600,7 +600,7 @@ ifndef CC_LD_DYNPATH
endif

ifeq ($(PERL_PATH),)
-NO_PERL=NoThanks
+NO_LIBPERL=NoThanks
endif

ifneq ($(findstring $(MAKEFLAGS),s),s)
@@ -813,7 +813,7 @@ $(OUTPUT)PERF-CFLAGS: .FORCE-PERF-CFLAGS
# and the first level quoting from the shell that runs "echo".
$(OUTPUT)PERF-BUILD-OPTIONS: .FORCE-PERF-BUILD-OPTIONS
@echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@
- @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@
+ @echo NO_LIBPERL=\''$(subst ','\'',$(subst ','\'',$(NO_LIBPERL)))'\' >>$@

### Testing rules

Subject: [PATCH -perf/perf/makefile 1/2] perf tools: Introduce ARCH= option for cross building

Introduce ARCH= option for cross building.
This also ports some ARCH setting code from linux-2.6/Makefile.

Since EXTRA_CFLAGS=-m64/32 does not change some build flags,
we need an appropriate flag for cross building.
e.g., If you want to build x86-32 binary on x86-64, just set
ARCH=i386 for building.

Signed-off-by: Masami Hiramatsu <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: [email protected]
---

tools/perf/Makefile | 42 ++++++++++++++++++++++++++------------
tools/perf/arch/arm/Makefile | 2 +-
tools/perf/arch/powerpc/Makefile | 2 +-
tools/perf/arch/s390/Makefile | 2 +-
tools/perf/arch/sh/Makefile | 2 +-
tools/perf/arch/sparc/Makefile | 2 +-
tools/perf/arch/x86/Makefile | 2 +-
7 files changed, 35 insertions(+), 19 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index b8ba5b0..f7e8a41 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -38,7 +38,7 @@ endif
#
# Define LDFLAGS=-static to build a static binary.
#
-# Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds.
+# Define ARCH=x86_64 or ARCH=i386 as appropriate for cross-builds.
#
# Define NO_DWARF if you do not want debug-info analysis feature at all.

@@ -53,21 +53,37 @@ uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')

-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
- -e s/arm.*/arm/ -e s/sa110/arm/ \
- -e s/s390x/s390/ -e s/parisc64/parisc/ \
- -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
- -e s/sh[234].*/sh/ )
+SUBARCH := $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
+ -e s/arm.*/arm/ -e s/sa110/arm/ \
+ -e s/s390x/s390/ -e s/parisc64/parisc/ \
+ -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
+ -e s/sh[234].*/sh/ )
+ARCH ?= $(SUBARCH)
+SRCARCH := $(ARCH)

# Additional ARCH settings for x86
ifeq ($(ARCH),i386)
- ARCH := x86
+ SRCARCH := x86
+ EXTRA_CFLAGS=-m32
endif
ifeq ($(ARCH),x86_64)
- RAW_ARCH := x86_64
- ARCH := x86
+ SRCARCH := x86
ARCH_CFLAGS := -DARCH_X86_64
ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S
+ EXTRA_CFLAGS=-m64
+endif
+
+# Additional ARCH settings for sparc
+ifeq ($(ARCH),sparc32)
+ SRCARCH := sparc
+endif
+ifeq ($(ARCH),sparc64)
+ SRCARCH := sparc
+endif
+
+# Additional ARCH settings for sh
+ifeq ($(ARCH),sh64)
+ SRCARCH := sh
endif

#
@@ -179,7 +195,7 @@ endif
# Those must not be GNU-specific; they are shared with perl/ which may
# be built by a different compiler. (Note that this is an artifact now
# but it still might be nice to keep that distinction.)
-BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include
+BASIC_CFLAGS = -Iutil/include -Iarch/$(SRCARCH)/include
BASIC_LDFLAGS =

# Guard against environment variables
@@ -370,7 +386,7 @@ BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
# Benchmark modules
BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o
BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o
-ifeq ($(RAW_ARCH),x86_64)
+ifeq ($(ARCH),x86_64)
BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
endif
BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o
@@ -429,7 +445,7 @@ ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF)),y)
endif # Dwarf support
endif # NO_DWARF

--include arch/$(ARCH)/Makefile
+-include arch/$(SRCARCH)/Makefile

ifneq ($(OUTPUT),)
BASIC_CFLAGS += -I$(OUTPUT)
@@ -451,7 +467,7 @@ endif

ifndef NO_DWARF
ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
- msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
+ msg := $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled);
else
BASIC_CFLAGS += -DDWARF_SUPPORT
EXTLIBS += -lelf -ldw
diff --git a/tools/perf/arch/arm/Makefile b/tools/perf/arch/arm/Makefile
index 15130b5..571affa 100644
--- a/tools/perf/arch/arm/Makefile
+++ b/tools/perf/arch/arm/Makefile
@@ -1,4 +1,4 @@
ifndef NO_DWARF
PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
+LIB_OBJS += $(OUTPUT)arch/$(SRCARCH)/util/dwarf-regs.o
endif
diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Makefile
index 15130b5..571affa 100644
--- a/tools/perf/arch/powerpc/Makefile
+++ b/tools/perf/arch/powerpc/Makefile
@@ -1,4 +1,4 @@
ifndef NO_DWARF
PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
+LIB_OBJS += $(OUTPUT)arch/$(SRCARCH)/util/dwarf-regs.o
endif
diff --git a/tools/perf/arch/s390/Makefile b/tools/perf/arch/s390/Makefile
index 15130b5..571affa 100644
--- a/tools/perf/arch/s390/Makefile
+++ b/tools/perf/arch/s390/Makefile
@@ -1,4 +1,4 @@
ifndef NO_DWARF
PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
+LIB_OBJS += $(OUTPUT)arch/$(SRCARCH)/util/dwarf-regs.o
endif
diff --git a/tools/perf/arch/sh/Makefile b/tools/perf/arch/sh/Makefile
index 15130b5..571affa 100644
--- a/tools/perf/arch/sh/Makefile
+++ b/tools/perf/arch/sh/Makefile
@@ -1,4 +1,4 @@
ifndef NO_DWARF
PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
+LIB_OBJS += $(OUTPUT)arch/$(SRCARCH)/util/dwarf-regs.o
endif
diff --git a/tools/perf/arch/sparc/Makefile b/tools/perf/arch/sparc/Makefile
index 15130b5..571affa 100644
--- a/tools/perf/arch/sparc/Makefile
+++ b/tools/perf/arch/sparc/Makefile
@@ -1,4 +1,4 @@
ifndef NO_DWARF
PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
+LIB_OBJS += $(OUTPUT)arch/$(SRCARCH)/util/dwarf-regs.o
endif
diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
index 15130b5..571affa 100644
--- a/tools/perf/arch/x86/Makefile
+++ b/tools/perf/arch/x86/Makefile
@@ -1,4 +1,4 @@
ifndef NO_DWARF
PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
+LIB_OBJS += $(OUTPUT)arch/$(SRCARCH)/util/dwarf-regs.o
endif

Subject: Re: [PATCH -perf/perf/makefile 0/2] Perf bugfixes for cross-builds

Hi Arnaldo,

BTW, could you pull these patches for cross building?

(2011/02/10 11:28), Masami Hiramatsu wrote:
> Hi,
>
> Here are some bugfixes related to cross builds.
> - Introduce ARCH=XX for cross-builds instead of obsolate
> EXTRA_CFLAGS=-mXX option.
> - Rename obsolate NO_PERL to NO_LIBPERL
>
> Still not sure how I can do cross-builds i386 binary with
> perl/python support on x86-64. Anyway, now we can do without
> that as below;
>
> $ make ARCH=i386 NO_LIBPERL=1 NO_LIBPYTHON=1
>
> Thank you,
>
> ---
>
> Masami Hiramatsu (2):
> perf tools: Rename old NO_PERL option to NO_LIBPERL
> perf tools: Introduce ARCH= option for cross building
>
>
> tools/perf/Makefile | 48 +++++++++++++++++++++++++-------------
> tools/perf/arch/arm/Makefile | 2 +-
> tools/perf/arch/powerpc/Makefile | 2 +-
> tools/perf/arch/s390/Makefile | 2 +-
> tools/perf/arch/sh/Makefile | 2 +-
> tools/perf/arch/sparc/Makefile | 2 +-
> tools/perf/arch/x86/Makefile | 2 +-
> 7 files changed, 38 insertions(+), 22 deletions(-)
>


--
Masami HIRAMATSU
2nd Dept. Linux Technology Center
Hitachi, Ltd., Systems Development Laboratory
E-mail: [email protected]

2011-02-22 12:11:49

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH -perf/perf/makefile 0/2] Perf bugfixes for cross-builds

Em Tue, Feb 22, 2011 at 09:04:18PM +0900, Masami Hiramatsu escreveu:
> Hi Arnaldo,
>
> BTW, could you pull these patches for cross building?

I'll try again to use this new feature, sorry for not sending feedback,
but I failed to use it on a RHEL6 system, have to try again and provide
proper feedback.

> (2011/02/10 11:28), Masami Hiramatsu wrote:
> > Hi,
> >
> > Here are some bugfixes related to cross builds.
> > - Introduce ARCH=XX for cross-builds instead of obsolate
> > EXTRA_CFLAGS=-mXX option.
> > - Rename obsolate NO_PERL to NO_LIBPERL
> >
> > Still not sure how I can do cross-builds i386 binary with
> > perl/python support on x86-64. Anyway, now we can do without
> > that as below;
> >
> > $ make ARCH=i386 NO_LIBPERL=1 NO_LIBPYTHON=1
> >
> > Thank you,
> >
> > ---
> >
> > Masami Hiramatsu (2):
> > perf tools: Rename old NO_PERL option to NO_LIBPERL
> > perf tools: Introduce ARCH= option for cross building
> >
> >
> > tools/perf/Makefile | 48 +++++++++++++++++++++++++-------------
> > tools/perf/arch/arm/Makefile | 2 +-
> > tools/perf/arch/powerpc/Makefile | 2 +-
> > tools/perf/arch/s390/Makefile | 2 +-
> > tools/perf/arch/sh/Makefile | 2 +-
> > tools/perf/arch/sparc/Makefile | 2 +-
> > tools/perf/arch/x86/Makefile | 2 +-
> > 7 files changed, 38 insertions(+), 22 deletions(-)
> >
>
>
> --
> Masami HIRAMATSU
> 2nd Dept. Linux Technology Center
> Hitachi, Ltd., Systems Development Laboratory
> E-mail: [email protected]

Subject: Re: [PATCH -perf/perf/makefile 0/2] Perf bugfixes for cross-builds

(2011/02/22 21:11), Arnaldo Carvalho de Melo wrote:
> Em Tue, Feb 22, 2011 at 09:04:18PM +0900, Masami Hiramatsu escreveu:
>> Hi Arnaldo,
>>
>> BTW, could you pull these patches for cross building?
>
> I'll try again to use this new feature, sorry for not sending feedback,
> but I failed to use it on a RHEL6 system, have to try again and provide
> proper feedback.

Hmm, would you install some devel packages for i686 too?
This change requires 32bits devel packages for cross building.

Thank you,

>
>> (2011/02/10 11:28), Masami Hiramatsu wrote:
>>> Hi,
>>>
>>> Here are some bugfixes related to cross builds.
>>> - Introduce ARCH=XX for cross-builds instead of obsolate
>>> EXTRA_CFLAGS=-mXX option.
>>> - Rename obsolate NO_PERL to NO_LIBPERL
>>>
>>> Still not sure how I can do cross-builds i386 binary with
>>> perl/python support on x86-64. Anyway, now we can do without
>>> that as below;
>>>
>>> $ make ARCH=i386 NO_LIBPERL=1 NO_LIBPYTHON=1
>>>
>>> Thank you,
>>>
>>> ---
>>>
>>> Masami Hiramatsu (2):
>>> perf tools: Rename old NO_PERL option to NO_LIBPERL
>>> perf tools: Introduce ARCH= option for cross building
>>>
>>>
>>> tools/perf/Makefile | 48 +++++++++++++++++++++++++-------------
>>> tools/perf/arch/arm/Makefile | 2 +-
>>> tools/perf/arch/powerpc/Makefile | 2 +-
>>> tools/perf/arch/s390/Makefile | 2 +-
>>> tools/perf/arch/sh/Makefile | 2 +-
>>> tools/perf/arch/sparc/Makefile | 2 +-
>>> tools/perf/arch/x86/Makefile | 2 +-
>>> 7 files changed, 38 insertions(+), 22 deletions(-)
>>>
>>
>>
>> --
>> Masami HIRAMATSU
>> 2nd Dept. Linux Technology Center
>> Hitachi, Ltd., Systems Development Laboratory
>> E-mail: [email protected]


--
Masami HIRAMATSU
2nd Dept. Linux Technology Center
Hitachi, Ltd., Systems Development Laboratory
E-mail: [email protected]

2011-02-27 10:28:00

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH -perf/perf/makefile 0/2] Perf bugfixes for cross-builds

Em Sun, Feb 27, 2011 at 06:43:55PM +0900, Masami Hiramatsu escreveu:
> (2011/02/22 21:11), Arnaldo Carvalho de Melo wrote:
> > Em Tue, Feb 22, 2011 at 09:04:18PM +0900, Masami Hiramatsu escreveu:
> >> Hi Arnaldo,
> >>
> >> BTW, could you pull these patches for cross building?
> >
> > I'll try again to use this new feature, sorry for not sending feedback,
> > but I failed to use it on a RHEL6 system, have to try again and provide
> > proper feedback.
>
> Hmm, would you install some devel packages for i686 too?
> This change requires 32bits devel packages for cross building.

Yeah, I did it, perhaps some was missing, as I said, have to try it
again.

> Thank you,
>
> >
> >> (2011/02/10 11:28), Masami Hiramatsu wrote:
> >>> Hi,
> >>>
> >>> Here are some bugfixes related to cross builds.
> >>> - Introduce ARCH=XX for cross-builds instead of obsolate
> >>> EXTRA_CFLAGS=-mXX option.
> >>> - Rename obsolate NO_PERL to NO_LIBPERL
> >>>
> >>> Still not sure how I can do cross-builds i386 binary with
> >>> perl/python support on x86-64. Anyway, now we can do without
> >>> that as below;
> >>>
> >>> $ make ARCH=i386 NO_LIBPERL=1 NO_LIBPYTHON=1
> >>>
> >>> Thank you,
> >>>
> >>> ---
> >>>
> >>> Masami Hiramatsu (2):
> >>> perf tools: Rename old NO_PERL option to NO_LIBPERL
> >>> perf tools: Introduce ARCH= option for cross building
> >>>
> >>>
> >>> tools/perf/Makefile | 48 +++++++++++++++++++++++++-------------
> >>> tools/perf/arch/arm/Makefile | 2 +-
> >>> tools/perf/arch/powerpc/Makefile | 2 +-
> >>> tools/perf/arch/s390/Makefile | 2 +-
> >>> tools/perf/arch/sh/Makefile | 2 +-
> >>> tools/perf/arch/sparc/Makefile | 2 +-
> >>> tools/perf/arch/x86/Makefile | 2 +-
> >>> 7 files changed, 38 insertions(+), 22 deletions(-)
> >>>
> >>
> >>
> >> --
> >> Masami HIRAMATSU
> >> 2nd Dept. Linux Technology Center
> >> Hitachi, Ltd., Systems Development Laboratory
> >> E-mail: [email protected]
>
>
> --
> Masami HIRAMATSU
> 2nd Dept. Linux Technology Center
> Hitachi, Ltd., Systems Development Laboratory
> E-mail: [email protected]