diff options
author | Kees Cook <keescook@chromium.org> | 2018-02-06 18:37:41 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-02-06 21:32:44 -0500 |
commit | 2bc2f688fdf8808de4f36be563ccdb0bde7c0c54 (patch) | |
tree | 7a3be72336e99a09110442813a37e8b571942f71 /Makefile | |
parent | 2b8383927525d6281cbad1cc70a83d2319eeae47 (diff) |
Makefile: move stack-protector availability out of Kconfig
Various portions of the kernel, especially per-architecture pieces,
need to know if the compiler is building with the stack protector.
This was done in the arch/Kconfig with 'select', but this doesn't
allow a way to do auto-detected compiler support. In preparation for
creating an on-if-available default, move the logic for the definition of
CONFIG_CC_STACKPROTECTOR into the Makefile.
Link: http://lkml.kernel.org/r/1510076320-69931-3-git-send-email-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Tested-by: Laura Abbott <labbott@redhat.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -693,7 +693,7 @@ else | |||
693 | endif | 693 | endif |
694 | endif | 694 | endif |
695 | # Find arch-specific stack protector compiler sanity-checking script. | 695 | # Find arch-specific stack protector compiler sanity-checking script. |
696 | ifdef CONFIG_CC_STACKPROTECTOR | 696 | ifdef stackp-name |
697 | stackp-path := $(srctree)/scripts/gcc-$(SRCARCH)_$(BITS)-has-stack-protector.sh | 697 | stackp-path := $(srctree)/scripts/gcc-$(SRCARCH)_$(BITS)-has-stack-protector.sh |
698 | stackp-check := $(wildcard $(stackp-path)) | 698 | stackp-check := $(wildcard $(stackp-path)) |
699 | # If the wildcard test matches a test script, run it to check functionality. | 699 | # If the wildcard test matches a test script, run it to check functionality. |
@@ -702,6 +702,10 @@ ifdef CONFIG_CC_STACKPROTECTOR | |||
702 | stackp-broken := y | 702 | stackp-broken := y |
703 | endif | 703 | endif |
704 | endif | 704 | endif |
705 | ifndef stackp-broken | ||
706 | # If the stack protector is functional, enable code that depends on it. | ||
707 | KBUILD_CPPFLAGS += -DCONFIG_CC_STACKPROTECTOR | ||
708 | endif | ||
705 | endif | 709 | endif |
706 | KBUILD_CFLAGS += $(stackp-flag) | 710 | KBUILD_CFLAGS += $(stackp-flag) |
707 | 711 | ||