Skip to content

Commit 30a4ff2

Browse files
committed
_build.sh: enable -fstack-protector-all for linux targets
1 parent 6ee0b06 commit 30a4ff2

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
@@ -686,9 +686,14 @@ build_single_target() {
686686

687687
_CPPFLAGS_GLOBAL="${_CPPFLAGS_GLOBAL} -D_FORTIFY_SOURCE=2"
688688

689+
# https://en.wikipedia.org/wiki/Position-independent_code#PIE
689690
_CFLAGS_GLOBAL="${_CFLAGS_GLOBAL} -fPIC"
690691
_CXXFLAGS_GLOBAL="${_CXXFLAGS_GLOBAL} -fPIC"
691692

693+
# https://en.wikipedia.org/wiki/Buffer_overflow_protection
694+
_CFLAGS_GLOBAL="${_CFLAGS_GLOBAL} -fstack-protector-all"
695+
_CXXFLAGS_GLOBAL="${_CXXFLAGS_GLOBAL} -fstack-protector-all"
696+
692697
_LDFLAGS_GLOBAL="${_LDFLAGS_GLOBAL} -Wl,-z,relro,-z,now"
693698
fi
694699

0 commit comments

Comments
 (0)