|
@@ -112,6 +112,9 @@ KBUILD_LDFLAGS += -m elf$(BITS)$(LDEMULATION)
|
|
|
KBUILD_ARFLAGS += --target=elf$(BITS)-$(GNUTARGET)
|
|
|
endif
|
|
|
|
|
|
+cflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard=tls
|
|
|
+cflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard-reg=r2
|
|
|
+
|
|
|
LDFLAGS_vmlinux-y := -Bstatic
|
|
|
LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie
|
|
|
LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y)
|
|
@@ -404,6 +407,13 @@ archclean:
|
|
|
|
|
|
archprepare: checkbin
|
|
|
|
|
|
+ifdef CONFIG_STACKPROTECTOR
|
|
|
+prepare: stack_protector_prepare
|
|
|
+
|
|
|
+stack_protector_prepare: prepare0
|
|
|
+ $(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "TASK_CANARY") print $$3;}' include/generated/asm-offsets.h))
|
|
|
+endif
|
|
|
+
|
|
|
# Use the file '.tmp_gas_check' for binutils tests, as gas won't output
|
|
|
# to stdout and these checks are run even on install targets.
|
|
|
TOUT := .tmp_gas_check
|