Ticket #9948: configure-ssp-check.patch

File configure-ssp-check.patch, 1.5 KB (added by sqrt2, 6 years ago)

Error when we cannot build with stack protection

  • acinclude.m4

    diff -U2 tor-0.2.4.17-rc/acinclude.m4 tor-0.2.4.17-rc-new/acinclude.m4
    old new  
    4949    tor_saved_CFLAGS="$CFLAGS"
    5050    CFLAGS="$CFLAGS -pedantic -Werror $1"
    51     AC_TRY_COMPILE([], [return 0;],
    52                    [AS_VAR_SET(VAR,yes)],
    53                    [AS_VAR_SET(VAR,no)])
     51    AC_TRY_LINK([], [return 0;],
     52                [AS_VAR_SET(VAR,yes)],
     53                [AS_VAR_SET(VAR,no)])
    5454    CFLAGS="$tor_saved_CFLAGS"
    5555  ])
    5656  if test x$VAR = xyes; then
    5757    CFLAGS="$CFLAGS $1"
     58    TOR_NEW_CFLAGS="$1"
    5859  fi
    5960  AS_VAR_POPDEF([VAR])
  • configure.ac

    diff -U2 tor-0.2.4.17-rc/configure.ac tor-0.2.4.17-rc-new/configure.ac
    old new  
    571571    fi
    572572    TOR_CHECK_CFLAGS(-fstack-protector-all)
     573    if test x$TOR_NEW_CFLAGS != x-fstack-protector-all; then
     574        AC_MSG_ERROR([We tried to build with stack protection but your libc does not provide it. Install libssp or --disable-gcc-hardening.])
     575    fi
    573576    TOR_CHECK_CFLAGS(-Wstack-protector)
    574577    TOR_CHECK_CFLAGS(-fwrapv)