lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 2 Aug 2017 09:46:50 -0700
From:   Matthias Kaehlcke <mka@...omium.org>
To:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        "H . Peter Anvin" <hpa@...or.com>,
        Masahiro Yamada <yamada.masahiro@...ionext.com>,
        Michal Marek <mmarek@...e.com>
Cc:     x86@...nel.org, linux-kbuild@...r.kernel.org,
        linux-kernel@...r.kernel.org, dianders@...omium.org,
        Michael Davidson <md@...gle.com>,
        Greg Hackmann <ghackmann@...gle.com>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Stephen Hines <srhines@...gle.com>,
        Kees Cook <keescook@...omium.org>,
        Arnd Bergmann <arnd@...db.de>, Bernhard.Rosenkranzer@...aro.org
Subject: Re: [PATCH 1/2] kbuild: Add macros cc-option-3 and __cc-option-3

El Fri, Jul 21, 2017 at 02:56:56PM -0700 Matthias Kaehlcke ha dit:

> The macro cc-option receives two parameters (the second may be empty). It
> returns the first parameter if it is a valid compiler option, otherwise
> the second one. It is not evaluated if the second parameter is a valid
> compiler option. This seems to be fine in virtually all cases, however
> there are scenarios where the second paramater needs to be evaluated too,
> and an empty value (or a third option) should be returned if it is not
> valid.
> 
> The macro cc-option-3 receives three parameters and returns parameter 1
> or 2 (in this order) if one of them is found to be a valid compiler
> option, and otherwise paramater 3. The macro __cc-option-3 works
> analogously.

Any comment on this?

Thanks

Matthias

> Signed-off-by: Matthias Kaehlcke <mka@...omium.org>
> ---
>  scripts/Kbuild.include | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
> index dd8e2dde0b34..dc83635f2317 100644
> --- a/scripts/Kbuild.include
> +++ b/scripts/Kbuild.include
> @@ -113,6 +113,11 @@ as-instr = $(call try-run,\
>  __cc-option = $(call try-run,\
>  	$(1) -Werror $(2) $(3) -c -x c /dev/null -o "$$TMP",$(3),$(4))
>  
> +# __cc-option-3
> +# Usage: MY_CFLAGS += $(call __cc-option-3,$(CC),$(MY_CFLAGS),\
> +#	-mpreferred-stack-boundary=2,-mstack-alignment=4,)
> +__cc-option-3 = $(call __cc-option,$(1),$(2),$(3),$(call __cc-option,$(1),$(2),$(4),$(5)))
> +
>  # Do not attempt to build with gcc plugins during cc-option tests.
>  # (And this uses delayed resolution so the flags will be up to date.)
>  CC_OPTION_CFLAGS = $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS))
> @@ -123,6 +128,10 @@ CC_OPTION_CFLAGS = $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS))
>  cc-option = $(call __cc-option, $(CC),\
>  	$(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS),$(1),$(2))
>  
> +# cc-option-3
> +# Usage: cflags-y += $(call cc-option-3,-mpreferred-stack-boundary=3,-mstack-alignment=8,)
> +cc-option-3 = $(call cc-option,$(1),$(call cc-option,$(2),$(3)))
> +
>  # hostcc-option
>  # Usage: cflags-y += $(call hostcc-option,-march=winchip-c6,-march=i586)
>  hostcc-option = $(call __cc-option, $(HOSTCC),\

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ