On 8/20/19 10:09 AM, Masahiro Yamada wrote:
> arch/arc/Makefile overrides -O2 with -O3. This is the only user of
> ARCH_CFLAGS. There is no user of ARCH_CPPFLAGS or ARCH_AFLAGS.
> My plan is to remove ARCH_{CPP,A,C}FLAGS after refactoring the ARC
> Makefile.
Why, it seems like a good generic facility for arches to over-ride stuff
(specially adding any toggles at the end of cmdline).
And even if there are no current users, it would be good to have. I understand
we
don't keep code for future, but strictly this is meta-code ;-)
> Currently, ARC has no way to enable -Wmaybe-uninitialized because both
> -O3 and -Os disable it. Enabling it will be useful for compile-testing.
> This commit allows allmodconfig (, which defaults to -O2) to enable it.
But this is a separate issue and was done on purpose because of unbearable build
spew at the time. As an experiment I enabled it in current kernel and at -O3 we
still get the dreaded spew in net/sunrpc/xdr.c and some more in net/ipv4. The
spew
doesn't happen at -O2 and seems not ARC specific as I can see this with ARM -O3
build with gcc 7.3 (buildroot 2018.08)
| $ make ARCH=arm CROSS_COMPILE=arm-linux- net
| ..
| ..
| ../net/sunrpc/xdr.c: In function ‘xdr_encode_word’:
| ../net/sunrpc/xdr.c:1199:2: warning: ‘subbuf.tail[0].iov_base’ may be used
| uninitialized in this function [-Wmaybe-uninitialized]
| memcpy(subbuf->tail[0].iov_base, obj, this_len);
| ^~~
| ../net/sunrpc/xdr.c:1205:17: note: ‘subbuf.tail[0].iov_base’ was declared here
| struct xdr_buf subbuf;
I understand the value of this toggle, but the spew is too much and at times
obfuscated likely other real issues.
> Add CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y to all the defconfig files
> in arch/arc/configs/ in order to keep the current config settings.
My first reaction to adding this to all defconfigs was that this was inelegant :
for lack of better word :-)
But indeed it seems better this way as we can now experiment with -O2 vs. -O3
from
config, rather than hardwiring to -O3.
So if you could please split out the Wmaybe-uninitialized change
Acked-by: Vineet Gupta
> Signed-off-by: Masahiro Yamada
> ---
>
> Makefile | 10 ++
> arch/arc/Makefile | 8
> arch/arc/configs/axs101_defconfig | 1 +
> arch/arc/configs/axs103_defconfig | 1 +
> arch/arc/configs/axs103_smp_defconfig | 1 +
> arch/arc/configs/haps_hs_defconfig | 1 +
> arch/arc/configs/haps_hs_smp_defconfig | 1 +
> arch/arc/configs/hsdk_defconfig| 1 +
> arch/arc/configs/nps_defconfig | 1 +
> arch/arc/configs/nsim_700_defconfig| 1 +
> arch/arc/configs/nsim_hs_defconfig | 1 +
> arch/arc/configs/nsim_hs_smp_defconfig | 1 +
> arch/arc/configs/nsimosci_defconfig| 1 +
> arch/arc/configs/nsimosci_hs_defconfig | 1 +
> arch/arc/configs/nsimosci_hs_smp_defconfig | 1 +
> arch/arc/configs/tb10x_defconfig | 1 +
> arch/arc/configs/vdk_hs38_defconfig| 1 +
> arch/arc/configs/vdk_hs38_smp_defconfig| 1 +
> init/Kconfig | 12 ++--
> 19 files changed, 32 insertions(+), 14 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index bc55f366677d..891e47da503f 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -716,10 +716,12 @@ KBUILD_CFLAGS += $(call cc-disable-warning,
> format-truncation)
> KBUILD_CFLAGS+= $(call cc-disable-warning, format-overflow)
> KBUILD_CFLAGS+= $(call cc-disable-warning, address-of-packed-member)
>
> -ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
> -KBUILD_CFLAGS+= -Os
> -else
> -KBUILD_CFLAGS += -O2
> +ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
> +KBUILD_CFLAGS += -O2
> +else ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3
> +KBUILD_CFLAGS += -O3
> +else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
> +KBUILD_CFLAGS += -Os
> endif
>
> ifdef CONFIG_CC_DISABLE_WARN_MAYBE_UNINITIALIZED
> diff --git a/arch/arc/Makefile b/arch/arc/Makefile
> index ee6d1184c2b1..f1c44cccf8d6 100644
> --- a/arch/arc/Makefile
> +++ b/arch/arc/Makefile
> @@ -48,14 +48,6 @@ endif
> cfi := $(call as-instr,.cfi_startproc\n.cfi_endproc,-DARC_DW2_UNWIND_AS_CFI)
> cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables
> $(cfi)
>
> -ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE
> -# Generic build system uses -O2, we want -O3
> -# Note: No need to add to cflags-y as that happens anyways
> -#
> -# Disable the false maybe-uninitialized warings gcc spits out at -O3
> -ARCH_CFLAGS += -O3 $(call cc-disable-warning,maybe-uninitialized,)
> -endif
> -
> # small data is default for elf32 tool-chain. If not usable, disable it
> # This also allows repurposing GP as scratch reg to gcc reg allocator
> disable_small_data := y
> diff --git a/arch/arc/configs/axs101_defconfig
> b/arch/arc/configs/axs101_defconfig
> index e31a8ebc3ecc..0016149f9583 100644