Skip to content

Commit 45cbda3

Browse files
committed
_build.sh: enable -fstack-protector-all for linux targets
1 parent e969612 commit 45cbda3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

_build.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,9 +678,14 @@ build_single_target() {
678678

679679
_CPPFLAGS_GLOBAL="${_CPPFLAGS_GLOBAL} -D_FORTIFY_SOURCE=2"
680680

681+
# https://en.wikipedia.org/wiki/Position-independent_code#PIE
681682
_CFLAGS_GLOBAL="${_CFLAGS_GLOBAL} -fPIC"
682683
_CXXFLAGS_GLOBAL="${_CXXFLAGS_GLOBAL} -fPIC"
683684

685+
# https://en.wikipedia.org/wiki/Buffer_overflow_protection
686+
_CFLAGS_GLOBAL="${_CFLAGS_GLOBAL} -fstack-protector-all"
687+
_CXXFLAGS_GLOBAL="${_CXXFLAGS_GLOBAL} -fstack-protector-all"
688+
684689
_LDFLAGS_GLOBAL="${_LDFLAGS_GLOBAL} -Wl,-z,relro,-z,now"
685690
fi
686691

0 commit comments

Comments
 (0)