Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/4] package/Makefile.in: Do not use CPPFLAGS for hardening options
@ 2018-04-25  6:45 Stefan Sørensen
  2018-04-25  6:45 ` [Buildroot] [PATCH 2/4] package/Makefile.in: Add missing options to LDFLAGS for full RELRO build Stefan Sørensen
                   ` (4 more replies)
  0 siblings, 5 replies; 19+ messages in thread
From: Stefan Sørensen @ 2018-04-25  6:45 UTC (permalink / raw)
  To: buildroot

The hardening options are compiler flags, not pure pre-processor flags, so
put them in CFLAGS, not CPPFLAGS.

This fixes build errors where -D_FORTIFY_SOURCE=2 whas put in CPPFLAGS and
then applied to configure tests which could fail since the required -O2 is
only in CFLAGS.

Signed-off-by: Stefan S?rensen <stefan.sorensen@spectralink.com>
---
 package/Makefile.in | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/package/Makefile.in b/package/Makefile.in
index 4325f7b3a9..d72a5494ab 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -147,29 +147,29 @@ TARGET_CFLAGS_RELRO_FULL = -Wl,-z,now $(TARGET_CFLAGS_RELRO)
 TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS))
 
 ifeq ($(BR2_SSP_REGULAR),y)
-TARGET_CPPFLAGS += -fstack-protector
+TARGET_HARDENED += -fstack-protector
 else ifeq ($(BR2_SSP_STRONG),y)
-TARGET_CPPFLAGS += -fstack-protector-strong
+TARGET_HARDENED += -fstack-protector-strong
 else ifeq ($(BR2_SSP_ALL),y)
-TARGET_CPPFLAGS += -fstack-protector-all
+TARGET_HARDENED += -fstack-protector-all
 endif
 
 ifeq ($(BR2_RELRO_PARTIAL),y)
-TARGET_CPPFLAGS += $(TARGET_CFLAGS_RELRO)
+TARGET_HARDENED += $(TARGET_CFLAGS_RELRO)
 TARGET_LDFLAGS += $(TARGET_CFLAGS_RELRO)
 else ifeq ($(BR2_RELRO_FULL),y)
-TARGET_CPPFLAGS += -fPIE $(TARGET_CFLAGS_RELRO_FULL)
+TARGET_HARDENED += -fPIE $(TARGET_CFLAGS_RELRO_FULL)
 TARGET_LDFLAGS += -pie
 endif
 
 ifeq ($(BR2_FORTIFY_SOURCE_1),y)
-TARGET_CPPFLAGS += -D_FORTIFY_SOURCE=1
+TARGET_HARDENED += -D_FORTIFY_SOURCE=1
 else ifeq ($(BR2_FORTIFY_SOURCE_2),y)
-TARGET_CPPFLAGS += -D_FORTIFY_SOURCE=2
+TARGET_HARDENED += -D_FORTIFY_SOURCE=2
 endif
 
 TARGET_CPPFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-TARGET_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
+TARGET_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) $(TARGET_HARDENED)
 TARGET_CXXFLAGS = $(TARGET_CFLAGS)
 TARGET_FCFLAGS = $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2018-05-03 16:07 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-25  6:45 [Buildroot] [PATCH 1/4] package/Makefile.in: Do not use CPPFLAGS for hardening options Stefan Sørensen
2018-04-25  6:45 ` [Buildroot] [PATCH 2/4] package/Makefile.in: Add missing options to LDFLAGS for full RELRO build Stefan Sørensen
2018-05-01 15:12   ` Matthew Weber
2018-04-25  6:45 ` [Buildroot] [PATCH 3/4] package/Makefile.in: Remove RELRO linker flags from CFLAGS Stefan Sørensen
2018-04-30 17:57   ` Matthew Weber
2018-05-01 15:05     ` Matthew Weber
2018-05-02 21:54     ` Arnout Vandecappelle
2018-05-03 16:07       ` Matthew Weber
2018-04-25  6:45 ` [Buildroot] [PATCH 4/4] package/Makefile.in: Use gcc spec files for PIE build flags Stefan Sørensen
2018-05-01 15:13   ` Matthew Weber
2018-05-01 15:36     ` Matthew Weber
2018-05-02 22:28   ` Arnout Vandecappelle
2018-04-25 12:50 ` [Buildroot] [PATCH 1/4] package/Makefile.in: Do not use CPPFLAGS for hardening options Matthew Weber
2018-04-25 13:08   ` Sørensen, Stefan
2018-04-25 13:12     ` Matthew Weber
2018-04-25 13:25       ` Sørensen, Stefan
2018-04-25 20:57     ` Thomas Petazzoni
2018-04-25 20:30   ` Thomas Petazzoni
2018-04-27 13:09 ` Matthew Weber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox