All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] x86: Use -mno-avx when available
@ 2012-03-28 18:51 Andi Kleen
  2012-03-28 18:51 ` [PATCH 2/2] Add CONFIG_READABLE_ASM Andi Kleen
  2012-03-30 17:16 ` [tip:x86/urgent] x86: Use -mno-avx when available tip-bot for Andi Kleen
  0 siblings, 2 replies; 17+ messages in thread
From: Andi Kleen @ 2012-03-28 18:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: x86, Andi Kleen

From: Andi Kleen <ak@linux.intel.com>

On gccs that support AVX it's a good idea to disable that too, similar to
how SSE2, SSE1 etc. are already disabled. This prevents the compiler
from generating AVX ever implicitely.

No failure observed, just from review.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 arch/x86/Makefile |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 209ba12..2c8aefd 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -113,6 +113,7 @@ KBUILD_CFLAGS += -Wno-sign-compare
 KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
 # prevent gcc from generating any FP code by mistake
 KBUILD_CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,)
+KBUILD_CFLAGS += $(call cc-option,-mno-avx,)
 
 KBUILD_CFLAGS += $(mflags-y)
 KBUILD_AFLAGS += $(mflags-y)
-- 
1.7.7.6


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

* [PATCH 2/2] Add CONFIG_READABLE_ASM
  2012-03-28 18:51 [PATCH 1/2] x86: Use -mno-avx when available Andi Kleen
@ 2012-03-28 18:51 ` Andi Kleen
  2012-03-30 17:41   ` [tip:x86/cleanups] debug: " tip-bot for Andi Kleen
  2012-04-12 19:08   ` [PATCH 2/2] " Geert Uytterhoeven
  2012-03-30 17:16 ` [tip:x86/urgent] x86: Use -mno-avx when available tip-bot for Andi Kleen
  1 sibling, 2 replies; 17+ messages in thread
From: Andi Kleen @ 2012-03-28 18:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: x86, Andi Kleen

From: Andi Kleen <ak@linux.intel.com>

Add a config option to disable various gcc compiler optimizations that
make assembler listings much harder to read. This is everything that reorders
code significantly or creates partial functions.

This is mainly to keep kernel hackers sane.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 Makefile          |   10 ++++++++++
 lib/Kconfig.debug |    9 +++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index 1932984..6f7328b 100644
--- a/Makefile
+++ b/Makefile
@@ -564,6 +564,16 @@ else
 KBUILD_CFLAGS	+= -O2
 endif
 
+ifdef CONFIG_READABLE_ASM
+# Disable optimizations that make assembler listings hard to read.
+# reorder blocks reorders the control in the function
+# ipa clone creates specialized cloned functions
+# partial inlining inlines only parts of functions
+KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \
+                 $(call cc-option,-fno-ipa-cp-clone,) \
+                 $(call cc-option,-fno-partial-inlining)
+endif
+
 include $(srctree)/arch/$(SRCARCH)/Makefile
 
 ifneq ($(CONFIG_FRAME_WARN),0)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index f7af95d..d6102f3 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -70,6 +70,15 @@ config STRIP_ASM_SYMS
 	  that look like '.Lxxx') so they don't pollute the output of
 	  get_wchan() and suchlike.
 
+config READABLE_ASM
+        bool "Generate readable assembler code"
+        depends on DEBUG_KERNEL
+        help
+          Disable some compiler optimizations that tend to generate human unreadable
+          assembler output. This may make the kernel slightly slower, but it helps
+          to keep kernel developers who have to stare a lot at assembler listings
+          sane.
+
 config UNUSED_SYMBOLS
 	bool "Enable unused/obsolete exported symbols"
 	default y if X86
-- 
1.7.7.6


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

* [tip:x86/urgent] x86: Use -mno-avx when available
  2012-03-28 18:51 [PATCH 1/2] x86: Use -mno-avx when available Andi Kleen
  2012-03-28 18:51 ` [PATCH 2/2] Add CONFIG_READABLE_ASM Andi Kleen
@ 2012-03-30 17:16 ` tip-bot for Andi Kleen
  1 sibling, 0 replies; 17+ messages in thread
From: tip-bot for Andi Kleen @ 2012-03-30 17:16 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, ak, stable, tglx

Commit-ID:  c0e9afc0da6cb0f11497e5ea83377b3c451450e0
Gitweb:     http://git.kernel.org/tip/c0e9afc0da6cb0f11497e5ea83377b3c451450e0
Author:     Andi Kleen <ak@linux.intel.com>
AuthorDate: Wed, 28 Mar 2012 11:51:17 -0700
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Fri, 30 Mar 2012 10:06:39 -0700

x86: Use -mno-avx when available

On gccs that support AVX it's a good idea to disable that too, similar to
how SSE2, SSE1 etc. are already disabled. This prevents the compiler
from generating AVX ever implicitely.

No failure observed, just from review.

[ hpa: Marking this for urgent and stable, simply because the patch
  will either have absolutely no effect *or* it will avoid potentially
  very hard to debug failures. ]

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/1332960678-11879-1-git-send-email-andi@firstfloor.org
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: <stable@vger.kernel.org>
---
 arch/x86/Makefile |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 968dbe2..41a7237 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -129,6 +129,7 @@ KBUILD_CFLAGS += -Wno-sign-compare
 KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
 # prevent gcc from generating any FP code by mistake
 KBUILD_CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,)
+KBUILD_CFLAGS += $(call cc-option,-mno-avx,)
 
 KBUILD_CFLAGS += $(mflags-y)
 KBUILD_AFLAGS += $(mflags-y)

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

* [tip:x86/cleanups] debug: Add CONFIG_READABLE_ASM
  2012-03-28 18:51 ` [PATCH 2/2] Add CONFIG_READABLE_ASM Andi Kleen
@ 2012-03-30 17:41   ` tip-bot for Andi Kleen
  2012-04-12 19:08   ` [PATCH 2/2] " Geert Uytterhoeven
  1 sibling, 0 replies; 17+ messages in thread
From: tip-bot for Andi Kleen @ 2012-03-30 17:41 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, ak, tglx

Commit-ID:  1873e870fd63ee4b87dbe0125ca373e420fb4987
Gitweb:     http://git.kernel.org/tip/1873e870fd63ee4b87dbe0125ca373e420fb4987
Author:     Andi Kleen <ak@linux.intel.com>
AuthorDate: Wed, 28 Mar 2012 11:51:18 -0700
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Fri, 30 Mar 2012 10:15:21 -0700

debug: Add CONFIG_READABLE_ASM

Add a config option to disable various gcc compiler optimizations that
make assembler listings much harder to read. This is everything that reorders
code significantly or creates partial functions.

This is mainly to keep kernel hackers sane.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/1332960678-11879-2-git-send-email-andi@firstfloor.org
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 Makefile          |   10 ++++++++++
 lib/Kconfig.debug |    9 +++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index 1932984..6f7328b 100644
--- a/Makefile
+++ b/Makefile
@@ -564,6 +564,16 @@ else
 KBUILD_CFLAGS	+= -O2
 endif
 
+ifdef CONFIG_READABLE_ASM
+# Disable optimizations that make assembler listings hard to read.
+# reorder blocks reorders the control in the function
+# ipa clone creates specialized cloned functions
+# partial inlining inlines only parts of functions
+KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \
+                 $(call cc-option,-fno-ipa-cp-clone,) \
+                 $(call cc-option,-fno-partial-inlining)
+endif
+
 include $(srctree)/arch/$(SRCARCH)/Makefile
 
 ifneq ($(CONFIG_FRAME_WARN),0)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 6777153..4d3cbbb 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -70,6 +70,15 @@ config STRIP_ASM_SYMS
 	  that look like '.Lxxx') so they don't pollute the output of
 	  get_wchan() and suchlike.
 
+config READABLE_ASM
+        bool "Generate readable assembler code"
+        depends on DEBUG_KERNEL
+        help
+          Disable some compiler optimizations that tend to generate human unreadable
+          assembler output. This may make the kernel slightly slower, but it helps
+          to keep kernel developers who have to stare a lot at assembler listings
+          sane.
+
 config UNUSED_SYMBOLS
 	bool "Enable unused/obsolete exported symbols"
 	default y if X86

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

* Re: [PATCH 2/2] Add CONFIG_READABLE_ASM
  2012-03-28 18:51 ` [PATCH 2/2] Add CONFIG_READABLE_ASM Andi Kleen
  2012-03-30 17:41   ` [tip:x86/cleanups] debug: " tip-bot for Andi Kleen
@ 2012-04-12 19:08   ` Geert Uytterhoeven
  2012-04-12 19:36     ` H. Peter Anvin
  2012-04-12 19:40     ` Sam Ravnborg
  1 sibling, 2 replies; 17+ messages in thread
From: Geert Uytterhoeven @ 2012-04-12 19:08 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-kernel, linux-kbuild, x86, Andi Kleen

Hi Andi,

On Wed, Mar 28, 2012 at 20:51, Andi Kleen <andi@firstfloor.org> wrote:
> +ifdef CONFIG_READABLE_ASM
> +# Disable optimizations that make assembler listings hard to read.
> +# reorder blocks reorders the control in the function
> +# ipa clone creates specialized cloned functions
> +# partial inlining inlines only parts of functions
> +KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \
> +                 $(call cc-option,-fno-ipa-cp-clone,) \
> +                 $(call cc-option,-fno-partial-inlining)
> +endif

This (now in linux-next) causes m68k/allmodconfig to fail for me:

  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      kernel/bounds.s
cc1: error: unrecognized command line option "-fno-ipa-cp-clone"

Somehow, "$(call cc-option,-fno-ipa-cp-clone,)" doesn't detect that my
toolchain (gcc version 4.1.2 20061115 (prerelease) (Ubuntu 4.1.1-21))
doesn't support this option.

I tried playing with the trailing comma (why do the first 2 tests have it,
and the 3rd one doesn't?), but that didn't make a difference.

linux-next builds (using a newer toolchain) don't show this.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 2/2] Add CONFIG_READABLE_ASM
  2012-04-12 19:08   ` [PATCH 2/2] " Geert Uytterhoeven
@ 2012-04-12 19:36     ` H. Peter Anvin
  2012-04-12 19:42       ` Geert Uytterhoeven
  2012-04-12 19:40     ` Sam Ravnborg
  1 sibling, 1 reply; 17+ messages in thread
From: H. Peter Anvin @ 2012-04-12 19:36 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Andi Kleen, linux-kernel, linux-kbuild, x86, Andi Kleen

On 04/12/2012 12:08 PM, Geert Uytterhoeven wrote:
> Hi Andi,
> 
> On Wed, Mar 28, 2012 at 20:51, Andi Kleen <andi@firstfloor.org> wrote:
>> +ifdef CONFIG_READABLE_ASM
>> +# Disable optimizations that make assembler listings hard to read.
>> +# reorder blocks reorders the control in the function
>> +# ipa clone creates specialized cloned functions
>> +# partial inlining inlines only parts of functions
>> +KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \
>> +                 $(call cc-option,-fno-ipa-cp-clone,) \
>> +                 $(call cc-option,-fno-partial-inlining)
>> +endif
> 
> This (now in linux-next) causes m68k/allmodconfig to fail for me:
> 
>   CHK     include/linux/version.h
>   CHK     include/generated/utsrelease.h
>   CC      kernel/bounds.s
> cc1: error: unrecognized command line option "-fno-ipa-cp-clone"
> 
> Somehow, "$(call cc-option,-fno-ipa-cp-clone,)" doesn't detect that my
> toolchain (gcc version 4.1.2 20061115 (prerelease) (Ubuntu 4.1.1-21))
> doesn't support this option.
> 
> I tried playing with the trailing comma (why do the first 2 tests have it,
> and the 3rd one doesn't?), but that didn't make a difference.
> 
> linux-next builds (using a newer toolchain) don't show this.
> 

Sounds like the fundamental action item is to find out what makes
cc-option not work.

	-hpa

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

* Re: [PATCH 2/2] Add CONFIG_READABLE_ASM
  2012-04-12 19:08   ` [PATCH 2/2] " Geert Uytterhoeven
  2012-04-12 19:36     ` H. Peter Anvin
@ 2012-04-12 19:40     ` Sam Ravnborg
  2012-04-12 19:47       ` Geert Uytterhoeven
  1 sibling, 1 reply; 17+ messages in thread
From: Sam Ravnborg @ 2012-04-12 19:40 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Andi Kleen, linux-kernel, linux-kbuild, x86, Andi Kleen

On Thu, Apr 12, 2012 at 09:08:36PM +0200, Geert Uytterhoeven wrote:
> Hi Andi,
> 
> On Wed, Mar 28, 2012 at 20:51, Andi Kleen <andi@firstfloor.org> wrote:
> > +ifdef CONFIG_READABLE_ASM
> > +# Disable optimizations that make assembler listings hard to read.
> > +# reorder blocks reorders the control in the function
> > +# ipa clone creates specialized cloned functions
> > +# partial inlining inlines only parts of functions
> > +KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \
> > +                 $(call cc-option,-fno-ipa-cp-clone,) \
> > +                 $(call cc-option,-fno-partial-inlining)
> > +endif

Could people move to this century and drop these ugly "\" line-continuations please...
People seems to get along in C without but think they should be used in Makefiles..

 
> This (now in linux-next) causes m68k/allmodconfig to fail for me:
> 
>   CHK     include/linux/version.h
>   CHK     include/generated/utsrelease.h
>   CC      kernel/bounds.s
> cc1: error: unrecognized command line option "-fno-ipa-cp-clone"
> 
> Somehow, "$(call cc-option,-fno-ipa-cp-clone,)" doesn't detect that my
> toolchain (gcc version 4.1.2 20061115 (prerelease) (Ubuntu 4.1.1-21))
> doesn't support this option.
> 
> I tried playing with the trailing comma (why do the first 2 tests have it,
> and the 3rd one doesn't?), but that didn't make a difference.
The trailing comma does not have any affect - it is only ugly and should be dropped.
You should try cc-diasable-warning like this:

KBUILD_CFLAGS += $(call cc-disable-warning, ipa-cp-clone)

from Documentation/kbuild/makefiles.txt:

    cc-disable-warning
        cc-disable-warning checks if gcc supports a given warning and returns
        the commandline switch to disable it. This special function is needed,
        because gcc 4.4 and later accept any unknown -Wno-* option and only
        warn about it if there is another warning in the source file.

        Example:
                KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)

        In the above example, -Wno-unused-but-set-variable will be added to
        KBUILD_CFLAGS only if gcc really accepts it.


The documentation refer to gcc 4.4 - but maybe the older gcc you have
has the same behaviour.

		Sam

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

* Re: [PATCH 2/2] Add CONFIG_READABLE_ASM
  2012-04-12 19:36     ` H. Peter Anvin
@ 2012-04-12 19:42       ` Geert Uytterhoeven
  0 siblings, 0 replies; 17+ messages in thread
From: Geert Uytterhoeven @ 2012-04-12 19:42 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Andi Kleen, linux-kernel, linux-kbuild, x86, Andi Kleen

On Thu, Apr 12, 2012 at 21:36, H. Peter Anvin <hpa@kernel.org> wrote:
> On 04/12/2012 12:08 PM, Geert Uytterhoeven wrote:
>> On Wed, Mar 28, 2012 at 20:51, Andi Kleen <andi@firstfloor.org> wrote:
>>> +ifdef CONFIG_READABLE_ASM
>>> +# Disable optimizations that make assembler listings hard to read.
>>> +# reorder blocks reorders the control in the function
>>> +# ipa clone creates specialized cloned functions
>>> +# partial inlining inlines only parts of functions
>>> +KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \
>>> +                 $(call cc-option,-fno-ipa-cp-clone,) \
>>> +                 $(call cc-option,-fno-partial-inlining)
>>> +endif
>>
>> This (now in linux-next) causes m68k/allmodconfig to fail for me:
>>
>>   CHK     include/linux/version.h
>>   CHK     include/generated/utsrelease.h
>>   CC      kernel/bounds.s
>> cc1: error: unrecognized command line option "-fno-ipa-cp-clone"
>>
>> Somehow, "$(call cc-option,-fno-ipa-cp-clone,)" doesn't detect that my
>> toolchain (gcc version 4.1.2 20061115 (prerelease) (Ubuntu 4.1.1-21))
>> doesn't support this option.
>>
>> I tried playing with the trailing comma (why do the first 2 tests have it,
>> and the 3rd one doesn't?), but that didn't make a difference.
>>
>> linux-next builds (using a newer toolchain) don't show this.
>>
>
> Sounds like the fundamental action item is to find out what makes
> cc-option not work.

FWIW, it did detect that:
  - -fno-reorder-blocks is supported,
  - -fno-partial-inlining is not supported.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 2/2] Add CONFIG_READABLE_ASM
  2012-04-12 19:40     ` Sam Ravnborg
@ 2012-04-12 19:47       ` Geert Uytterhoeven
  2012-04-12 19:52         ` Sam Ravnborg
  2012-04-12 19:57         ` Andi Kleen
  0 siblings, 2 replies; 17+ messages in thread
From: Geert Uytterhoeven @ 2012-04-12 19:47 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Andi Kleen, linux-kernel, linux-kbuild, x86, Andi Kleen

Hi Sam,

On Thu, Apr 12, 2012 at 21:40, Sam Ravnborg <sam@ravnborg.org> wrote:
> On Thu, Apr 12, 2012 at 09:08:36PM +0200, Geert Uytterhoeven wrote:
>> On Wed, Mar 28, 2012 at 20:51, Andi Kleen <andi@firstfloor.org> wrote:
>> > +ifdef CONFIG_READABLE_ASM
>> > +# Disable optimizations that make assembler listings hard to read.
>> > +# reorder blocks reorders the control in the function
>> > +# ipa clone creates specialized cloned functions
>> > +# partial inlining inlines only parts of functions
>> > +KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \
>> > +                 $(call cc-option,-fno-ipa-cp-clone,) \
>> > +                 $(call cc-option,-fno-partial-inlining)
>> > +endif
>
> Could people move to this century and drop these ugly "\" line-continuations please...
> People seems to get along in C without but think they should be used in Makefiles..

Not without an additional patch for make:

Makefile:575: *** missing separator (did you mean TAB instead of 8
spaces?).  Stop.

>> cc1: error: unrecognized command line option "-fno-ipa-cp-clone"
>>
>> Somehow, "$(call cc-option,-fno-ipa-cp-clone,)" doesn't detect that my
>> toolchain (gcc version 4.1.2 20061115 (prerelease) (Ubuntu 4.1.1-21))
>> doesn't support this option.

> You should try cc-diasable-warning like this:
>
> KBUILD_CFLAGS += $(call cc-disable-warning, ipa-cp-clone)

That works, thanks!
Andi, does it still work as expected for you?

> from Documentation/kbuild/makefiles.txt:
>
>    cc-disable-warning
>        cc-disable-warning checks if gcc supports a given warning and returns
>        the commandline switch to disable it. This special function is needed,
>        because gcc 4.4 and later accept any unknown -Wno-* option and only
>        warn about it if there is another warning in the source file.
>
>        Example:
>                KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
>
>        In the above example, -Wno-unused-but-set-variable will be added to
>        KBUILD_CFLAGS only if gcc really accepts it.
>
>
> The documentation refer to gcc 4.4 - but maybe the older gcc you have
> has the same behaviour.

Seems to be that case. Thx!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 2/2] Add CONFIG_READABLE_ASM
  2012-04-12 19:47       ` Geert Uytterhoeven
@ 2012-04-12 19:52         ` Sam Ravnborg
  2012-04-12 19:57         ` Andi Kleen
  1 sibling, 0 replies; 17+ messages in thread
From: Sam Ravnborg @ 2012-04-12 19:52 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Andi Kleen, linux-kernel, linux-kbuild, x86, Andi Kleen

On Thu, Apr 12, 2012 at 09:47:19PM +0200, Geert Uytterhoeven wrote:
> Hi Sam,
> 
> On Thu, Apr 12, 2012 at 21:40, Sam Ravnborg <sam@ravnborg.org> wrote:
> > On Thu, Apr 12, 2012 at 09:08:36PM +0200, Geert Uytterhoeven wrote:
> >> On Wed, Mar 28, 2012 at 20:51, Andi Kleen <andi@firstfloor.org> wrote:
> >> > +ifdef CONFIG_READABLE_ASM
> >> > +# Disable optimizations that make assembler listings hard to read.
> >> > +# reorder blocks reorders the control in the function
> >> > +# ipa clone creates specialized cloned functions
> >> > +# partial inlining inlines only parts of functions
> >> > +KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \
> >> > +                 $(call cc-option,-fno-ipa-cp-clone,) \
> >> > +                 $(call cc-option,-fno-partial-inlining)
> >> > +endif
> >
> > Could people move to this century and drop these ugly "\" line-continuations please...
> > People seems to get along in C without but think they should be used in Makefiles..
> 
> Not without an additional patch for make:
> 
> Makefile:575: *** missing separator (did you mean TAB instead of 8
> spaces?).  Stop.

I meant like this:

KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks)
KBUILD_CFLAGS += $(call cc-disable-warning,-fno-ipa-cp-clone)
KBUILD_CFLAGS += $(call cc-option,-fno-partial-inlining)

	Sam

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

* Re: [PATCH 2/2] Add CONFIG_READABLE_ASM
  2012-04-12 19:47       ` Geert Uytterhoeven
  2012-04-12 19:52         ` Sam Ravnborg
@ 2012-04-12 19:57         ` Andi Kleen
  2012-04-12 20:07           ` Sam Ravnborg
  1 sibling, 1 reply; 17+ messages in thread
From: Andi Kleen @ 2012-04-12 19:57 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Sam Ravnborg, Andi Kleen, linux-kernel, linux-kbuild, x86


>> You should try cc-diasable-warning like this:
>>
>> KBUILD_CFLAGS += $(call cc-disable-warning, ipa-cp-clone)
> That works, thanks!
> Andi, does it still work as expected for you?

No, unfortunately it doesn't enable the flag with my compiler.
Also BTW ipa-cp-clone is not a warning, it's an optimization pass.

Sam any other ideas?

-Andi


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

* Re: [PATCH 2/2] Add CONFIG_READABLE_ASM
  2012-04-12 19:57         ` Andi Kleen
@ 2012-04-12 20:07           ` Sam Ravnborg
  2012-04-12 20:17             ` Geert Uytterhoeven
  0 siblings, 1 reply; 17+ messages in thread
From: Sam Ravnborg @ 2012-04-12 20:07 UTC (permalink / raw)
  To: Andi Kleen
  Cc: Geert Uytterhoeven, Andi Kleen, linux-kernel, linux-kbuild, x86

On Thu, Apr 12, 2012 at 12:57:57PM -0700, Andi Kleen wrote:
>
>>> You should try cc-diasable-warning like this:
>>>
>>> KBUILD_CFLAGS += $(call cc-disable-warning, ipa-cp-clone)
>> That works, thanks!
>> Andi, does it still work as expected for you?
>
> No, unfortunately it doesn't enable the flag with my compiler.
> Also BTW ipa-cp-clone is not a warning, it's an optimization pass.

Yeah I see now.
cc-disable-warning only works on warnings - which starts with -W

Could you try this:

cc-disable-opt = $(call try-run,\
        $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -f$(strip $(1)) -c -xc /dev/null -o "$$TMP",-fno-$(strip $(1)))

KBUILD_CFLAGS += $(call cc-disable-opt, ipa-cp-clone)


It will try if "gcc -fipa-cp-clone" is supported,
and add -fno-ipa-cp-clone in that case.

	Sam


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

* Re: [PATCH 2/2] Add CONFIG_READABLE_ASM
  2012-04-12 20:07           ` Sam Ravnborg
@ 2012-04-12 20:17             ` Geert Uytterhoeven
  2012-04-12 20:35               ` Sam Ravnborg
  0 siblings, 1 reply; 17+ messages in thread
From: Geert Uytterhoeven @ 2012-04-12 20:17 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Andi Kleen, Andi Kleen, linux-kernel, linux-kbuild, x86

Hi Sam,

On Thu, Apr 12, 2012 at 22:07, Sam Ravnborg <sam@ravnborg.org> wrote:
> Could you try this:
>
> cc-disable-opt = $(call try-run,\
>        $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -f$(strip $(1)) -c -xc /dev/null -o "$TMP",-fno-$(strip $(1)))
>
> KBUILD_CFLAGS += $(call cc-disable-opt, ipa-cp-clone)
>
>
> It will try if "gcc -fipa-cp-clone" is supported,
> and add -fno-ipa-cp-clone in that case.

Unfortunately not:

m68k-linux-gnu-gcc -Wp,-MD,kernel/.bounds.s.d  -nostdinc -isystem
/usr/lib/gcc/m68k-linux-gnu/4.1.2/include
-I/scratch/geert/linux/linux-next/arch/m68k/include
Iarch/m68k/include/generated -Iinclude  -include
/scratch/geert/linux/linux-next/include/linux/kconfig.h -D__KERNEL__
-Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -Werror-implicit-function-declaration -Wno-format-security
-fno-delete-null-pointer-checks -Os -fno-reorder-blocks
-fno-ipa-cp-clone -pipe -fno-strength-reduce -ffixed-a2
-fno-omit-frame-pointer -fno-optimize-sibling-calls -g
-D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(bounds)"
-D"KBUILD_MODNAME=KBUILD_STR(bounds)" -fverbose-asm -S -o
kernel/bounds.s kernel/bounds.c
cc1: error: unrecognized command line option "-fno-ipa-cp-clone"
make[1]: *** [kernel/bounds.s] Error 1
make: *** [prepare0] Error 2

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 2/2] Add CONFIG_READABLE_ASM
  2012-04-12 20:17             ` Geert Uytterhoeven
@ 2012-04-12 20:35               ` Sam Ravnborg
  2012-05-08 19:36                 ` Geert Uytterhoeven
  0 siblings, 1 reply; 17+ messages in thread
From: Sam Ravnborg @ 2012-04-12 20:35 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Andi Kleen, Andi Kleen, linux-kernel, linux-kbuild, x86

On Thu, Apr 12, 2012 at 10:17:07PM +0200, Geert Uytterhoeven wrote:
> Hi Sam,
> 
> On Thu, Apr 12, 2012 at 22:07, Sam Ravnborg <sam@ravnborg.org> wrote:
> > Could you try this:
> >
> > cc-disable-opt = $(call try-run,\
> >        $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -f$(strip $(1)) -c -xc /dev/null -o "$TMP",-fno-$(strip $(1)))
> >
> > KBUILD_CFLAGS += $(call cc-disable-opt, ipa-cp-clone)
> >
> >
> > It will try if "gcc -fipa-cp-clone" is supported,
> > and add -fno-ipa-cp-clone in that case.
> 
> Unfortunately not:
> 
> m68k-linux-gnu-gcc -Wp,-MD,kernel/.bounds.s.d  -nostdinc -isystem
> /usr/lib/gcc/m68k-linux-gnu/4.1.2/include
> -I/scratch/geert/linux/linux-next/arch/m68k/include
> Iarch/m68k/include/generated -Iinclude  -include
> /scratch/geert/linux/linux-next/include/linux/kconfig.h -D__KERNEL__
> -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
> -fno-common -Werror-implicit-function-declaration -Wno-format-security
> -fno-delete-null-pointer-checks -Os -fno-reorder-blocks
> -fno-ipa-cp-clone -pipe -fno-strength-reduce -ffixed-a2
> -fno-omit-frame-pointer -fno-optimize-sibling-calls -g
> -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(bounds)"
> -D"KBUILD_MODNAME=KBUILD_STR(bounds)" -fverbose-asm -S -o
> kernel/bounds.s kernel/bounds.c
> cc1: error: unrecognized command line option "-fno-ipa-cp-clone"
> make[1]: *** [kernel/bounds.s] Error 1
> make: *** [prepare0] Error 2

So with the above command-line gcc fails with an exit code for -fno-ipa-cp-clone.
But with cc-option it does not.

Can you dig out the command-line used for cc-option?
We may be able to analyze why it fails in the above case, but
not with cc-option.

I wonder if we hit something strange due to the fact that we
are assigning to KBUILD_CFLAGS and we reference the same variable.

But that does not explain why the others work.

	Sam

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

* Re: [PATCH 2/2] Add CONFIG_READABLE_ASM
  2012-04-12 20:35               ` Sam Ravnborg
@ 2012-05-08 19:36                 ` Geert Uytterhoeven
  2012-05-12 20:23                   ` Geert Uytterhoeven
  0 siblings, 1 reply; 17+ messages in thread
From: Geert Uytterhoeven @ 2012-05-08 19:36 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Andi Kleen, Andi Kleen, linux-kernel, linux-kbuild, x86

On Thu, Apr 12, 2012 at 10:35 PM, Sam Ravnborg <sam@ravnborg.org> wrote:
> On Thu, Apr 12, 2012 at 10:17:07PM +0200, Geert Uytterhoeven wrote:
>> On Thu, Apr 12, 2012 at 22:07, Sam Ravnborg <sam@ravnborg.org> wrote:
>> > Could you try this:
>> >
>> > cc-disable-opt = $(call try-run,\
>> >        $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -f$(strip $(1)) -c -xc /dev/null -o "$TMP",-fno-$(strip $(1)))
>> >
>> > KBUILD_CFLAGS += $(call cc-disable-opt, ipa-cp-clone)
>> >
>> >
>> > It will try if "gcc -fipa-cp-clone" is supported,
>> > and add -fno-ipa-cp-clone in that case.
>>
>> Unfortunately not:
>>
>> m68k-linux-gnu-gcc -Wp,-MD,kernel/.bounds.s.d  -nostdinc -isystem
>> /usr/lib/gcc/m68k-linux-gnu/4.1.2/include
>> -I/scratch/geert/linux/linux-next/arch/m68k/include
>> Iarch/m68k/include/generated -Iinclude  -include
>> /scratch/geert/linux/linux-next/include/linux/kconfig.h -D__KERNEL__
>> -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
>> -fno-common -Werror-implicit-function-declaration -Wno-format-security
>> -fno-delete-null-pointer-checks -Os -fno-reorder-blocks
>> -fno-ipa-cp-clone -pipe -fno-strength-reduce -ffixed-a2
>> -fno-omit-frame-pointer -fno-optimize-sibling-calls -g
>> -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(bounds)"
>> -D"KBUILD_MODNAME=KBUILD_STR(bounds)" -fverbose-asm -S -o
>> kernel/bounds.s kernel/bounds.c
>> cc1: error: unrecognized command line option "-fno-ipa-cp-clone"
>> make[1]: *** [kernel/bounds.s] Error 1
>> make: *** [prepare0] Error 2
>
> So with the above command-line gcc fails with an exit code for -fno-ipa-cp-clone.
> But with cc-option it does not.
>
> Can you dig out the command-line used for cc-option?
> We may be able to analyze why it fails in the above case, but
> not with cc-option.

gcc -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs
-fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
-Wno-format-security -fno-delete-null-pointer-checks -Os
-fno-ipa-cp-clone -c -xc /dev/null -o .6376.tmp

So it's running "gcc" instead of "m68k-linux-gnu-gcc".

I used the gmail-damaged patch below to get the command in /tmp/x.

diff --git a/Makefile b/Makefile
index d17a616..0e0cbb9 100644
--- a/Makefile
+++ b/Makefile
@@ -567,7 +567,7 @@ ifdef CONFIG_READABLE_ASM
 # ipa clone creates specialized cloned functions
 # partial inlining inlines only parts of functions
 KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \
-                 $(call cc-option,-fno-ipa-cp-clone,) \
+                 $(call cc-option2,-fno-ipa-cp-clone,) \
                  $(call cc-option,-fno-partial-inlining)
 endif

diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 6a3ee98..41c80bf 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -94,6 +94,16 @@ try-run = $(shell set -e;            \
        fi;                             \
        rm -f "$$TMP" "$$TMPO")

+try-run2 = $(shell set -e;             \
+       TMP="$(TMPOUT).$$$$.tmp";       \
+       TMPO="$(TMPOUT).$$$$.o";        \
+       echo "$(1)" > /tmp/x;           \
+       if ($(1)) >/dev/null 2>&1;      \
+       then echo "$(2)";               \
+       else echo "$(3)";               \
+       fi;                             \
+       rm -f "$$TMP" "$$TMPO")
+
 # as-option
 # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)

@@ -112,6 +122,9 @@ as-instr = $(call try-run,\
 cc-option = $(call try-run,\
        $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -xc
/dev/null -o "$$TMP",$(1),$(2))

+cc-option2 = $(call try-run2,\
+       $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -xc
/dev/null -o "$$TMP",$(1),$(2))
+
 # cc-option-yn
 # Usage: flag := $(call cc-option-yn,-march=winchip-c6)
 cc-option-yn = $(call try-run,\

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 2/2] Add CONFIG_READABLE_ASM
  2012-05-08 19:36                 ` Geert Uytterhoeven
@ 2012-05-12 20:23                   ` Geert Uytterhoeven
  2012-05-12 20:25                     ` Sam Ravnborg
  0 siblings, 1 reply; 17+ messages in thread
From: Geert Uytterhoeven @ 2012-05-12 20:23 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Andi Kleen, Andi Kleen, linux-kernel, linux-kbuild, x86

On Tue, May 8, 2012 at 9:36 PM, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Thu, Apr 12, 2012 at 10:35 PM, Sam Ravnborg <sam@ravnborg.org> wrote:
>> On Thu, Apr 12, 2012 at 10:17:07PM +0200, Geert Uytterhoeven wrote:
>>> On Thu, Apr 12, 2012 at 22:07, Sam Ravnborg <sam@ravnborg.org> wrote:
>>> > Could you try this:
>>> >
>>> > cc-disable-opt = $(call try-run,\
>>> >        $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -f$(strip $(1)) -c -xc /dev/null -o "$TMP",-fno-$(strip $(1)))
>>> >
>>> > KBUILD_CFLAGS += $(call cc-disable-opt, ipa-cp-clone)
>>> >
>>> >
>>> > It will try if "gcc -fipa-cp-clone" is supported,
>>> > and add -fno-ipa-cp-clone in that case.
>>>
>>> Unfortunately not:
>>>
>>> m68k-linux-gnu-gcc -Wp,-MD,kernel/.bounds.s.d  -nostdinc -isystem
>>> /usr/lib/gcc/m68k-linux-gnu/4.1.2/include
>>> -I/scratch/geert/linux/linux-next/arch/m68k/include
>>> Iarch/m68k/include/generated -Iinclude  -include
>>> /scratch/geert/linux/linux-next/include/linux/kconfig.h -D__KERNEL__
>>> -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
>>> -fno-common -Werror-implicit-function-declaration -Wno-format-security
>>> -fno-delete-null-pointer-checks -Os -fno-reorder-blocks
>>> -fno-ipa-cp-clone -pipe -fno-strength-reduce -ffixed-a2
>>> -fno-omit-frame-pointer -fno-optimize-sibling-calls -g
>>> -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(bounds)"
>>> -D"KBUILD_MODNAME=KBUILD_STR(bounds)" -fverbose-asm -S -o
>>> kernel/bounds.s kernel/bounds.c
>>> cc1: error: unrecognized command line option "-fno-ipa-cp-clone"
>>> make[1]: *** [kernel/bounds.s] Error 1
>>> make: *** [prepare0] Error 2
>>
>> So with the above command-line gcc fails with an exit code for -fno-ipa-cp-clone.
>> But with cc-option it does not.
>>
>> Can you dig out the command-line used for cc-option?
>> We may be able to analyze why it fails in the above case, but
>> not with cc-option.
>
> gcc -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs
> -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
> -Wno-format-security -fno-delete-null-pointer-checks -Os
> -fno-ipa-cp-clone -c -xc /dev/null -o .6376.tmp
>
> So it's running "gcc" instead of "m68k-linux-gnu-gcc".

Found it using the patch below to log all try-run invocations:

diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 6a3ee98..12eb839 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -88,6 +88,7 @@ TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword
$(KBUILD_EXTMOD))/)
 try-run = $(shell set -e;              \
        TMP="$(TMPOUT).$$$$.tmp";       \
        TMPO="$(TMPOUT).$$$$.o";        \
+       echo "$(1)" >> /tmp/x;          \
        if ($(1)) >/dev/null 2>&1;      \
        then echo "$(2)";               \
        else echo "$(3)";               \

| --- a/Makefile
| +++ b/Makefile
| @@ -564,6 +564,16 @@ else
|  KBUILD_CFLAGS  += -O2
|  endif
|
| +ifdef CONFIG_READABLE_ASM
| +# Disable optimizations that make assembler listings hard to read.
| +# reorder blocks reorders the control in the function
| +# ipa clone creates specialized cloned functions
| +# partial inlining inlines only parts of functions
| +KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \
| +                 $(call cc-option,-fno-ipa-cp-clone,) \
| +                 $(call cc-option,-fno-partial-inlining)
| +endif
| +

The above calls cc-option using CC = gcc, as my cross compiler
is only setup in the next line:

| include $(srctree)/arch/$(SRCARCH)/Makefile

This affects all architectures that setup CROSS_COMPILE in their arch/*/Makefile
(blackfin, h8300, m68k, mips, parisc, score, sh, tile, unicore32, xtensa).

Worse, m68k, sh, and xtensa call cc-option in their arch/*/Makefile
before CROSS_COMPILE is setup, causing those checks to be done against
the host compiler when cross-compiling.

Sending out patches, as soon as the (automatic) "git gc" completes...

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 2/2] Add CONFIG_READABLE_ASM
  2012-05-12 20:23                   ` Geert Uytterhoeven
@ 2012-05-12 20:25                     ` Sam Ravnborg
  0 siblings, 0 replies; 17+ messages in thread
From: Sam Ravnborg @ 2012-05-12 20:25 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Andi Kleen, Andi Kleen, linux-kernel, linux-kbuild, x86

On Sat, May 12, 2012 at 10:23:40PM +0200, Geert Uytterhoeven wrote:
> On Tue, May 8, 2012 at 9:36 PM, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Thu, Apr 12, 2012 at 10:35 PM, Sam Ravnborg <sam@ravnborg.org> wrote:
> >> On Thu, Apr 12, 2012 at 10:17:07PM +0200, Geert Uytterhoeven wrote:
> >>> On Thu, Apr 12, 2012 at 22:07, Sam Ravnborg <sam@ravnborg.org> wrote:
> >>> > Could you try this:
> >>> >
> >>> > cc-disable-opt = $(call try-run,\
> >>> >        $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -f$(strip $(1)) -c -xc /dev/null -o "$TMP",-fno-$(strip $(1)))
> >>> >
> >>> > KBUILD_CFLAGS += $(call cc-disable-opt, ipa-cp-clone)
> >>> >
> >>> >
> >>> > It will try if "gcc -fipa-cp-clone" is supported,
> >>> > and add -fno-ipa-cp-clone in that case.
> >>>
> >>> Unfortunately not:
> >>>
> >>> m68k-linux-gnu-gcc -Wp,-MD,kernel/.bounds.s.d  -nostdinc -isystem
> >>> /usr/lib/gcc/m68k-linux-gnu/4.1.2/include
> >>> -I/scratch/geert/linux/linux-next/arch/m68k/include
> >>> Iarch/m68k/include/generated -Iinclude  -include
> >>> /scratch/geert/linux/linux-next/include/linux/kconfig.h -D__KERNEL__
> >>> -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
> >>> -fno-common -Werror-implicit-function-declaration -Wno-format-security
> >>> -fno-delete-null-pointer-checks -Os -fno-reorder-blocks
> >>> -fno-ipa-cp-clone -pipe -fno-strength-reduce -ffixed-a2
> >>> -fno-omit-frame-pointer -fno-optimize-sibling-calls -g
> >>> -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(bounds)"
> >>> -D"KBUILD_MODNAME=KBUILD_STR(bounds)" -fverbose-asm -S -o
> >>> kernel/bounds.s kernel/bounds.c
> >>> cc1: error: unrecognized command line option "-fno-ipa-cp-clone"
> >>> make[1]: *** [kernel/bounds.s] Error 1
> >>> make: *** [prepare0] Error 2
> >>
> >> So with the above command-line gcc fails with an exit code for -fno-ipa-cp-clone.
> >> But with cc-option it does not.
> >>
> >> Can you dig out the command-line used for cc-option?
> >> We may be able to analyze why it fails in the above case, but
> >> not with cc-option.
> >
> > gcc -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs
> > -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
> > -Wno-format-security -fno-delete-null-pointer-checks -Os
> > -fno-ipa-cp-clone -c -xc /dev/null -o .6376.tmp
> >
> > So it's running "gcc" instead of "m68k-linux-gnu-gcc".
> 
> Found it using the patch below to log all try-run invocations:
> 
> diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
> index 6a3ee98..12eb839 100644
> --- a/scripts/Kbuild.include
> +++ b/scripts/Kbuild.include
> @@ -88,6 +88,7 @@ TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword
> $(KBUILD_EXTMOD))/)
>  try-run = $(shell set -e;              \
>         TMP="$(TMPOUT).$$$$.tmp";       \
>         TMPO="$(TMPOUT).$$$$.o";        \
> +       echo "$(1)" >> /tmp/x;          \
>         if ($(1)) >/dev/null 2>&1;      \
>         then echo "$(2)";               \
>         else echo "$(3)";               \
> 
> | --- a/Makefile
> | +++ b/Makefile
> | @@ -564,6 +564,16 @@ else
> |  KBUILD_CFLAGS  += -O2
> |  endif
> |
> | +ifdef CONFIG_READABLE_ASM
> | +# Disable optimizations that make assembler listings hard to read.
> | +# reorder blocks reorders the control in the function
> | +# ipa clone creates specialized cloned functions
> | +# partial inlining inlines only parts of functions
> | +KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \
> | +                 $(call cc-option,-fno-ipa-cp-clone,) \
> | +                 $(call cc-option,-fno-partial-inlining)
> | +endif
> | +
> 
> The above calls cc-option using CC = gcc, as my cross compiler
> is only setup in the next line:
> 
> | include $(srctree)/arch/$(SRCARCH)/Makefile
> 
> This affects all architectures that setup CROSS_COMPILE in their arch/*/Makefile
> (blackfin, h8300, m68k, mips, parisc, score, sh, tile, unicore32, xtensa).
> 
> Worse, m68k, sh, and xtensa call cc-option in their arch/*/Makefile
> before CROSS_COMPILE is setup, causing those checks to be done against
> the host compiler when cross-compiling.
> 
> Sending out patches, as soon as the (automatic) "git gc" completes...

I expected something like this - but I got distraced by some sparc32 work and
forgot to return to you.

Great that you found it so we can get this fixed!

	Sam

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

end of thread, other threads:[~2012-05-12 20:26 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-28 18:51 [PATCH 1/2] x86: Use -mno-avx when available Andi Kleen
2012-03-28 18:51 ` [PATCH 2/2] Add CONFIG_READABLE_ASM Andi Kleen
2012-03-30 17:41   ` [tip:x86/cleanups] debug: " tip-bot for Andi Kleen
2012-04-12 19:08   ` [PATCH 2/2] " Geert Uytterhoeven
2012-04-12 19:36     ` H. Peter Anvin
2012-04-12 19:42       ` Geert Uytterhoeven
2012-04-12 19:40     ` Sam Ravnborg
2012-04-12 19:47       ` Geert Uytterhoeven
2012-04-12 19:52         ` Sam Ravnborg
2012-04-12 19:57         ` Andi Kleen
2012-04-12 20:07           ` Sam Ravnborg
2012-04-12 20:17             ` Geert Uytterhoeven
2012-04-12 20:35               ` Sam Ravnborg
2012-05-08 19:36                 ` Geert Uytterhoeven
2012-05-12 20:23                   ` Geert Uytterhoeven
2012-05-12 20:25                     ` Sam Ravnborg
2012-03-30 17:16 ` [tip:x86/urgent] x86: Use -mno-avx when available tip-bot for Andi Kleen

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.