Skip to content

Commit

Permalink
Merge pull request #10 from wolfmcnally/master
Browse files Browse the repository at this point in the history
Add compiler hardening flags.
  • Loading branch information
wolfmcnally committed Aug 16, 2021
2 parents db0c4f8 + 42f46a0 commit 3912165
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 92 deletions.
3 changes: 0 additions & 3 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

/* Define to 1 if you have the `memset' function. */
#undef HAVE_MEMSET

/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H

Expand Down
96 changes: 9 additions & 87 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for bc-sskr 0.2.0.
# Generated by GNU Autoconf 2.69 for bc-sskr 0.3.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -577,8 +577,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bc-sskr'
PACKAGE_TARNAME='bc-sskr'
PACKAGE_VERSION='0.2.0'
PACKAGE_STRING='bc-sskr 0.2.0'
PACKAGE_VERSION='0.3.0'
PACKAGE_STRING='bc-sskr 0.3.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

Expand Down Expand Up @@ -1225,7 +1225,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures bc-sskr 0.2.0 to adapt to many kinds of systems.
\`configure' configures bc-sskr 0.3.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
Expand Down Expand Up @@ -1286,7 +1286,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bc-sskr 0.2.0:";;
short | recursive ) echo "Configuration of bc-sskr 0.3.0:";;
esac
cat <<\_ACEOF
Expand Down Expand Up @@ -1366,7 +1366,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bc-sskr configure 0.2.0
bc-sskr configure 0.3.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -1768,78 +1768,11 @@ $as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno

} # ac_fn_c_find_uintX_t

# ac_fn_c_check_func LINENO FUNC VAR
# ----------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly
ac_fn_c_check_func ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define $2 innocuous_$2
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $2 (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef $2
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $2 ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_$2 || defined __stub___$2
choke me
#endif
int
main ()
{
return $2 ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
eval "$3=yes"
else
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno

} # ac_fn_c_check_func
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by bc-sskr $as_me 0.2.0, which was
It was created by bc-sskr $as_me 0.3.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
Expand Down Expand Up @@ -3827,17 +3760,6 @@ $as_echo "#define malloc rpl_malloc" >>confdefs.h
fi


for ac_func in memset
do :
ac_fn_c_check_func "$LINENO" "memset" "ac_cv_func_memset"
if test "x$ac_cv_func_memset" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_MEMSET 1
_ACEOF

fi
done


ac_config_files="$ac_config_files Makefile src/Makefile test/Makefile"

Expand Down Expand Up @@ -4347,7 +4269,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by bc-sskr $as_me 0.2.0, which was
This file was extended by bc-sskr $as_me 0.3.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -4409,7 +4331,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
bc-sskr config.status 0.2.0
bc-sskr config.status 0.3.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
Expand Down
3 changes: 2 additions & 1 deletion src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ RED=`tput setaf 1`
GREEN=`tput setaf 2`
RESET=`tput sgr0`

CFLAGS += -g -O0
CPPFLAGS += -D_FORTIFY_SOURCE=2
CFLAGS += -O2 -fstack-protector-all
ARFLAGS = rcs

OBJS = encoding.o
Expand Down
3 changes: 2 additions & 1 deletion test/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ RED=`tput setaf 1`
GREEN=`tput setaf 2`
RESET=`tput sgr0`

CFLAGS += -g -O0
CPPFLAGS += -D_FORTIFY_SOURCE=2
CFLAGS += -g -O2 -fstack-protector-all

.PHONY: all
all: test
Expand Down

0 comments on commit 3912165

Please sign in to comment.