From 2b16f2384372ff8039a38221c3eb7162dc9091d8 Mon Sep 17 00:00:00 2001
From: Alberto Milone <alberto.milone@canonical.com>
Date: Mon, 7 Oct 2019 16:29:07 +0200
Subject: [PATCH 1/1] Kbuild: disable stack-clash-protection fcf-protection

This adds the extra flags only if gcc supports them.

Fixes LP: #1830961
---
 Kbuild | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Kbuild b/Kbuild
index 1e79d0b..a35f47a 100644
--- a/Kbuild
+++ b/Kbuild
@@ -71,6 +71,9 @@ ifneq ($(wildcard /proc/sgi_uv),)
  EXTRA_CFLAGS += -DNV_CONFIG_X86_UV
 endif
 
+ifeq ($(shell cc -dumpspecs | grep -q no-stack-clash-protection; echo $$?),0)
+ EXTRA_CFLAGS += -fno-stack-clash-protection -fcf-protection=none
+endif
 
 #
 # The conftest.sh script tests various aspects of the target kernel.
-- 
2.20.1

