0001-add-disable-stack-protector-option.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. From 95382246ddd889839633aa0da800a03936b93986 Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Sun, 31 Oct 2021 18:26:01 +0100
  4. Subject: [PATCH] add --disable-stack-protector option
  5. Allow the user to disable stack-protector as not all toolchains support
  6. this feature
  7. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  8. Upstream: https://github.com/fenrus75/powertop/pull/138
  9. ---
  10. configure.ac | 4 ++++
  11. src/Makefile.am | 5 ++++-
  12. 2 files changed, 8 insertions(+), 1 deletion(-)
  13. diff --git a/configure.ac b/configure.ac
  14. index 37c1304..69160d5 100644
  15. --- a/configure.ac
  16. +++ b/configure.ac
  17. @@ -43,6 +43,10 @@ AX_ADD_FORTIFY_SOURCE
  18. AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])
  19. PKG_PROG_PKG_CONFIG
  20. +AC_ARG_ENABLE([stack-protector],
  21. + AS_HELP_STRING([--disable-stack-protector], [Disable stack-protector]))
  22. +AM_CONDITIONAL([ENABLE_STACK_PROTECTOR], [test x$enable_stack_protector != xno])
  23. +
  24. # Checks for libraries.
  25. AX_PTHREAD([
  26. LIBS="$PTHREAD_LIBS $LIBS"
  27. diff --git a/src/Makefile.am b/src/Makefile.am
  28. index 6b523f6..ca30d20 100644
  29. --- a/src/Makefile.am
  30. +++ b/src/Makefile.am
  31. @@ -138,13 +138,16 @@ powertop_CXXFLAGS = \
  32. -Wformat \
  33. -Wshadow \
  34. -fno-omit-frame-pointer \
  35. - -fstack-protector \
  36. $(GLIB2_CFLAGS) \
  37. $(LIBNL_CFLAGS) \
  38. $(NCURSES_CFLAGS) \
  39. $(PCIUTILS_CFLAGS) \
  40. $(PTHREAD_CFLAGS)
  41. +if ENABLE_STACK_PROTECTOR
  42. +powertop_CXXFLAGS += \
  43. + -fstack-protector
  44. +endif
  45. powertop_CPPFLAGS = \
  46. -DLOCALEDIR=\"$(localedir)\" \
  47. --
  48. 2.33.0