Skip to content

Commit

Permalink
tools/thermal: tmon: use "-fstack-protector" only if supported
Browse files Browse the repository at this point in the history
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 <mmayer@broadcom.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
  • Loading branch information
Markus Mayer authored and Zhang Rui committed Oct 18, 2017
1 parent 2bd6bf0 commit ec04aa3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/thermal/tmon/Makefile
Original file line number Diff line number Diff line change
@@ -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)\"
Expand Down

0 comments on commit ec04aa3

Please sign in to comment.