From 352c7ed59422bb588eb8a6ab5ccb2b8f540a2d33 Mon Sep 17 00:00:00 2001 From: Lawrence Nahum Date: Mon, 30 Mar 2020 11:21:24 +0200 Subject: [PATCH 1/2] honor CFLAGS, default to O2 --- configure.ac | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index ac0b70be8..c5750e209 100644 --- a/configure.ac +++ b/configure.ac @@ -10,10 +10,6 @@ AH_TOP([#ifndef LIBWALLYCORE_CONFIG_H AH_BOTTOM([#include "ccan_config.h" #endif /*LIBWALLYCORE_CONFIG_H*/]) -# Remove any optimisation/debug flags from CFLAGS, these are controlled -# only by --enable-debug, in order to only use tested configurations -CFLAGS=`echo $CFLAGS | sed 's/-[Og][0-9]*[ $$]*//'` - LDPATH_VAR=LD_LIBRARY_PATH case $host_os in *darwin*) @@ -144,14 +140,14 @@ if test "x$debug" == "xyes"; then fi else # Optimise and harden if we can - AX_CHECK_COMPILE_FLAG([-O3], [AM_CFLAGS="$AM_CFLAGS -O3"]) + AX_CHECK_COMPILE_FLAG([-O2], [AM_CFLAGS="-O2 $AM_CFLAGS"]) AC_CHECK_DEFINE([_FORTIFY_SOURCE], [], [ AX_CHECK_COMPILE_FLAG([-D_FORTIFY_SOURCE=2], [CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"]) ]) AX_CHECK_COMPILE_FLAG([-fstack-protector-strong], [AM_CFLAGS="$AM_CFLAGS -fstack-protector-strong"]) AX_CHECK_COMPILE_FLAG([-DNDEBUG=1], [AM_CFLAGS="$AM_CFLAGS -DNDEBUG=1"]) - AX_CHECK_LINK_FLAG([-O3], [LDFLAGS="$LDFLAGS -O3"]) + AX_CHECK_LINK_FLAG([-O2], [LDFLAGS="-O2 $LDFLAGS"]) AX_CHECK_LINK_FLAG([-Wl,-z,relro], [LDFLAGS="$LDFLAGS -Wl,-z,relro"]) fi From 1f4cc0cd0fb19849f0a1210420f23bd563919ef1 Mon Sep 17 00:00:00 2001 From: Lawrence Nahum Date: Mon, 30 Mar 2020 12:03:29 +0200 Subject: [PATCH 2/2] patch secp256k1-zkp to use O2 rather than O3 --- src/secp256k1/configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/secp256k1/configure.ac b/src/secp256k1/configure.ac index 6dfff78e0..ff384df2a 100644 --- a/src/secp256k1/configure.ac +++ b/src/secp256k1/configure.ac @@ -207,7 +207,7 @@ if test x"$enable_coverage" = x"yes"; then CFLAGS="$CFLAGS -O0 --coverage" LDFLAGS="$LDFLAGS --coverage" else - CFLAGS="$CFLAGS -O3" + CFLAGS="-O2 $CFLAGS" fi AC_MSG_CHECKING([for __builtin_popcount])