Message ID | 1522128575-5326-16-git-send-email-yamada.masahiro@socionext.com |
---|---|
State | Superseded |
Headers | show |
Series | kconfig: move compiler capability tests to Kconfig | expand |
On 27.03.2018 07:29, Masahiro Yamada wrote: > CONFIG_GCOV_FORMAT_AUTODETECT compiles either gcc_3_4.c or gcc_4_7.c > according to your GCC version. > > We can achieve the equivalent behavior by setting reasonable dependency > with the knowledge of the compiler version. > > If GCC older than 4.7 is used, GCOV_FORMAT_3_4 is the default, but users > are still allowed to select GCOV_FORMAT_4_7 in case the newer format is > back-ported. > > On the other hand, If GCC 4.7 or newer is used, there is no reason to > use GCOV_FORMAT_3_4, so it should be hidden. > > If you down-grade your compiler GCC 4.7 or older, oldconfig/syncconfig > will display a prompt for the choice because GCOV_FORMAT_3_4 becomes > visible as a new symbol. Looks sane to me. Acked-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com> -- Peter Oberparleiter Linux on Z Development - IBM Germany
On Mon, Mar 26, 2018 at 10:29 PM, Masahiro Yamada <yamada.masahiro@socionext.com> wrote: > CONFIG_GCOV_FORMAT_AUTODETECT compiles either gcc_3_4.c or gcc_4_7.c > according to your GCC version. > > We can achieve the equivalent behavior by setting reasonable dependency > with the knowledge of the compiler version. > > If GCC older than 4.7 is used, GCOV_FORMAT_3_4 is the default, but users > are still allowed to select GCOV_FORMAT_4_7 in case the newer format is > back-ported. > > On the other hand, If GCC 4.7 or newer is used, there is no reason to > use GCOV_FORMAT_3_4, so it should be hidden. > > If you down-grade your compiler GCC 4.7 or older, oldconfig/syncconfig > will display a prompt for the choice because GCOV_FORMAT_3_4 becomes > visible as a new symbol. > > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Kees Cook <keescook@chromium.org> -Kees -- Kees Cook Pixel Security
diff --git a/kernel/gcov/Kconfig b/kernel/gcov/Kconfig index 1276aab..1e3823f 100644 --- a/kernel/gcov/Kconfig +++ b/kernel/gcov/Kconfig @@ -53,23 +53,16 @@ config GCOV_PROFILE_ALL choice prompt "Specify GCOV format" depends on GCOV_KERNEL - default GCOV_FORMAT_AUTODETECT ---help--- - The gcov format is usually determined by the GCC version, but there are + The gcov format is usually determined by the GCC version, and the + default is chosen according to your GCC version. However, there are exceptions where format changes are integrated in lower-version GCCs. - In such a case use this option to adjust the format used in the kernel - accordingly. - - If unsure, choose "Autodetect". - -config GCOV_FORMAT_AUTODETECT - bool "Autodetect" - ---help--- - Select this option to use the format that corresponds to your GCC - version. + In such a case, change this option to adjust the format used in the + kernel accordingly. config GCOV_FORMAT_3_4 bool "GCC 3.4 format" + depends on CC_IS_GCC && GCC_VERSION < 40700 ---help--- Select this option to use the format defined by GCC 3.4. diff --git a/kernel/gcov/Makefile b/kernel/gcov/Makefile index c6c50e5..ff06d64 100644 --- a/kernel/gcov/Makefile +++ b/kernel/gcov/Makefile @@ -4,5 +4,3 @@ ccflags-y := -DSRCTREE='"$(srctree)"' -DOBJTREE='"$(objtree)"' obj-y := base.o fs.o obj-$(CONFIG_GCOV_FORMAT_3_4) += gcc_3_4.o obj-$(CONFIG_GCOV_FORMAT_4_7) += gcc_4_7.o -obj-$(CONFIG_GCOV_FORMAT_AUTODETECT) += $(call cc-ifversion, -lt, 0407, \ - gcc_3_4.o, gcc_4_7.o)
CONFIG_GCOV_FORMAT_AUTODETECT compiles either gcc_3_4.c or gcc_4_7.c according to your GCC version. We can achieve the equivalent behavior by setting reasonable dependency with the knowledge of the compiler version. If GCC older than 4.7 is used, GCOV_FORMAT_3_4 is the default, but users are still allowed to select GCOV_FORMAT_4_7 in case the newer format is back-ported. On the other hand, If GCC 4.7 or newer is used, there is no reason to use GCOV_FORMAT_3_4, so it should be hidden. If you down-grade your compiler GCC 4.7 or older, oldconfig/syncconfig will display a prompt for the choice because GCOV_FORMAT_3_4 becomes visible as a new symbol. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> --- Changes in v2: - Move the 'depends on' to the choice value. kernel/gcov/Kconfig | 17 +++++------------ kernel/gcov/Makefile | 2 -- 2 files changed, 5 insertions(+), 14 deletions(-) -- 2.7.4