@@ -104,6 +104,11 @@ AC_ARG_ENABLE([hardening],
104
104
[ Disable options to frustrate memory corruption exploits] ) ] ,
105
105
[ ] , [ enable_hardening=yes] )
106
106
107
+ AC_ARG_ENABLE ( [ windows-ssp] ,
108
+ [ AS_HELP_STRING ( [ --enable-windows-ssp] ,
109
+ [ Enable building the stack smashing protection on
110
+ Windows. This currently distributing libssp-0.dll.] ) ] )
111
+
107
112
AC_DEFUN ( [ CHECK_CFLAG] , [
108
113
AC_LANG_ASSERT ( C )
109
114
AC_MSG_CHECKING ( [ if $saved_CC supports "$1 "] )
@@ -148,16 +153,26 @@ AS_IF([test "x$enable_hardening" = "xyes"], [
148
153
# Enable read only relocations
149
154
CHECK_LDFLAG([ [ -Wl,-z,relro] ] )
150
155
CHECK_LDFLAG([ [ -Wl,-z,now] ] )
151
- ] )
152
156
153
- # Use stack-protector-strong if available; if not, fallback to
154
- # stack-protector-all which is considered to be overkill
155
- AS_IF ( [ test "x$enable_hardening" = "xyes" -a "x$HOST_OS" != "xwin"] , [
156
- CHECK_CFLAG([ [ -fstack-protector-strong] ] ,
157
- CHECK_CFLAG([ [ -fstack-protector-all] ] ,
158
- AC_MSG_WARN ( [ compiler does not appear to support stack protection] )
157
+ # Windows security flags
158
+ AS_IF ( [ test "x$HOST_OS" = "xwin"] , [
159
+ CHECK_LDFLAG([ [ -Wl,--nxcompat] ] )
160
+ CHECK_LDFLAG([ [ -Wl,--dynamicbase] ] )
161
+ CHECK_LDFLAG([ [ -Wl,--high-entropy-va] ] )
162
+ ] )
163
+
164
+ # Use stack-protector-strong if available; if not, fallback to
165
+ # stack-protector-all which is considered to be overkill
166
+ AS_IF ( [ test "x$enable_windows_ssp" = "xyes" -o "x$HOST_OS" != "xwin"] , [
167
+ CHECK_CFLAG([ [ -fstack-protector-strong] ] ,
168
+ CHECK_CFLAG([ [ -fstack-protector-all] ] ,
169
+ AC_MSG_WARN ( [ compiler does not appear to support stack protection] )
170
+ )
159
171
)
160
- )
172
+ AS_IF ( [ test "x$HOST_OS" = "xwin"] , [
173
+ AC_SEARCH_LIBS ( [ __stack_chk_guard] ,[ ssp] )
174
+ ] )
175
+ ] )
161
176
] )
162
177
163
178
0 commit comments