From patchwork Wed Sep 27 23:02:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Mayer X-Patchwork-Id: 9975023 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 78E1D60375 for ; Wed, 27 Sep 2017 23:03:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A81D29376 for ; Wed, 27 Sep 2017 23:03:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E0BE29378; Wed, 27 Sep 2017 23:03:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BEA329376 for ; Wed, 27 Sep 2017 23:03:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752333AbdI0XC7 (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 Received: from triton.mmayer.net ([96.48.165.49]) by shaw.ca with SMTP id xLLzdUQYGDJTWxLM0dhtFj; Wed, 27 Sep 2017 17:02:57 -0600 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 Received: by triton.mmayer.net (Postfix, from userid 501) id 3D2892004ED50E; Wed, 27 Sep 2017 16:02:55 -0700 (PDT) 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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)\"