Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752375AbdI0XC7 (ORCPT ); Wed, 27 Sep 2017 19:02:59 -0400 Received: from smtp-out-so.shaw.ca ([64.59.136.138]:53801 "EHLO smtp-out-so.shaw.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752314AbdI0XC6 (ORCPT ); Wed, 27 Sep 2017 19:02:58 -0400 X-Authority-Analysis: v=2.2 cv=B4DJ6KlM c=1 sm=1 tr=0 a=k5HOQ6ZN7M0zyjl8M7O1NA==:117 a=k5HOQ6ZN7M0zyjl8M7O1NA==:17 a=2JCJgTwv5E4A:10 a=Q-fNiiVtAAAA:8 a=Qz8Axy2u3wEdBWQtkPYA:9 a=Fp8MccfUoT0GBdDC_Lng:22 From: Markus Mayer To: Zhang Rui Cc: Markus Mayer , Broadcom Kernel List , Power Management List , Linux Kernel Mailing List Subject: [PATCH 1/3] tools/thermal: tmon: use "-fstack-protector" only if supported Date: Wed, 27 Sep 2017 16:02:35 -0700 Message-Id: <20170927230237.62199-2-code@mmayer.net> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170927230237.62199-1-code@mmayer.net> References: <20170927230237.62199-1-code@mmayer.net> X-CMAE-Envelope: MS4wfDcuxRSYlqMidj0ikuvb6dogUGsP0iqQRt2Oi2AS7Wx7O+lS9krGyJJU257X0t9I0FoeV3N3iScx9RB6KUhfdshlIvmHoJQYy+hV6tZNgMhA2e/ccRz1 K1iRV/aFA/egjS3NwL3vDAMrUA4t7HoofSKagws8HohZHvXrg03UJeWX4YvTunTZcGhSkzoIpvSaJQ7oPnRBeCuy4SwPaf+egYJEecerIwSR4ewEslE6IQV0 0s8SVWZ19hlMhWoh4of8eRu4ae9oo9+J+OdayKZwxxYhAeCzhqNvYG250cRZ2G85BxU/ALnCgSrqWuu3SSBXTfqgN1VwMfcSQEZsxHCcOQ0= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1007 Lines: 32 From: Markus Mayer Most, but not all, toolchains support the "-fstack-protector" flag. We check if the compiler supports the flag before using it. This allows tmon to be compiled for more environments. Signed-off-by: Markus Mayer --- tools/thermal/tmon/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/thermal/tmon/Makefile b/tools/thermal/tmon/Makefile index 3a961e9..5777bc7 100644 --- a/tools/thermal/tmon/Makefile +++ b/tools/thermal/tmon/Makefile @@ -1,8 +1,13 @@ +# We need this for the "cc-option" macro. +include ../../../scripts/Kbuild.include + VERSION = 1.0 BINDIR=usr/bin WARNFLAGS=-Wall -Wshadow -W -Wformat -Wimplicit-function-declaration -Wimplicit-int -CFLAGS+= -O1 ${WARNFLAGS} -fstack-protector +CFLAGS+= -O1 ${WARNFLAGS} +# Add "-fstack-protector" only if toolchain supports it. +CFLAGS+= $(call cc-option,-fstack-protector) CC=$(CROSS_COMPILE)gcc CFLAGS+=-D VERSION=\"$(VERSION)\" -- 2.7.4