* Re: [PATCH 2/2] Add CONFIG_READABLE_ASM [not found] ` <1332960678-11879-2-git-send-email-andi@firstfloor.org> @ 2012-04-12 19:08 ` Geert Uytterhoeven 2012-04-12 19:36 ` H. Peter Anvin 2012-04-12 19:40 ` Sam Ravnborg 0 siblings, 2 replies; 13+ 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] 13+ messages in thread
* Re: [PATCH 2/2] Add CONFIG_READABLE_ASM 2012-04-12 19:08 ` [PATCH 2/2] Add CONFIG_READABLE_ASM 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; 13+ 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] 13+ 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; 13+ 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] 13+ messages in thread
* Re: [PATCH 2/2] Add CONFIG_READABLE_ASM 2012-04-12 19:08 ` [PATCH 2/2] Add CONFIG_READABLE_ASM 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ messages in thread
end of thread, other threads:[~2012-05-12 20:26 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1332960678-11879-1-git-send-email-andi@firstfloor.org>
[not found] ` <1332960678-11879-2-git-send-email-andi@firstfloor.org>
2012-04-12 19:08 ` [PATCH 2/2] Add CONFIG_READABLE_ASM 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox