[tor-commits] [obfsproxy/master] Don't use compiler flags that break the build

asn at torproject.org asn at torproject.org
Wed May 2 01:39:35 UTC 2012


commit 0feee69e1b2498ebe77f8780191ab1026eafcdec
Author: Sebastian Hahn <sebastian at torproject.org>
Date:   Wed Apr 25 16:15:25 2012 +0200

    Don't use compiler flags that break the build
---
 ChangeLog                |    3 +++
 m4/ax_build_hardening.m4 |   21 +++++++++++----------
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8b99ee9..fd77adb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
 Changes in version 0.1.4 - <not yet released>
  - Fix 'obfsproxy --version' when called outside of a git
    repository. Fixes bug 5560.
+ - Don't use hardening flags if they'd break the compiler. This happens
+   on Windows, for example, where -fPIE causes an error. Fixes bug
+   5665.
  - Fix assertion failure when connecting to a SOCKS destination. Fixes
    bug #5586.
  - Fix crash when parsing obfs2 command line arguments. Fixes bug
diff --git a/m4/ax_build_hardening.m4 b/m4/ax_build_hardening.m4
index 590a00d..ad06fcc 100644
--- a/m4/ax_build_hardening.m4
+++ b/m4/ax_build_hardening.m4
@@ -46,18 +46,19 @@ AC_DEFUN_ONCE([AX_ENABLE_HARDENING], [
 
 ### Compiler Hardening ###
 # This requires ax_check_compile_flag.m4
-AX_CHECK_COMPILE_FLAG([-D_FORTIFY_SOURCE=2], [CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"])
-AX_CHECK_COMPILE_FLAG([-fstack-protector-all], [CFLAGS="$CFLAGS -fstack-protector-all"])
-AX_CHECK_COMPILE_FLAG([-fwrapv], [CFLAGS="$CFLAGS -fwrapv"])
-AX_CHECK_COMPILE_FLAG([-fPIE], [CFLAGS="$CFLAGS -fPIE"])
-AX_CHECK_COMPILE_FLAG([--param ssp-buffer-size=1], [CFLAGS="$CFLAGS --param ssp-buffer-size=1"])
-AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing], [CFLAGS="$CFLAGS -fno-strict-aliasing"])
-AX_CHECK_COMPILE_FLAG([-fno-strict-overflow], [CFLAGS="$CFLAGS -fno-strict-overflow"])
+AX_CHECK_COMPILE_FLAG([-D_FORTIFY_SOURCE=2], [CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"], [], [-Werror])
+AX_CHECK_COMPILE_FLAG([-fstack-protector-all], [CFLAGS="$CFLAGS -fstack-protector-all"], [], [-Werror])
+AX_CHECK_COMPILE_FLAG([-fwrapv], [CFLAGS="$CFLAGS -fwrapv"], [], [-Werror])
+AX_CHECK_COMPILE_FLAG([-fPIE], [CFLAGS="$CFLAGS -fPIE"], [], [-Werror])
+AX_CHECK_COMPILE_FLAG([--param ssp-buffer-size=1], [CFLAGS="$CFLAGS --param ssp-buffer-size=1"], [], [-Werror])
+AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing], [CFLAGS="$CFLAGS -fno-strict-aliasing"], [], [-Werror])
+AX_CHECK_COMPILE_FLAG([-fno-strict-overflow], [CFLAGS="$CFLAGS -fno-strict-overflow"], [], [-Werror])
 
 ### Linker Hardening ###
 # This requires ax_check_link_flag.m4
-AX_CHECK_LINK_FLAG([-pie], [LDFLAGS="$LDFLAGS -pie"])
-AX_CHECK_LINK_FLAG([-z relro], [LDFLAGS="$LDFLAGS -z relro"])
-AX_CHECK_LINK_FLAG([-z now], [LDFLAGS="$LDFLAGS -z now"])
+AX_CHECK_LINK_FLAG([-pie], [LDFLAGS="$LDFLAGS -pie"], [], [-Werror])
+AX_CHECK_LINK_FLAG([-Wl,-pie], [LDFLAGS="$LDFLAGS -Wl,-pie"], [], [-Werror])
+AX_CHECK_LINK_FLAG([-z relro], [LDFLAGS="$LDFLAGS -z relro"], [], [-Werror])
+AX_CHECK_LINK_FLAG([-z now], [LDFLAGS="$LDFLAGS -z now"], [], [-Werror])
 
 ])





More information about the tor-commits mailing list