summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2019-10-24 14:39:49 +1100
committerDarren Tucker <dtucker@dtucker.net>2019-10-24 14:39:49 +1100
commit9239a18f96905cc1a353e861e33af093652f24e7 (patch)
treeff85cf194358005ccfee2412e7fe010fbde9e7bd /configure.ac
parentb9705393be4612fd5e29d0cd8e7cf2b66ed19eb7 (diff)
Add a function call stackprotector tests.
Including a function call in the test programs for the gcc stack protector flag tests exercises more of the compiler and makes it more likely it'll detect problems.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac14
1 files changed, 10 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac
index 3e93c0276..8bc96bb45 100644
--- a/configure.ac
+++ b/configure.ac
@@ -213,20 +213,26 @@ if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
213 CFLAGS="$CFLAGS $t -Werror" 213 CFLAGS="$CFLAGS $t -Werror"
214 LDFLAGS="$LDFLAGS $t -Werror" 214 LDFLAGS="$LDFLAGS $t -Werror"
215 AC_LINK_IFELSE( 215 AC_LINK_IFELSE(
216 [AC_LANG_PROGRAM([[ #include <stdio.h> ]], 216 [AC_LANG_PROGRAM([[
217 #include <stdio.h>
218 int func (int t) {char b[100]; snprintf(b,sizeof b,"%d",t); return t;}
219 ]],
217 [[ 220 [[
218 char x[256]; 221 char x[256];
219 snprintf(x, sizeof(x), "XXX"); 222 snprintf(x, sizeof(x), "XXX%d", func(1));
220 ]])], 223 ]])],
221 [ AC_MSG_RESULT([yes]) 224 [ AC_MSG_RESULT([yes])
222 CFLAGS="$saved_CFLAGS $t" 225 CFLAGS="$saved_CFLAGS $t"
223 LDFLAGS="$saved_LDFLAGS $t" 226 LDFLAGS="$saved_LDFLAGS $t"
224 AC_MSG_CHECKING([if $t works]) 227 AC_MSG_CHECKING([if $t works])
225 AC_RUN_IFELSE( 228 AC_RUN_IFELSE(
226 [AC_LANG_PROGRAM([[ #include <stdio.h> ]], 229 [AC_LANG_PROGRAM([[
230 #include <stdio.h>
231 int func (int t) {char b[100]; snprintf(b,sizeof b,"%d",t); return t;}
232 ]],
227 [[ 233 [[
228 char x[256]; 234 char x[256];
229 snprintf(x, sizeof(x), "XXX"); 235 snprintf(x, sizeof(x), "XXX%d", func(1));
230 ]])], 236 ]])],
231 [ AC_MSG_RESULT([yes]) 237 [ AC_MSG_RESULT([yes])
232 break ], 238 break ],