All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf: fix building error in x86_64 when dwarf unwind is on
@ 2014-12-27  1:26 Wang Nan
  2014-12-29  7:56 ` Namhyung Kim
  0 siblings, 1 reply; 17+ messages in thread
From: Wang Nan @ 2014-12-27  1:26 UTC (permalink / raw)
  To: namhyung, mingo; +Cc: linux-kernel, lizefan

When build with 'make ARCH=x86' and dwarf unwind is on, there is a
compiling error:

   CC       /home/wn/perf/arch/x86/util/unwind-libdw.o
   CC       /home/wn/perf/arch/x86/tests/regs_load.o
 arch/x86/tests/regs_load.S: Assembler messages:
 arch/x86/tests/regs_load.S:65: Error: operand type mismatch for `push'
 arch/x86/tests/regs_load.S:72: Error: operand type mismatch for `pop'
 make[1]: *** [/home/wn/perf/arch/x86/tests/regs_load.o] Error 1
 make[1]: INTERNAL: Exiting with 25 jobserver tokens available; should be 24!
 make: *** [all] Error 2
 ...

Which is caused by incorrectly undefine macro HAVE_ARCH_X86_64_SUPPORT.
'config/Makefile.arch' tests __x86_64__ only when 'ARCH=x86_64'. However,
with 'ARCH=x86', the underlying compile may also be x86_64, which causes
mismatching.

This patch fixes it by checking __x86_64__ in both case of
'ARCH=x86_64' and 'ARCH=x86'.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
---
 tools/perf/config/Makefile.arch | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/config/Makefile.arch b/tools/perf/config/Makefile.arch
index 851cd01..303a096 100644
--- a/tools/perf/config/Makefile.arch
+++ b/tools/perf/config/Makefile.arch
@@ -15,6 +15,8 @@ endif
 
 ifeq ($(ARCH),x86_64)
   override ARCH := x86
+endif
+ifeq ($(ARCH),x86)
   IS_X86_64 := 0
   ifeq (, $(findstring m32,$(CFLAGS)))
     IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | tail -n 1)
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH] perf: fix building error in x86_64 when dwarf unwind is on
  2014-12-27  1:26 [PATCH] perf: fix building error in x86_64 when dwarf unwind is on Wang Nan
@ 2014-12-29  7:56 ` Namhyung Kim
  2014-12-29  8:14   ` Wang Nan
  0 siblings, 1 reply; 17+ messages in thread
From: Namhyung Kim @ 2014-12-29  7:56 UTC (permalink / raw)
  To: Wang Nan; +Cc: mingo, linux-kernel, lizefan, acme, jolsa

Hi Wang,

(Adding Arnaldo and Jiri to CC)

On Sat, Dec 27, 2014 at 09:26:11AM +0800, Wang Nan wrote:
> When build with 'make ARCH=x86' and dwarf unwind is on, there is a
> compiling error:
> 
>    CC       /home/wn/perf/arch/x86/util/unwind-libdw.o
>    CC       /home/wn/perf/arch/x86/tests/regs_load.o
>  arch/x86/tests/regs_load.S: Assembler messages:
>  arch/x86/tests/regs_load.S:65: Error: operand type mismatch for `push'
>  arch/x86/tests/regs_load.S:72: Error: operand type mismatch for `pop'
>  make[1]: *** [/home/wn/perf/arch/x86/tests/regs_load.o] Error 1
>  make[1]: INTERNAL: Exiting with 25 jobserver tokens available; should be 24!
>  make: *** [all] Error 2
>  ...
> 
> Which is caused by incorrectly undefine macro HAVE_ARCH_X86_64_SUPPORT.
> 'config/Makefile.arch' tests __x86_64__ only when 'ARCH=x86_64'. However,
> with 'ARCH=x86', the underlying compile may also be x86_64, which causes
> mismatching.

Hmm.. how did you compile this?  I guess ARCH=x86 requires -m32 flag
to the gcc, did you pass it (like via EXTRA_CFLAGS=-m32)?

I'm confused by 'underlying compile may also be x86_64' part..

Thanks,
Namhyung


> 
> This patch fixes it by checking __x86_64__ in both case of
> 'ARCH=x86_64' and 'ARCH=x86'.
> 
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> ---
>  tools/perf/config/Makefile.arch | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/perf/config/Makefile.arch b/tools/perf/config/Makefile.arch
> index 851cd01..303a096 100644
> --- a/tools/perf/config/Makefile.arch
> +++ b/tools/perf/config/Makefile.arch
> @@ -15,6 +15,8 @@ endif
>  
>  ifeq ($(ARCH),x86_64)
>    override ARCH := x86
> +endif
> +ifeq ($(ARCH),x86)
>    IS_X86_64 := 0
>    ifeq (, $(findstring m32,$(CFLAGS)))
>      IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | tail -n 1)
> -- 
> 1.8.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] perf: fix building error in x86_64 when dwarf unwind is on
  2014-12-29  7:56 ` Namhyung Kim
@ 2014-12-29  8:14   ` Wang Nan
  2015-01-07  2:53     ` Wang Nan
  0 siblings, 1 reply; 17+ messages in thread
From: Wang Nan @ 2014-12-29  8:14 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: mingo, linux-kernel, lizefan, acme, jolsa

On 2014/12/29 15:56, Namhyung Kim wrote:
> Hi Wang,
> 
> (Adding Arnaldo and Jiri to CC)
> 
> On Sat, Dec 27, 2014 at 09:26:11AM +0800, Wang Nan wrote:
>> When build with 'make ARCH=x86' and dwarf unwind is on, there is a
>> compiling error:
>>
>>    CC       /home/wn/perf/arch/x86/util/unwind-libdw.o
>>    CC       /home/wn/perf/arch/x86/tests/regs_load.o
>>  arch/x86/tests/regs_load.S: Assembler messages:
>>  arch/x86/tests/regs_load.S:65: Error: operand type mismatch for `push'
>>  arch/x86/tests/regs_load.S:72: Error: operand type mismatch for `pop'
>>  make[1]: *** [/home/wn/perf/arch/x86/tests/regs_load.o] Error 1
>>  make[1]: INTERNAL: Exiting with 25 jobserver tokens available; should be 24!
>>  make: *** [all] Error 2
>>  ...
>>
>> Which is caused by incorrectly undefine macro HAVE_ARCH_X86_64_SUPPORT.
>> 'config/Makefile.arch' tests __x86_64__ only when 'ARCH=x86_64'. However,
>> with 'ARCH=x86', the underlying compile may also be x86_64, which causes
>> mismatching.
> 
> Hmm.. how did you compile this?  I guess ARCH=x86 requires -m32 flag
> to the gcc, did you pass it (like via EXTRA_CFLAGS=-m32)?
> 
> I'm confused by 'underlying compile may also be x86_64' part..
> 

I hit this problem when building perf with Yocto (https://www.yoctoproject.org/), which
is a famous building system for embeded system.

When building kernel, we can simply use 'make ARCH=x86' and select 'CONFIG_64BIT'
in menuconfig to get a x86_64 kernel. As a result, there building framework
like Yocto doesn't ever consider 'x86_64' as a valid ARCH option. See:
https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/classes/kernel-arch.bbclass
Therefore, when building with such framework, it uses a x86_64 compiler and ARCH=x86.

> Thanks,
> Namhyung
> 
> 
>>
>> This patch fixes it by checking __x86_64__ in both case of
>> 'ARCH=x86_64' and 'ARCH=x86'.
>>
>> Signed-off-by: Wang Nan <wangnan0@huawei.com>
>> ---
>>  tools/perf/config/Makefile.arch | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/tools/perf/config/Makefile.arch b/tools/perf/config/Makefile.arch
>> index 851cd01..303a096 100644
>> --- a/tools/perf/config/Makefile.arch
>> +++ b/tools/perf/config/Makefile.arch
>> @@ -15,6 +15,8 @@ endif
>>  
>>  ifeq ($(ARCH),x86_64)
>>    override ARCH := x86
>> +endif
>> +ifeq ($(ARCH),x86)
>>    IS_X86_64 := 0
>>    ifeq (, $(findstring m32,$(CFLAGS)))
>>      IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | tail -n 1)
>> -- 
>> 1.8.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at  http://www.tux.org/lkml/



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] perf: fix building error in x86_64 when dwarf unwind is on
  2014-12-29  8:14   ` Wang Nan
@ 2015-01-07  2:53     ` Wang Nan
  2015-01-07  5:40       ` Namhyung Kim
  0 siblings, 1 reply; 17+ messages in thread
From: Wang Nan @ 2015-01-07  2:53 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: mingo, linux-kernel, lizefan, acme, jolsa

Ping...

On 2014/12/29 16:14, Wang Nan wrote:
> On 2014/12/29 15:56, Namhyung Kim wrote:
>> Hi Wang,
>>
>> (Adding Arnaldo and Jiri to CC)
>>
>> On Sat, Dec 27, 2014 at 09:26:11AM +0800, Wang Nan wrote:
>>> When build with 'make ARCH=x86' and dwarf unwind is on, there is a
>>> compiling error:
>>>
>>>    CC       /home/wn/perf/arch/x86/util/unwind-libdw.o
>>>    CC       /home/wn/perf/arch/x86/tests/regs_load.o
>>>  arch/x86/tests/regs_load.S: Assembler messages:
>>>  arch/x86/tests/regs_load.S:65: Error: operand type mismatch for `push'
>>>  arch/x86/tests/regs_load.S:72: Error: operand type mismatch for `pop'
>>>  make[1]: *** [/home/wn/perf/arch/x86/tests/regs_load.o] Error 1
>>>  make[1]: INTERNAL: Exiting with 25 jobserver tokens available; should be 24!
>>>  make: *** [all] Error 2
>>>  ...
>>>
>>> Which is caused by incorrectly undefine macro HAVE_ARCH_X86_64_SUPPORT.
>>> 'config/Makefile.arch' tests __x86_64__ only when 'ARCH=x86_64'. However,
>>> with 'ARCH=x86', the underlying compile may also be x86_64, which causes
>>> mismatching.
>>
>> Hmm.. how did you compile this?  I guess ARCH=x86 requires -m32 flag
>> to the gcc, did you pass it (like via EXTRA_CFLAGS=-m32)?
>>
>> I'm confused by 'underlying compile may also be x86_64' part..
>>
> 
> I hit this problem when building perf with Yocto (https://www.yoctoproject.org/), which
> is a famous building system for embeded system.
> 
> When building kernel, we can simply use 'make ARCH=x86' and select 'CONFIG_64BIT'
> in menuconfig to get a x86_64 kernel. As a result, there building framework
> like Yocto doesn't ever consider 'x86_64' as a valid ARCH option. See:
> https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/classes/kernel-arch.bbclass
> Therefore, when building with such framework, it uses a x86_64 compiler and ARCH=x86.
> 
>> Thanks,
>> Namhyung
>>
>>
>>>
>>> This patch fixes it by checking __x86_64__ in both case of
>>> 'ARCH=x86_64' and 'ARCH=x86'.
>>>
>>> Signed-off-by: Wang Nan <wangnan0@huawei.com>
>>> ---
>>>  tools/perf/config/Makefile.arch | 2 ++
>>>  1 file changed, 2 insertions(+)
>>>
>>> diff --git a/tools/perf/config/Makefile.arch b/tools/perf/config/Makefile.arch
>>> index 851cd01..303a096 100644
>>> --- a/tools/perf/config/Makefile.arch
>>> +++ b/tools/perf/config/Makefile.arch
>>> @@ -15,6 +15,8 @@ endif
>>>  
>>>  ifeq ($(ARCH),x86_64)
>>>    override ARCH := x86
>>> +endif
>>> +ifeq ($(ARCH),x86)
>>>    IS_X86_64 := 0
>>>    ifeq (, $(findstring m32,$(CFLAGS)))
>>>      IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | tail -n 1)
>>> -- 
>>> 1.8.4
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>> Please read the FAQ at  http://www.tux.org/lkml/
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] perf: fix building error in x86_64 when dwarf unwind is on
  2015-01-07  2:53     ` Wang Nan
@ 2015-01-07  5:40       ` Namhyung Kim
  2015-01-07  8:39         ` Jiri Olsa
  0 siblings, 1 reply; 17+ messages in thread
From: Namhyung Kim @ 2015-01-07  5:40 UTC (permalink / raw)
  To: Wang Nan; +Cc: mingo, linux-kernel, lizefan, acme, jolsa

Hi,

On Wed, Jan 07, 2015 at 10:53:52AM +0800, Wang Nan wrote:
> Ping...

Sorry for long delay.

> 
> On 2014/12/29 16:14, Wang Nan wrote:
> > On 2014/12/29 15:56, Namhyung Kim wrote:
> >> Hi Wang,
> >>
> >> (Adding Arnaldo and Jiri to CC)
> >>
> >> On Sat, Dec 27, 2014 at 09:26:11AM +0800, Wang Nan wrote:
> >>> When build with 'make ARCH=x86' and dwarf unwind is on, there is a
> >>> compiling error:
> >>>
> >>>    CC       /home/wn/perf/arch/x86/util/unwind-libdw.o
> >>>    CC       /home/wn/perf/arch/x86/tests/regs_load.o
> >>>  arch/x86/tests/regs_load.S: Assembler messages:
> >>>  arch/x86/tests/regs_load.S:65: Error: operand type mismatch for `push'
> >>>  arch/x86/tests/regs_load.S:72: Error: operand type mismatch for `pop'
> >>>  make[1]: *** [/home/wn/perf/arch/x86/tests/regs_load.o] Error 1
> >>>  make[1]: INTERNAL: Exiting with 25 jobserver tokens available; should be 24!
> >>>  make: *** [all] Error 2
> >>>  ...
> >>>
> >>> Which is caused by incorrectly undefine macro HAVE_ARCH_X86_64_SUPPORT.
> >>> 'config/Makefile.arch' tests __x86_64__ only when 'ARCH=x86_64'. However,
> >>> with 'ARCH=x86', the underlying compile may also be x86_64, which causes
> >>> mismatching.
> >>
> >> Hmm.. how did you compile this?  I guess ARCH=x86 requires -m32 flag
> >> to the gcc, did you pass it (like via EXTRA_CFLAGS=-m32)?
> >>
> >> I'm confused by 'underlying compile may also be x86_64' part..
> >>
> > 
> > I hit this problem when building perf with Yocto (https://www.yoctoproject.org/), which
> > is a famous building system for embeded system.
> > 
> > When building kernel, we can simply use 'make ARCH=x86' and select 'CONFIG_64BIT'
> > in menuconfig to get a x86_64 kernel. As a result, there building framework
> > like Yocto doesn't ever consider 'x86_64' as a valid ARCH option. See:
> > https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/classes/kernel-arch.bbclass
> > Therefore, when building with such framework, it uses a x86_64 compiler and ARCH=x86.

Hmm.. okay.  I think that it should also be checked with the new build
system for perf, Jiri? ;)

Anyway, I cleaned up the code like below.. As __LP64__ is defined for
x86_64 as well, we can consolidate the __x86_64__ check to the
__LP64__ check and get rid of the IS_X86_64 IMHO.

Thanks,
Namhyung


diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 67a03a825b3c..eb3e2f3e14b4 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -462,10 +462,12 @@ BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
 # Benchmark modules
 BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o
 BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o
+ifeq ($(ARCH),x86)
 ifeq ($(RAW_ARCH),x86_64)
 BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
 BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
 endif
+endif
 BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o
 BUILTIN_OBJS += $(OUTPUT)bench/futex-hash.o
 BUILTIN_OBJS += $(OUTPUT)bench/futex-wake.o
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 5d4b039fe1ed..648e31ff4021 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -20,7 +20,7 @@ NO_PERF_REGS := 1
 
 # Additional ARCH settings for x86
 ifeq ($(ARCH),x86)
-  ifeq (${IS_X86_64}, 1)
+  ifeq (${IS_64_BIT}, 1)
     CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT
     ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
     LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
diff --git a/tools/perf/config/Makefile.arch b/tools/perf/config/Makefile.arch
index 851cd0172a76..ff95a68741d1 100644
--- a/tools/perf/config/Makefile.arch
+++ b/tools/perf/config/Makefile.arch
@@ -1,7 +1,7 @@
 
 uname_M := $(shell uname -m 2>/dev/null || echo not)
 
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
+RAW_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/ \
@@ -9,23 +9,23 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
                                   -e s/tile.*/tile/ )
 
 # Additional ARCH settings for x86
-ifeq ($(ARCH),i386)
-  override ARCH := x86
+ifeq ($(RAW_ARCH),i386)
+  ARCH ?= x86
 endif
 
-ifeq ($(ARCH),x86_64)
-  override ARCH := x86
-  IS_X86_64 := 0
-  ifeq (, $(findstring m32,$(CFLAGS)))
-    IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | tail -n 1)
-    RAW_ARCH := x86_64
+ifeq ($(RAW_ARCH),x86_64)
+  ARCH ?= x86
+
+  ifneq (, $(findstring m32,$(CFLAGS)))
+    RAW_ARCH := x86_32
   endif
 endif
 
-ifeq (${IS_X86_64}, 1)
+ARCH ?= $(RAW_ARCH)
+
+LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
+ifeq ($(LP64), 1)
   IS_64_BIT := 1
-else ifeq ($(ARCH),x86)
-  IS_64_BIT := 0
 else
-  IS_64_BIT := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
+  IS_64_BIT := 0
 endif

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH] perf: fix building error in x86_64 when dwarf unwind is on
  2015-01-07  5:40       ` Namhyung Kim
@ 2015-01-07  8:39         ` Jiri Olsa
  2015-01-07 12:28           ` Wang Nan
  0 siblings, 1 reply; 17+ messages in thread
From: Jiri Olsa @ 2015-01-07  8:39 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Wang Nan, mingo, linux-kernel, lizefan, acme, jolsa

On Wed, Jan 07, 2015 at 02:40:04PM +0900, Namhyung Kim wrote:
> Hi,
> 
> On Wed, Jan 07, 2015 at 10:53:52AM +0800, Wang Nan wrote:
> > Ping...
> 
> Sorry for long delay.
> 
> > 
> > On 2014/12/29 16:14, Wang Nan wrote:
> > > On 2014/12/29 15:56, Namhyung Kim wrote:
> > >> Hi Wang,
> > >>
> > >> (Adding Arnaldo and Jiri to CC)
> > >>
> > >> On Sat, Dec 27, 2014 at 09:26:11AM +0800, Wang Nan wrote:
> > >>> When build with 'make ARCH=x86' and dwarf unwind is on, there is a
> > >>> compiling error:
> > >>>
> > >>>    CC       /home/wn/perf/arch/x86/util/unwind-libdw.o
> > >>>    CC       /home/wn/perf/arch/x86/tests/regs_load.o
> > >>>  arch/x86/tests/regs_load.S: Assembler messages:
> > >>>  arch/x86/tests/regs_load.S:65: Error: operand type mismatch for `push'
> > >>>  arch/x86/tests/regs_load.S:72: Error: operand type mismatch for `pop'
> > >>>  make[1]: *** [/home/wn/perf/arch/x86/tests/regs_load.o] Error 1
> > >>>  make[1]: INTERNAL: Exiting with 25 jobserver tokens available; should be 24!
> > >>>  make: *** [all] Error 2
> > >>>  ...
> > >>>
> > >>> Which is caused by incorrectly undefine macro HAVE_ARCH_X86_64_SUPPORT.
> > >>> 'config/Makefile.arch' tests __x86_64__ only when 'ARCH=x86_64'. However,
> > >>> with 'ARCH=x86', the underlying compile may also be x86_64, which causes
> > >>> mismatching.
> > >>
> > >> Hmm.. how did you compile this?  I guess ARCH=x86 requires -m32 flag
> > >> to the gcc, did you pass it (like via EXTRA_CFLAGS=-m32)?
> > >>
> > >> I'm confused by 'underlying compile may also be x86_64' part..
> > >>
> > > 
> > > I hit this problem when building perf with Yocto (https://www.yoctoproject.org/), which
> > > is a famous building system for embeded system.
> > > 
> > > When building kernel, we can simply use 'make ARCH=x86' and select 'CONFIG_64BIT'
> > > in menuconfig to get a x86_64 kernel. As a result, there building framework
> > > like Yocto doesn't ever consider 'x86_64' as a valid ARCH option. See:
> > > https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/classes/kernel-arch.bbclass
> > > Therefore, when building with such framework, it uses a x86_64 compiler and ARCH=x86.
> 
> Hmm.. okay.  I think that it should also be checked with the new build
> system for perf, Jiri? ;)

yea.. however the config/Makefile still stays as it was

but whatever change you'll make for Makefile.perf I need
to transform.. but this one does not seem too massive ;-)

> 
> Anyway, I cleaned up the code like below.. As __LP64__ is defined for
> x86_64 as well, we can consolidate the __x86_64__ check to the
> __LP64__ check and get rid of the IS_X86_64 IMHO.
> 
> Thanks,
> Namhyung
> 
> 
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 67a03a825b3c..eb3e2f3e14b4 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -462,10 +462,12 @@ BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
>  # Benchmark modules
>  BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o
>  BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o
> +ifeq ($(ARCH),x86)
>  ifeq ($(RAW_ARCH),x86_64)
>  BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
>  BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
>  endif
> +endif

isn't the check for x86 superfluous here? the x86_64 check is stronger

otherwise it looks ok to me.. Wang Nan, could you please check
if it fixes the issue for you?

thanks,
jirka

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] perf: fix building error in x86_64 when dwarf unwind is on
  2015-01-07  8:39         ` Jiri Olsa
@ 2015-01-07 12:28           ` Wang Nan
  2015-01-07 13:50             ` Namhyung Kim
  0 siblings, 1 reply; 17+ messages in thread
From: Wang Nan @ 2015-01-07 12:28 UTC (permalink / raw)
  To: Jiri Olsa, Namhyung Kim; +Cc: mingo, linux-kernel, lizefan, acme, jolsa

On 2015/1/7 16:39, Jiri Olsa wrote:
> On Wed, Jan 07, 2015 at 02:40:04PM +0900, Namhyung Kim wrote:
>> Hi,
>>
>> On Wed, Jan 07, 2015 at 10:53:52AM +0800, Wang Nan wrote:
>>> Ping...
>>
>> Sorry for long delay.
>>
>>>
>>> On 2014/12/29 16:14, Wang Nan wrote:
>>>> On 2014/12/29 15:56, Namhyung Kim wrote:
>>>>> Hi Wang,
>>>>>
>>>>> (Adding Arnaldo and Jiri to CC)
>>>>>
>>>>> On Sat, Dec 27, 2014 at 09:26:11AM +0800, Wang Nan wrote:
>>>>>> When build with 'make ARCH=x86' and dwarf unwind is on, there is a
>>>>>> compiling error:
>>>>>>
>>>>>>    CC       /home/wn/perf/arch/x86/util/unwind-libdw.o
>>>>>>    CC       /home/wn/perf/arch/x86/tests/regs_load.o
>>>>>>  arch/x86/tests/regs_load.S: Assembler messages:
>>>>>>  arch/x86/tests/regs_load.S:65: Error: operand type mismatch for `push'
>>>>>>  arch/x86/tests/regs_load.S:72: Error: operand type mismatch for `pop'
>>>>>>  make[1]: *** [/home/wn/perf/arch/x86/tests/regs_load.o] Error 1
>>>>>>  make[1]: INTERNAL: Exiting with 25 jobserver tokens available; should be 24!
>>>>>>  make: *** [all] Error 2
>>>>>>  ...
>>>>>>
>>>>>> Which is caused by incorrectly undefine macro HAVE_ARCH_X86_64_SUPPORT.
>>>>>> 'config/Makefile.arch' tests __x86_64__ only when 'ARCH=x86_64'. However,
>>>>>> with 'ARCH=x86', the underlying compile may also be x86_64, which causes
>>>>>> mismatching.
>>>>>
>>>>> Hmm.. how did you compile this?  I guess ARCH=x86 requires -m32 flag
>>>>> to the gcc, did you pass it (like via EXTRA_CFLAGS=-m32)?
>>>>>
>>>>> I'm confused by 'underlying compile may also be x86_64' part..
>>>>>
>>>>
>>>> I hit this problem when building perf with Yocto (https://www.yoctoproject.org/), which
>>>> is a famous building system for embeded system.
>>>>
>>>> When building kernel, we can simply use 'make ARCH=x86' and select 'CONFIG_64BIT'
>>>> in menuconfig to get a x86_64 kernel. As a result, there building framework
>>>> like Yocto doesn't ever consider 'x86_64' as a valid ARCH option. See:
>>>> https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/classes/kernel-arch.bbclass
>>>> Therefore, when building with such framework, it uses a x86_64 compiler and ARCH=x86.
>>
>> Hmm.. okay.  I think that it should also be checked with the new build
>> system for perf, Jiri? ;)
> 
> yea.. however the config/Makefile still stays as it was
> 
> but whatever change you'll make for Makefile.perf I need
> to transform.. but this one does not seem too massive ;-)
> 
>>
>> Anyway, I cleaned up the code like below.. As __LP64__ is defined for
>> x86_64 as well, we can consolidate the __x86_64__ check to the
>> __LP64__ check and get rid of the IS_X86_64 IMHO.
>>
>> Thanks,
>> Namhyung
>>
>>
>> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
>> index 67a03a825b3c..eb3e2f3e14b4 100644
>> --- a/tools/perf/Makefile.perf
>> +++ b/tools/perf/Makefile.perf
>> @@ -462,10 +462,12 @@ BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
>>  # Benchmark modules
>>  BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o
>>  BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o
>> +ifeq ($(ARCH),x86)
>>  ifeq ($(RAW_ARCH),x86_64)
>>  BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
>>  BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
>>  endif
>> +endif
> 
> isn't the check for x86 superfluous here? the x86_64 check is stronger
> 
> otherwise it looks ok to me.. Wang Nan, could you please check
> if it fixes the issue for you?
> 

Sorry, although Namhyung Kim's patch solves my ARCH=x86 problem, it breaks ARM building:

...
| bench/../../../arch/x86/lib/memcpy_64.S: Assembler messages:
| bench/../../../arch/x86/lib/memcpy_64.S:27: Error: junk at end of line, first unrecognized character is `,'
| bench/../../../arch/x86/lib/memcpy_64.S:29: Error: bad instruction `movq %rdi,%rax'
| bench/../../../arch/x86/lib/memcpy_64.S:30: Error: bad instruction `movq %rdx,%rcx'
| bench/../../../arch/x86/lib/memcpy_64.S:31: Error: bad instruction `shrq $3,%rcx'
| bench/../../../arch/x86/lib/memcpy_64.S:32: Error: bad instruction `andl $7,%edx'
...

It builds x86_64 bench when I corss compiling perf for arm (use ARCH=arm). This is caused by Makefile.perf:

...
BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o
ifeq ($(RAW_ARCH),x86_64)
BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
endif
BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o
...

Which rely on RAW_ARCH, but RAW_ARCH is not a cross-compiling-friendly variable now.

> thanks,
> jirka
> 



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] perf: fix building error in x86_64 when dwarf unwind is on
  2015-01-07 12:28           ` Wang Nan
@ 2015-01-07 13:50             ` Namhyung Kim
  2015-01-08  1:30               ` Wang Nan
  0 siblings, 1 reply; 17+ messages in thread
From: Namhyung Kim @ 2015-01-07 13:50 UTC (permalink / raw)
  To: Wang Nan
  Cc: Jiri Olsa, Ingo Molnar, linux-kernel, lizefan,
	Arnaldo Carvalho de Melo, Jiri Olsa

On Wed, Jan 7, 2015 at 9:28 PM, Wang Nan <wangnan0@huawei.com> wrote:
> On 2015/1/7 16:39, Jiri Olsa wrote:
>> On Wed, Jan 07, 2015 at 02:40:04PM +0900, Namhyung Kim wrote:
>>> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
>>> index 67a03a825b3c..eb3e2f3e14b4 100644
>>> --- a/tools/perf/Makefile.perf
>>> +++ b/tools/perf/Makefile.perf
>>> @@ -462,10 +462,12 @@ BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
>>>  # Benchmark modules
>>>  BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o
>>>  BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o
>>> +ifeq ($(ARCH),x86)
>>>  ifeq ($(RAW_ARCH),x86_64)
>>>  BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
>>>  BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
>>>  endif
>>> +endif
>>
>> isn't the check for x86 superfluous here? the x86_64 check is stronger
>>
>> otherwise it looks ok to me.. Wang Nan, could you please check
>> if it fixes the issue for you?
>>
>
> Sorry, although Namhyung Kim's patch solves my ARCH=x86 problem, it breaks ARM building:
>
> ...
> | bench/../../../arch/x86/lib/memcpy_64.S: Assembler messages:
> | bench/../../../arch/x86/lib/memcpy_64.S:27: Error: junk at end of line, first unrecognized character is `,'
> | bench/../../../arch/x86/lib/memcpy_64.S:29: Error: bad instruction `movq %rdi,%rax'
> | bench/../../../arch/x86/lib/memcpy_64.S:30: Error: bad instruction `movq %rdx,%rcx'
> | bench/../../../arch/x86/lib/memcpy_64.S:31: Error: bad instruction `shrq $3,%rcx'
> | bench/../../../arch/x86/lib/memcpy_64.S:32: Error: bad instruction `andl $7,%edx'
> ...

Strange.. this code is included only if ARCH=x86 in config/Makefile:

# Additional ARCH settings for x86
ifeq ($(ARCH),x86)
  ifeq (${IS_64_BIT}, 1)
    CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT
    ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
    LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
  else
    LIBUNWIND_LIBS = -lunwind -lunwind-x86
  endif
  NO_PERF_REGS := 0
endif

Did your original patch build it without a problem?


>
> It builds x86_64 bench when I corss compiling perf for arm (use ARCH=arm). This is caused by Makefile.perf:
>
> ...
> BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o
> ifeq ($(RAW_ARCH),x86_64)
> BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
> BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
> endif
> BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o
> ...
>
> Which rely on RAW_ARCH, but RAW_ARCH is not a cross-compiling-friendly variable now.

That's why I added the extra ARCH check.

Thanks,
Namhyung

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] perf: fix building error in x86_64 when dwarf unwind is on
  2015-01-07 13:50             ` Namhyung Kim
@ 2015-01-08  1:30               ` Wang Nan
  2015-01-08  5:09                 ` Namhyung Kim
  0 siblings, 1 reply; 17+ messages in thread
From: Wang Nan @ 2015-01-08  1:30 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Jiri Olsa, Ingo Molnar, linux-kernel, lizefan,
	Arnaldo Carvalho de Melo, Jiri Olsa

On 2015/1/7 21:50, Namhyung Kim wrote:
> On Wed, Jan 7, 2015 at 9:28 PM, Wang Nan <wangnan0@huawei.com> wrote:
>> On 2015/1/7 16:39, Jiri Olsa wrote:
>>> On Wed, Jan 07, 2015 at 02:40:04PM +0900, Namhyung Kim wrote:
>>>> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
>>>> index 67a03a825b3c..eb3e2f3e14b4 100644
>>>> --- a/tools/perf/Makefile.perf
>>>> +++ b/tools/perf/Makefile.perf
>>>> @@ -462,10 +462,12 @@ BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
>>>>  # Benchmark modules
>>>>  BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o
>>>>  BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o
>>>> +ifeq ($(ARCH),x86)
>>>>  ifeq ($(RAW_ARCH),x86_64)
>>>>  BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
>>>>  BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
>>>>  endif
>>>> +endif
>>>
>>> isn't the check for x86 superfluous here? the x86_64 check is stronger
>>>
>>> otherwise it looks ok to me.. Wang Nan, could you please check
>>> if it fixes the issue for you?
>>>
>>
>> Sorry, although Namhyung Kim's patch solves my ARCH=x86 problem, it breaks ARM building:
>>
>> ...
>> | bench/../../../arch/x86/lib/memcpy_64.S: Assembler messages:
>> | bench/../../../arch/x86/lib/memcpy_64.S:27: Error: junk at end of line, first unrecognized character is `,'
>> | bench/../../../arch/x86/lib/memcpy_64.S:29: Error: bad instruction `movq %rdi,%rax'
>> | bench/../../../arch/x86/lib/memcpy_64.S:30: Error: bad instruction `movq %rdx,%rcx'
>> | bench/../../../arch/x86/lib/memcpy_64.S:31: Error: bad instruction `shrq $3,%rcx'
>> | bench/../../../arch/x86/lib/memcpy_64.S:32: Error: bad instruction `andl $7,%edx'
>> ...
> 
> Strange.. this code is included only if ARCH=x86 in config/Makefile:
> 
> # Additional ARCH settings for x86
> ifeq ($(ARCH),x86)
>   ifeq (${IS_64_BIT}, 1)
>     CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT
>     ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
>     LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
>   else
>     LIBUNWIND_LIBS = -lunwind -lunwind-x86
>   endif
>   NO_PERF_REGS := 0
> endif
> 
> Did your original patch build it without a problem?
> 

My original patch is free from this problem.

bench/mem-memset-x86-64-asm.S doesn't use ARCH_INCLUDE, it direct include "../../../arch/x86/lib/memset_64.S".

> 
>>
>> It builds x86_64 bench when I corss compiling perf for arm (use ARCH=arm). This is caused by Makefile.perf:
>>
>> ...
>> BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o
>> ifeq ($(RAW_ARCH),x86_64)
>> BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
>> BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
>> endif
>> BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o
>> ...
>>
>> Which rely on RAW_ARCH, but RAW_ARCH is not a cross-compiling-friendly variable now.
> 
> That's why I added the extra ARCH check.
> 

With your additional ARCH check, ARM compiling is passed. However I suggest you not to
use $(RAW_ARCH) directly, because it is get from "uname -m", which reflects the arch of
build machine, not the arch of host machine (the machine perf will run on).

What about this:

---
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 67a03a82..1f71a32 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -462,10 +462,12 @@ 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)
+ifeq ($(IS_64_BIT), 1)
 BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
 BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
 endif
+endif
 BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o
 BUILTIN_OBJS += $(OUTPUT)bench/futex-hash.o
 BUILTIN_OBJS += $(OUTPUT)bench/futex-wake.o

> Thanks,
> Namhyung
> 



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH] perf: fix building error in x86_64 when dwarf unwind is on
  2015-01-08  1:30               ` Wang Nan
@ 2015-01-08  5:09                 ` Namhyung Kim
  2015-01-09 14:43                   ` Jiri Olsa
  0 siblings, 1 reply; 17+ messages in thread
From: Namhyung Kim @ 2015-01-08  5:09 UTC (permalink / raw)
  To: Wang Nan
  Cc: Jiri Olsa, Ingo Molnar, linux-kernel, lizefan,
	Arnaldo Carvalho de Melo, Jiri Olsa

On Thu, Jan 08, 2015 at 09:30:23AM +0800, Wang Nan wrote:
> On 2015/1/7 21:50, Namhyung Kim wrote:
> > On Wed, Jan 7, 2015 at 9:28 PM, Wang Nan <wangnan0@huawei.com> wrote:
> >> On 2015/1/7 16:39, Jiri Olsa wrote:
> >>> On Wed, Jan 07, 2015 at 02:40:04PM +0900, Namhyung Kim wrote:
> >>>> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> >>>> index 67a03a825b3c..eb3e2f3e14b4 100644
> >>>> --- a/tools/perf/Makefile.perf
> >>>> +++ b/tools/perf/Makefile.perf
> >>>> @@ -462,10 +462,12 @@ BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
> >>>>  # Benchmark modules
> >>>>  BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o
> >>>>  BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o
> >>>> +ifeq ($(ARCH),x86)
> >>>>  ifeq ($(RAW_ARCH),x86_64)
> >>>>  BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
> >>>>  BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
> >>>>  endif
> >>>> +endif
> >>>
> >>> isn't the check for x86 superfluous here? the x86_64 check is stronger
> >>>
> >>> otherwise it looks ok to me.. Wang Nan, could you please check
> >>> if it fixes the issue for you?
> >>>
> >>
> >> Sorry, although Namhyung Kim's patch solves my ARCH=x86 problem, it breaks ARM building:
> >>
> >> ...
> >> | bench/../../../arch/x86/lib/memcpy_64.S: Assembler messages:
> >> | bench/../../../arch/x86/lib/memcpy_64.S:27: Error: junk at end of line, first unrecognized character is `,'
> >> | bench/../../../arch/x86/lib/memcpy_64.S:29: Error: bad instruction `movq %rdi,%rax'
> >> | bench/../../../arch/x86/lib/memcpy_64.S:30: Error: bad instruction `movq %rdx,%rcx'
> >> | bench/../../../arch/x86/lib/memcpy_64.S:31: Error: bad instruction `shrq $3,%rcx'
> >> | bench/../../../arch/x86/lib/memcpy_64.S:32: Error: bad instruction `andl $7,%edx'
> >> ...
> > 
> > Strange.. this code is included only if ARCH=x86 in config/Makefile:
> > 
> > # Additional ARCH settings for x86
> > ifeq ($(ARCH),x86)
> >   ifeq (${IS_64_BIT}, 1)
> >     CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT
> >     ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
> >     LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
> >   else
> >     LIBUNWIND_LIBS = -lunwind -lunwind-x86
> >   endif
> >   NO_PERF_REGS := 0
> > endif
> > 
> > Did your original patch build it without a problem?
> > 
> 
> My original patch is free from this problem.
> 
> bench/mem-memset-x86-64-asm.S doesn't use ARCH_INCLUDE, it direct include "../../../arch/x86/lib/memset_64.S".

Ah, got it.


> 
> > 
> >>
> >> It builds x86_64 bench when I corss compiling perf for arm (use ARCH=arm). This is caused by Makefile.perf:
> >>
> >> ...
> >> BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o
> >> ifeq ($(RAW_ARCH),x86_64)
> >> BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
> >> BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
> >> endif
> >> BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o
> >> ...
> >>
> >> Which rely on RAW_ARCH, but RAW_ARCH is not a cross-compiling-friendly variable now.
> > 
> > That's why I added the extra ARCH check.
> > 
> 
> With your additional ARCH check, ARM compiling is passed. However I suggest you not to
> use $(RAW_ARCH) directly, because it is get from "uname -m", which reflects the arch of
> build machine, not the arch of host machine (the machine perf will run on).
> 
> What about this:
> 
> ---
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 67a03a82..1f71a32 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -462,10 +462,12 @@ 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)
> +ifeq ($(IS_64_BIT), 1)
>  BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
>  BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
>  endif
> +endif
>  BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o
>  BUILTIN_OBJS += $(OUTPUT)bench/futex-hash.o
>  BUILTIN_OBJS += $(OUTPUT)bench/futex-wake.o

Looks good to me!

Thanks,
Namhyung

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] perf: fix building error in x86_64 when dwarf unwind is on
  2015-01-08  5:09                 ` Namhyung Kim
@ 2015-01-09 14:43                   ` Jiri Olsa
  2015-01-12  2:20                     ` Wang Nan
  0 siblings, 1 reply; 17+ messages in thread
From: Jiri Olsa @ 2015-01-09 14:43 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Wang Nan, Ingo Molnar, linux-kernel, lizefan,
	Arnaldo Carvalho de Melo, Jiri Olsa

On Thu, Jan 08, 2015 at 02:09:20PM +0900, Namhyung Kim wrote:

SNIP

> > ---
> > diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> > index 67a03a82..1f71a32 100644
> > --- a/tools/perf/Makefile.perf
> > +++ b/tools/perf/Makefile.perf
> > @@ -462,10 +462,12 @@ 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)
> > +ifeq ($(IS_64_BIT), 1)
> >  BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
> >  BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
> >  endif
> > +endif
> >  BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o
> >  BUILTIN_OBJS += $(OUTPUT)bench/futex-hash.o
> >  BUILTIN_OBJS += $(OUTPUT)bench/futex-wake.o
> 
> Looks good to me!

I'm little confused now.. is this on top of your earlier
patch or this change stands by itself..?

could any of you please resend v2 ? ;-)

thanks,
jirka

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH] perf: fix building error in x86_64 when dwarf unwind is on.
  2015-01-09 14:43                   ` Jiri Olsa
@ 2015-01-12  2:20                     ` Wang Nan
  2015-01-12  3:28                       ` Namhyung Kim
  2015-01-17 10:10                       ` [tip:perf/urgent] perf tools: Fix " tip-bot for Namhyung Kim
  0 siblings, 2 replies; 17+ messages in thread
From: Wang Nan @ 2015-01-12  2:20 UTC (permalink / raw)
  To: jolsa, namhyung; +Cc: mingo, linux-kernel, lizefan, acme

From: Namhyung Kim <namhyung@kernel.org>

When build with 'make ARCH=x86' and dwarf unwind is on, there is a
compiling error:

   CC       /home/wn/perf/arch/x86/util/unwind-libdw.o
   CC       /home/wn/perf/arch/x86/tests/regs_load.o
 arch/x86/tests/regs_load.S: Assembler messages:
 arch/x86/tests/regs_load.S:65: Error: operand type mismatch for `push'
 arch/x86/tests/regs_load.S:72: Error: operand type mismatch for `pop'
 make[1]: *** [/home/wn/perf/arch/x86/tests/regs_load.o] Error 1
 make[1]: INTERNAL: Exiting with 25 jobserver tokens available; should be 24!
 make: *** [all] Error 2
 ...

Which is caused by incorrectly undefine macro HAVE_ARCH_X86_64_SUPPORT.
'config/Makefile.arch' tests __x86_64__ only when 'ARCH=x86_64'.
However, when building x86_64 kernel, ARCH=x86 is valid and commonly
used. Building systems, such as yocto, uses x86_64 compiler with
'ARCH=x86' to build x86_64 perf, which causes mismatching.

As __LP64__ is defined for x86_64 as well, we can consolidate the
__x86_64__ check to the __LP64__ check and get rid of the IS_X86_64
IMHO.

(This patch is made by Namhyung Kim when replying my v1 patch:

https://lkml.org/lkml/2015/1/7/17

I modified the code to remove dependency on RAW_ARCH:

https://lkml.org/lkml/2015/1/7/865

Namhyung Kim didn't provide his SOB in his original email. I add
mine only for my modification.)

Signed-off-by: Wang Nan <wangnan0@huawei.com>
---
 tools/perf/Makefile.perf        |  4 +++-
 tools/perf/config/Makefile      |  2 +-
 tools/perf/config/Makefile.arch | 26 +++++++++++++-------------
 3 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 67a03a82..1f71a32 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -462,10 +462,12 @@ 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)
+ifeq ($(IS_64_BIT), 1)
 BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
 BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
 endif
+endif
 BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o
 BUILTIN_OBJS += $(OUTPUT)bench/futex-hash.o
 BUILTIN_OBJS += $(OUTPUT)bench/futex-wake.o
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 5d4b039..648e31f 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -20,7 +20,7 @@ NO_PERF_REGS := 1
 
 # Additional ARCH settings for x86
 ifeq ($(ARCH),x86)
-  ifeq (${IS_X86_64}, 1)
+  ifeq (${IS_64_BIT}, 1)
     CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT
     ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
     LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
diff --git a/tools/perf/config/Makefile.arch b/tools/perf/config/Makefile.arch
index 851cd01..ff95a68 100644
--- a/tools/perf/config/Makefile.arch
+++ b/tools/perf/config/Makefile.arch
@@ -1,7 +1,7 @@
 
 uname_M := $(shell uname -m 2>/dev/null || echo not)
 
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
+RAW_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/ \
@@ -9,23 +9,23 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
                                   -e s/tile.*/tile/ )
 
 # Additional ARCH settings for x86
-ifeq ($(ARCH),i386)
-  override ARCH := x86
+ifeq ($(RAW_ARCH),i386)
+  ARCH ?= x86
 endif
 
-ifeq ($(ARCH),x86_64)
-  override ARCH := x86
-  IS_X86_64 := 0
-  ifeq (, $(findstring m32,$(CFLAGS)))
-    IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | tail -n 1)
-    RAW_ARCH := x86_64
+ifeq ($(RAW_ARCH),x86_64)
+  ARCH ?= x86
+
+  ifneq (, $(findstring m32,$(CFLAGS)))
+    RAW_ARCH := x86_32
   endif
 endif
 
-ifeq (${IS_X86_64}, 1)
+ARCH ?= $(RAW_ARCH)
+
+LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
+ifeq ($(LP64), 1)
   IS_64_BIT := 1
-else ifeq ($(ARCH),x86)
-  IS_64_BIT := 0
 else
-  IS_64_BIT := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
+  IS_64_BIT := 0
 endif
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH] perf: fix building error in x86_64 when dwarf unwind is on.
  2015-01-12  2:20                     ` Wang Nan
@ 2015-01-12  3:28                       ` Namhyung Kim
  2015-01-12 10:36                         ` Jiri Olsa
  2015-01-17 10:10                       ` [tip:perf/urgent] perf tools: Fix " tip-bot for Namhyung Kim
  1 sibling, 1 reply; 17+ messages in thread
From: Namhyung Kim @ 2015-01-12  3:28 UTC (permalink / raw)
  To: Wang Nan; +Cc: jolsa, mingo, linux-kernel, lizefan, acme

On Mon, Jan 12, 2015 at 10:20:55AM +0800, Wang Nan wrote:
> From: Namhyung Kim <namhyung@kernel.org>
> 
> When build with 'make ARCH=x86' and dwarf unwind is on, there is a
> compiling error:
> 
>    CC       /home/wn/perf/arch/x86/util/unwind-libdw.o
>    CC       /home/wn/perf/arch/x86/tests/regs_load.o
>  arch/x86/tests/regs_load.S: Assembler messages:
>  arch/x86/tests/regs_load.S:65: Error: operand type mismatch for `push'
>  arch/x86/tests/regs_load.S:72: Error: operand type mismatch for `pop'
>  make[1]: *** [/home/wn/perf/arch/x86/tests/regs_load.o] Error 1
>  make[1]: INTERNAL: Exiting with 25 jobserver tokens available; should be 24!
>  make: *** [all] Error 2
>  ...
> 
> Which is caused by incorrectly undefine macro HAVE_ARCH_X86_64_SUPPORT.
> 'config/Makefile.arch' tests __x86_64__ only when 'ARCH=x86_64'.
> However, when building x86_64 kernel, ARCH=x86 is valid and commonly
> used. Building systems, such as yocto, uses x86_64 compiler with
> 'ARCH=x86' to build x86_64 perf, which causes mismatching.
> 
> As __LP64__ is defined for x86_64 as well, we can consolidate the
> __x86_64__ check to the __LP64__ check and get rid of the IS_X86_64
> IMHO.
> 
> (This patch is made by Namhyung Kim when replying my v1 patch:
> 
> https://lkml.org/lkml/2015/1/7/17
> 
> I modified the code to remove dependency on RAW_ARCH:
> 
> https://lkml.org/lkml/2015/1/7/865
> 
> Namhyung Kim didn't provide his SOB in his original email. I add
> mine only for my modification.)

Please feel free to add my SOB to this patch.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung


> 
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> ---
>  tools/perf/Makefile.perf        |  4 +++-
>  tools/perf/config/Makefile      |  2 +-
>  tools/perf/config/Makefile.arch | 26 +++++++++++++-------------
>  3 files changed, 17 insertions(+), 15 deletions(-)
> 
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 67a03a82..1f71a32 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -462,10 +462,12 @@ 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)
> +ifeq ($(IS_64_BIT), 1)
>  BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
>  BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
>  endif
> +endif
>  BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o
>  BUILTIN_OBJS += $(OUTPUT)bench/futex-hash.o
>  BUILTIN_OBJS += $(OUTPUT)bench/futex-wake.o
> diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
> index 5d4b039..648e31f 100644
> --- a/tools/perf/config/Makefile
> +++ b/tools/perf/config/Makefile
> @@ -20,7 +20,7 @@ NO_PERF_REGS := 1
>  
>  # Additional ARCH settings for x86
>  ifeq ($(ARCH),x86)
> -  ifeq (${IS_X86_64}, 1)
> +  ifeq (${IS_64_BIT}, 1)
>      CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT
>      ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
>      LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
> diff --git a/tools/perf/config/Makefile.arch b/tools/perf/config/Makefile.arch
> index 851cd01..ff95a68 100644
> --- a/tools/perf/config/Makefile.arch
> +++ b/tools/perf/config/Makefile.arch
> @@ -1,7 +1,7 @@
>  
>  uname_M := $(shell uname -m 2>/dev/null || echo not)
>  
> -ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
> +RAW_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/ \
> @@ -9,23 +9,23 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
>                                    -e s/tile.*/tile/ )
>  
>  # Additional ARCH settings for x86
> -ifeq ($(ARCH),i386)
> -  override ARCH := x86
> +ifeq ($(RAW_ARCH),i386)
> +  ARCH ?= x86
>  endif
>  
> -ifeq ($(ARCH),x86_64)
> -  override ARCH := x86
> -  IS_X86_64 := 0
> -  ifeq (, $(findstring m32,$(CFLAGS)))
> -    IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | tail -n 1)
> -    RAW_ARCH := x86_64
> +ifeq ($(RAW_ARCH),x86_64)
> +  ARCH ?= x86
> +
> +  ifneq (, $(findstring m32,$(CFLAGS)))
> +    RAW_ARCH := x86_32
>    endif
>  endif
>  
> -ifeq (${IS_X86_64}, 1)
> +ARCH ?= $(RAW_ARCH)
> +
> +LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
> +ifeq ($(LP64), 1)
>    IS_64_BIT := 1
> -else ifeq ($(ARCH),x86)
> -  IS_64_BIT := 0
>  else
> -  IS_64_BIT := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
> +  IS_64_BIT := 0
>  endif
> -- 
> 1.8.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] perf: fix building error in x86_64 when dwarf unwind is on.
  2015-01-12  3:28                       ` Namhyung Kim
@ 2015-01-12 10:36                         ` Jiri Olsa
  0 siblings, 0 replies; 17+ messages in thread
From: Jiri Olsa @ 2015-01-12 10:36 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Wang Nan, mingo, linux-kernel, lizefan, acme

On Mon, Jan 12, 2015 at 12:28:10PM +0900, Namhyung Kim wrote:
> On Mon, Jan 12, 2015 at 10:20:55AM +0800, Wang Nan wrote:
> > From: Namhyung Kim <namhyung@kernel.org>
> > 
> > When build with 'make ARCH=x86' and dwarf unwind is on, there is a
> > compiling error:
> > 
> >    CC       /home/wn/perf/arch/x86/util/unwind-libdw.o
> >    CC       /home/wn/perf/arch/x86/tests/regs_load.o
> >  arch/x86/tests/regs_load.S: Assembler messages:
> >  arch/x86/tests/regs_load.S:65: Error: operand type mismatch for `push'
> >  arch/x86/tests/regs_load.S:72: Error: operand type mismatch for `pop'
> >  make[1]: *** [/home/wn/perf/arch/x86/tests/regs_load.o] Error 1
> >  make[1]: INTERNAL: Exiting with 25 jobserver tokens available; should be 24!
> >  make: *** [all] Error 2
> >  ...
> > 
> > Which is caused by incorrectly undefine macro HAVE_ARCH_X86_64_SUPPORT.
> > 'config/Makefile.arch' tests __x86_64__ only when 'ARCH=x86_64'.
> > However, when building x86_64 kernel, ARCH=x86 is valid and commonly
> > used. Building systems, such as yocto, uses x86_64 compiler with
> > 'ARCH=x86' to build x86_64 perf, which causes mismatching.
> > 
> > As __LP64__ is defined for x86_64 as well, we can consolidate the
> > __x86_64__ check to the __LP64__ check and get rid of the IS_X86_64
> > IMHO.
> > 
> > (This patch is made by Namhyung Kim when replying my v1 patch:
> > 
> > https://lkml.org/lkml/2015/1/7/17
> > 
> > I modified the code to remove dependency on RAW_ARCH:
> > 
> > https://lkml.org/lkml/2015/1/7/865
> > 
> > Namhyung Kim didn't provide his SOB in his original email. I add
> > mine only for my modification.)
> 
> Please feel free to add my SOB to this patch.
> 
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>

Acked-by: Jiri Olsa <jolsa@kernel.org>

also.. I tried 32bit build on x86_64, but I had to disable python
support explicitly to succeed:

  $ make EXTRA_CFLAGS=-m32 NO_LIBPYTHON=1

seems like 'python-config --cflags' returns -m64, which beats -m32,
and the features code always detects 64bit version, which fails
to link at the end with all the rest 32bit stuff

hopefully some python enthusiast will fix it one day,
anyway it's great the 32bit build works.. sort of ;-)

thanks,
jirka

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [tip:perf/urgent] perf tools: Fix building error in x86_64 when dwarf unwind is on
  2015-01-12  2:20                     ` Wang Nan
  2015-01-12  3:28                       ` Namhyung Kim
@ 2015-01-17 10:10                       ` tip-bot for Namhyung Kim
  1 sibling, 0 replies; 17+ messages in thread
From: tip-bot for Namhyung Kim @ 2015-01-17 10:10 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: lizefan, jolsa, namhyung, mingo, hpa, acme, tglx, mingo,
	wangnan0, jolsa, linux-kernel

Commit-ID:  c6e5e9fbc3ea1c1a5648a3498d085fc3978df2d4
Gitweb:     http://git.kernel.org/tip/c6e5e9fbc3ea1c1a5648a3498d085fc3978df2d4
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Mon, 12 Jan 2015 10:20:55 +0800
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 16 Jan 2015 17:49:28 -0300

perf tools: Fix building error in x86_64 when dwarf unwind is on

When build with 'make ARCH=x86' and dwarf unwind is on, there is a
compiling error:

   CC       /home/wn/perf/arch/x86/util/unwind-libdw.o
   CC       /home/wn/perf/arch/x86/tests/regs_load.o
 arch/x86/tests/regs_load.S: Assembler messages:
 arch/x86/tests/regs_load.S:65: Error: operand type mismatch for `push'
 arch/x86/tests/regs_load.S:72: Error: operand type mismatch for `pop'
 make[1]: *** [/home/wn/perf/arch/x86/tests/regs_load.o] Error 1
 make[1]: INTERNAL: Exiting with 25 jobserver tokens available; should be 24!
 make: *** [all] Error 2
 ...

Which is caused by incorrectly undefine macro HAVE_ARCH_X86_64_SUPPORT.
'config/Makefile.arch' tests __x86_64__ only when 'ARCH=x86_64'.
However, when building x86_64 kernel, ARCH=x86 is valid and commonly
used. Build systems, such as yocto, uses x86_64 compiler with 'ARCH=x86'
to build x86_64 perf, which causes mismatching.

As __LP64__ is defined for x86_64 as well, we can consolidate the
__x86_64__ check to the __LP64__ check and get rid of the IS_X86_64
IMHO.

(This patch is made by Namhyung Kim when replying my v1 patch:

https://lkml.org/lkml/2015/1/7/17

I modified the code to remove dependency on RAW_ARCH:

https://lkml.org/lkml/2015/1/7/865

Namhyung Kim didn't provide his SOB in his original email. I add
mine only for my modification.)

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1421029255-23039-1-git-send-email-wangnan0@huawei.com
[ Namhyung provided his S-o-B on a followup to this patch thread on lkml ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile.perf        |  4 +++-
 tools/perf/config/Makefile      |  2 +-
 tools/perf/config/Makefile.arch | 26 +++++++++++++-------------
 3 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 67a03a82..1f71a32 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -462,10 +462,12 @@ 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)
+ifeq ($(IS_64_BIT), 1)
 BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
 BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
 endif
+endif
 BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o
 BUILTIN_OBJS += $(OUTPUT)bench/futex-hash.o
 BUILTIN_OBJS += $(OUTPUT)bench/futex-wake.o
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 5d4b039..648e31f 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -20,7 +20,7 @@ NO_PERF_REGS := 1
 
 # Additional ARCH settings for x86
 ifeq ($(ARCH),x86)
-  ifeq (${IS_X86_64}, 1)
+  ifeq (${IS_64_BIT}, 1)
     CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT
     ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
     LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
diff --git a/tools/perf/config/Makefile.arch b/tools/perf/config/Makefile.arch
index 851cd01..ff95a68 100644
--- a/tools/perf/config/Makefile.arch
+++ b/tools/perf/config/Makefile.arch
@@ -1,7 +1,7 @@
 
 uname_M := $(shell uname -m 2>/dev/null || echo not)
 
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
+RAW_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/ \
@@ -9,23 +9,23 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
                                   -e s/tile.*/tile/ )
 
 # Additional ARCH settings for x86
-ifeq ($(ARCH),i386)
-  override ARCH := x86
+ifeq ($(RAW_ARCH),i386)
+  ARCH ?= x86
 endif
 
-ifeq ($(ARCH),x86_64)
-  override ARCH := x86
-  IS_X86_64 := 0
-  ifeq (, $(findstring m32,$(CFLAGS)))
-    IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | tail -n 1)
-    RAW_ARCH := x86_64
+ifeq ($(RAW_ARCH),x86_64)
+  ARCH ?= x86
+
+  ifneq (, $(findstring m32,$(CFLAGS)))
+    RAW_ARCH := x86_32
   endif
 endif
 
-ifeq (${IS_X86_64}, 1)
+ARCH ?= $(RAW_ARCH)
+
+LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
+ifeq ($(LP64), 1)
   IS_64_BIT := 1
-else ifeq ($(ARCH),x86)
-  IS_64_BIT := 0
 else
-  IS_64_BIT := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
+  IS_64_BIT := 0
 endif

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH] perf: fix building error in x86_64 when dwarf unwind is on.
@ 2015-02-03 19:58 ` Christopher Covington
  0 siblings, 0 replies; 17+ messages in thread
From: Christopher Covington @ 2015-02-03 19:58 UTC (permalink / raw)
  To: Wang Nan, Namhyung Kim, Jiri Olsa, linux-kernel,
	Arnaldo Carvalho de Melo
  Cc: Li Zefan, Ingo Molnar, linux-perf-users

Hi,

Commit c6e5e9fbc3ea1c1a5648a3498d085fc3978df2d4 breaks the following make
invocation (-j, -C, O=, LDFLAGS=, and build directory prefix stripped to
simplify report):

make ARCH=x86_64 CROSS_COMPILE= EXTRA_CFLAGS=
config/Makefile:128: The path 'python-config' is not executable.
config/Makefile:349: No libdw.h found or old libdw.h found or elfutils is
older than 0.138, disables dwarf support. Please install new
elfutils-devel/libdw-dev
config/Makefile:401: Disabling post unwind, no support found.
config/Makefile:439: No libaudit.h found, disables 'trace' tool, please
install audit-libs-devel or libaudit-dev
config/Makefile:453: slang not found, disables TUI support. Please install
slang-devel or libslang-dev
config/Makefile:466: GTK2 not found, disables GTK2 support. Please install
gtk2-devel or libgtk2.0-dev
config/Makefile:494: Missing perl devel files. Disabling perl scripting
support, consider installing perl-ExtUtils-Embed
config/Makefile:525: No python-config tool was found
config/Makefile:525: Python support will not be built
config/Makefile:597: No bfd.h/libbfd found, install
binutils-dev[el]/zlib-static to gain symbol demangling
config/Makefile:627: No numa.h found, disables 'perf bench numa mem'
benchmark, please install numactl-devel/libnuma-devel/libnuma-dev

Auto-detecting system features:
...                         dwarf: [ ^[[31mOFF^[[m ]
...                         glibc: [ ^[[32mon^[[m  ]
...                          gtk2: [ ^[[31mOFF^[[m ]
...                      libaudit: [ ^[[31mOFF^[[m ]
...                        libbfd: [ ^[[31mOFF^[[m ]
...                        libelf: [ ^[[32mon^[[m  ]
...                       libnuma: [ ^[[31mOFF^[[m ]
...                       libperl: [ ^[[31mOFF^[[m ]
...                     libpython: [ ^[[31mOFF^[[m ]
...                      libslang: [ ^[[31mOFF^[[m ]
...                     libunwind: [ ^[[31mOFF^[[m ]
...            libdw-dwarf-unwind: [ ^[[31mOFF^[[m ]
...                          zlib: [ ^[[32mon^[[m  ]

[...]

  AR       x86_64-linux-gnu/perf/libperf.a
  LINK     x86_64-linux-gnu/perf/perf
x86_64-linux-gnu/perf/tests/builtin-test.o:(.data+0x158): undefined reference
to `test__perf_time_to_tsc'
collect2: ld returned 1 exit status

Thanks,
Chris

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] perf: fix building error in x86_64 when dwarf unwind is on.
@ 2015-02-03 19:58 ` Christopher Covington
  0 siblings, 0 replies; 17+ messages in thread
From: Christopher Covington @ 2015-02-03 19:58 UTC (permalink / raw)
  To: Wang Nan, Namhyung Kim, Jiri Olsa, linux-kernel,
	Arnaldo Carvalho de Melo
  Cc: Li Zefan, Ingo Molnar, linux-perf-users

Hi,

Commit c6e5e9fbc3ea1c1a5648a3498d085fc3978df2d4 breaks the following make
invocation (-j, -C, O=, LDFLAGS=, and build directory prefix stripped to
simplify report):

make ARCH=x86_64 CROSS_COMPILE= EXTRA_CFLAGS=
config/Makefile:128: The path 'python-config' is not executable.
config/Makefile:349: No libdw.h found or old libdw.h found or elfutils is
older than 0.138, disables dwarf support. Please install new
elfutils-devel/libdw-dev
config/Makefile:401: Disabling post unwind, no support found.
config/Makefile:439: No libaudit.h found, disables 'trace' tool, please
install audit-libs-devel or libaudit-dev
config/Makefile:453: slang not found, disables TUI support. Please install
slang-devel or libslang-dev
config/Makefile:466: GTK2 not found, disables GTK2 support. Please install
gtk2-devel or libgtk2.0-dev
config/Makefile:494: Missing perl devel files. Disabling perl scripting
support, consider installing perl-ExtUtils-Embed
config/Makefile:525: No python-config tool was found
config/Makefile:525: Python support will not be built
config/Makefile:597: No bfd.h/libbfd found, install
binutils-dev[el]/zlib-static to gain symbol demangling
config/Makefile:627: No numa.h found, disables 'perf bench numa mem'
benchmark, please install numactl-devel/libnuma-devel/libnuma-dev

Auto-detecting system features:
...                         dwarf: [ ^[[31mOFF^[[m ]
...                         glibc: [ ^[[32mon^[[m  ]
...                          gtk2: [ ^[[31mOFF^[[m ]
...                      libaudit: [ ^[[31mOFF^[[m ]
...                        libbfd: [ ^[[31mOFF^[[m ]
...                        libelf: [ ^[[32mon^[[m  ]
...                       libnuma: [ ^[[31mOFF^[[m ]
...                       libperl: [ ^[[31mOFF^[[m ]
...                     libpython: [ ^[[31mOFF^[[m ]
...                      libslang: [ ^[[31mOFF^[[m ]
...                     libunwind: [ ^[[31mOFF^[[m ]
...            libdw-dwarf-unwind: [ ^[[31mOFF^[[m ]
...                          zlib: [ ^[[32mon^[[m  ]

[...]

  AR       x86_64-linux-gnu/perf/libperf.a
  LINK     x86_64-linux-gnu/perf/perf
x86_64-linux-gnu/perf/tests/builtin-test.o:(.data+0x158): undefined reference
to `test__perf_time_to_tsc'
collect2: ld returned 1 exit status

Thanks,
Chris

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2015-02-03 19:59 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-27  1:26 [PATCH] perf: fix building error in x86_64 when dwarf unwind is on Wang Nan
2014-12-29  7:56 ` Namhyung Kim
2014-12-29  8:14   ` Wang Nan
2015-01-07  2:53     ` Wang Nan
2015-01-07  5:40       ` Namhyung Kim
2015-01-07  8:39         ` Jiri Olsa
2015-01-07 12:28           ` Wang Nan
2015-01-07 13:50             ` Namhyung Kim
2015-01-08  1:30               ` Wang Nan
2015-01-08  5:09                 ` Namhyung Kim
2015-01-09 14:43                   ` Jiri Olsa
2015-01-12  2:20                     ` Wang Nan
2015-01-12  3:28                       ` Namhyung Kim
2015-01-12 10:36                         ` Jiri Olsa
2015-01-17 10:10                       ` [tip:perf/urgent] perf tools: Fix " tip-bot for Namhyung Kim
2015-02-03 19:58 [PATCH] perf: fix " Christopher Covington
2015-02-03 19:58 ` Christopher Covington

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.