aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--circle.yml4
-rwxr-xr-xconfigure.py77
-rw-r--r--src/build-data/buildh.in2
-rw-r--r--src/build-data/makefile/header.in2
-rwxr-xr-xsrc/scripts/ci/circle/clang-shared-debug.sh2
-rwxr-xr-xsrc/scripts/ci/circle/clang-static-debug.sh2
-rwxr-xr-xsrc/scripts/ci/circle/gcc-sanitizer.sh11
-rwxr-xr-xsrc/scripts/ci/circle/gcc-shared-debug.sh2
-rwxr-xr-xsrc/scripts/ci/circle/gcc-static-debug.sh2
-rwxr-xr-xsrc/scripts/ci/travis/build.sh5
-rw-r--r--src/tests/test_ffi.cpp3
11 files changed, 63 insertions, 49 deletions
diff --git a/circle.yml b/circle.yml
index 5355df733..48688eb60 100644
--- a/circle.yml
+++ b/circle.yml
@@ -5,9 +5,9 @@ dependencies:
- wget -q -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
- sudo apt-get update -qq
override:
- - sudo apt-get install g++-4.8 clang-3.6
+ - sudo apt-get install g++-4.9 clang-3.6
post:
- - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 99
+ - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 99
- sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.6 99
- g++ --version
- clang++ --version
diff --git a/configure.py b/configure.py
index 6536f3226..122e493f3 100755
--- a/configure.py
+++ b/configure.py
@@ -260,16 +260,19 @@ def process_command_line(args):
build_group = optparse.OptionGroup(parser, 'Build options')
- build_modes = ['release', 'debug', 'coverage', 'sanitizer']
- build_group.add_option('--build-mode', default='release', metavar='MODE',
- choices=build_modes,
- help="Build mode (one of %s; default %%default)" % (', '.join(build_modes)))
+ build_group.add_option('--with-debug-info', action='store_true', default=False, dest='with_debug_info',
+ help='enable debug info')
+ # For compat and convenience:
+ build_group.add_option('--debug-mode', action='store_true', default=False, dest='with_debug_info',
+ help=optparse.SUPPRESS_HELP)
+
+ build_group.add_option('--with-sanitizers', action='store_true', default=False, dest='with_sanitizers',
+ help='enable runtime checks')
- build_group.add_option('--debug-mode', action='store_const',
- const='debug', dest='build_mode',
- help='enable debugging build')
+ build_group.add_option('--with-coverage', action='store_true', default=False, dest='with_coverage',
+ help='enable coverage checking')
- build_group.add_option('--enable-shared', dest='build_shared_lib',
+ build_group.add_option('--enable-shared-library', dest='build_shared_lib',
action='store_true', default=True,
help=optparse.SUPPRESS_HELP)
build_group.add_option('--disable-shared', dest='build_shared_lib',
@@ -278,7 +281,7 @@ def process_command_line(args):
build_group.add_option('--no-optimizations', dest='no_optimizations',
action='store_true', default=False,
- help=optparse.SUPPRESS_HELP)
+ help='disable all optimizations (for debugging)')
build_group.add_option('--gen-amalgamation', dest='gen_amalgamation',
default=False, action='store_true',
@@ -447,6 +450,9 @@ def process_command_line(args):
options.disable_intrinsics = parse_multiple_enable(options.disable_intrinsics)
+ if options.maintainer_mode:
+ options.with_sanitizers = True
+
return options
"""
@@ -842,7 +848,7 @@ class CompilerInfo(object):
"""
def mach_abi_link_flags(self, options):
def all():
- if 'all-debug' in self.mach_abi_linking and options.build_mode == 'debug':
+ if options.with_debug_info and 'all-debug' in self.mach_abi_linking:
return 'all-debug'
return 'all'
@@ -852,22 +858,24 @@ class CompilerInfo(object):
if flag != None and flag != '' and flag not in abi_link:
abi_link.append(flag)
- abi_flags = ''
- if len(abi_link) > 0:
- abi_flags += ' '.join(sorted(abi_link))
- if options.cc_abi_flags != '':
- abi_flags += ' ' + options.cc_abi_flags
-
- if options.build_mode == 'coverage':
+ if options.with_coverage:
if self.coverage_flags == '':
raise Exception('No coverage handling for %s' % (self.basename))
- return ' ' + self.coverage_flags + ' ' + abi_flags
- elif options.build_mode == 'sanitizer':
+ abi_link.append(self.coverage_flags)
+
+ if options.with_sanitizers:
if self.sanitizer_flags == '':
raise Exception('No sanitizer handling for %s' % (self.basename))
- return ' ' + self.sanitizer_flags + ' ' + abi_flags
+ abi_link.append(self.sanitizer_flags)
- return ' ' + abi_flags
+ abi_flags = ' '.join(sorted(abi_link))
+
+ if options.cc_abi_flags != '':
+ abi_flags += ' ' + options.cc_abi_flags
+
+ if abi_flags != '':
+ return ' ' + abi_flags
+ return ''
def cc_warning_flags(self, options):
def gen_flags():
@@ -881,7 +889,7 @@ class CompilerInfo(object):
def gen_flags():
yield self.lang_flags
- if options.build_mode in ['debug', 'coverage', 'analyzer']:
+ if options.with_debug_info:
yield self.debug_info_flags
if not options.no_optimizations:
@@ -903,16 +911,17 @@ class CompilerInfo(object):
return (' '.join(gen_flags())).strip()
+ def _so_link_search(self, osname, debug_info):
+ if debug_info:
+ return [osname + '-debug', 'default-debug']
+ else:
+ return [osname, 'default']
+
"""
Return the command needed to link a shared object
"""
def so_link_command_for(self, osname, options):
- if options.build_mode == 'debug':
- search_for = [osname + "-debug", 'default-debug']
- else:
- search_for = [osname, 'default']
-
- for s in search_for:
+ for s in self._so_link_search(osname, options.with_debug_info):
if s in self.so_link_commands:
return self.so_link_commands[s]
@@ -923,12 +932,7 @@ class CompilerInfo(object):
Return the command needed to link an app/test object
"""
def binary_link_command_for(self, osname, options):
- if options.build_mode == 'debug':
- search_for = [osname + "-debug", 'default-debug']
- else:
- search_for = [osname, 'default']
-
- for s in search_for:
+ for s in self._so_link_search(osname, options.with_debug_info):
if s in self.binary_link_commands:
return self.binary_link_commands[s]
@@ -1275,7 +1279,8 @@ def create_template_vars(build_config, options, modules, cc, arch, osinfo):
'mp_bits': choose_mp_bits(),
- 'cxx': (options.compiler_binary or cc.binary_name) + cc.mach_abi_link_flags(options),
+ 'cxx': (options.compiler_binary or cc.binary_name),
+ 'cxx_abi_flags': cc.mach_abi_link_flags(options),
'linker': cc.linker_name or '$(CXX)',
'cc_compile_flags': cc.cc_compile_flags(options),
@@ -1357,7 +1362,7 @@ def create_template_vars(build_config, options, modules, cc, arch, osinfo):
vars["gmake_dso_in"] = process_template('src/build-data/makefile/gmake_dso.in', vars) \
if options.build_shared_lib else ''
vars["gmake_coverage_in"] = process_template('src/build-data/makefile/gmake_coverage.in', vars) \
- if options.build_mode == 'coverage' else ''
+ if options.with_coverage else ''
return vars
diff --git a/src/build-data/buildh.in b/src/build-data/buildh.in
index 23bb86e20..31277ff0c 100644
--- a/src/build-data/buildh.in
+++ b/src/build-data/buildh.in
@@ -6,7 +6,7 @@
* %{user}@%{hostname} running '%{command_line}'
*
* Target
-* - Compiler: %{cxx} %{cc_compile_flags}
+* - Compiler: %{cxx} %{cxx_abi_flags} %{cc_compile_flags}
* - Arch: %{submodel}/%{arch}
* - OS: %{os}
*/
diff --git a/src/build-data/makefile/header.in b/src/build-data/makefile/header.in
index 3c4272d05..eaf4b511d 100644
--- a/src/build-data/makefile/header.in
+++ b/src/build-data/makefile/header.in
@@ -1,5 +1,5 @@
# Compiler Options
-CXX = %{cxx}
+CXX = %{cxx} %{cxx_abi_flags}
LINKER = %{linker}
CXXFLAGS = %{cc_compile_flags}
diff --git a/src/scripts/ci/circle/clang-shared-debug.sh b/src/scripts/ci/circle/clang-shared-debug.sh
index 2ef4e6dd5..5f38cad7c 100755
--- a/src/scripts/ci/circle/clang-shared-debug.sh
+++ b/src/scripts/ci/circle/clang-shared-debug.sh
@@ -5,6 +5,6 @@ which shellcheck > /dev/null && shellcheck "$0" # Run shellcheck on this if avai
BUILD_NICKNAME=$(basename "$0" .sh)
BUILD_DIR="./build-$BUILD_NICKNAME"
-./configure.py --with-build-dir="$BUILD_DIR" --build-mode=debug --cc=clang
+./configure.py --with-build-dir="$BUILD_DIR" --with-debug-info --cc=clang
make -j 2 -f "$BUILD_DIR"/Makefile
"$BUILD_DIR"/botan-test
diff --git a/src/scripts/ci/circle/clang-static-debug.sh b/src/scripts/ci/circle/clang-static-debug.sh
index 6341dd467..56f111190 100755
--- a/src/scripts/ci/circle/clang-static-debug.sh
+++ b/src/scripts/ci/circle/clang-static-debug.sh
@@ -5,6 +5,6 @@ which shellcheck > /dev/null && shellcheck "$0" # Run shellcheck on this if avai
BUILD_NICKNAME=$(basename "$0" .sh)
BUILD_DIR="./build-$BUILD_NICKNAME"
-./configure.py --with-build-dir="$BUILD_DIR" --build-mode=debug --cc=clang --disable-shared
+./configure.py --with-build-dir="$BUILD_DIR" --with-debug-info --cc=clang --disable-shared
make -j 2 -f "$BUILD_DIR"/Makefile
"$BUILD_DIR"/botan-test
diff --git a/src/scripts/ci/circle/gcc-sanitizer.sh b/src/scripts/ci/circle/gcc-sanitizer.sh
new file mode 100755
index 000000000..33d474fc6
--- /dev/null
+++ b/src/scripts/ci/circle/gcc-sanitizer.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+set -ev
+which shellcheck > /dev/null && shellcheck "$0" # Run shellcheck on this if available
+
+BUILD_NICKNAME=$(basename "$0" .sh)
+BUILD_DIR="./build-$BUILD_NICKNAME"
+
+# Adding Ubsan here, only added in GCC 4.9
+./configure.py --with-build-dir="$BUILD_DIR" --with-debug-info --with-sanitizer --cc-abi-flags='-fsanitize=undefined'
+make -j 2 -f "$BUILD_DIR"/Makefile
+"$BUILD_DIR"/botan-test
diff --git a/src/scripts/ci/circle/gcc-shared-debug.sh b/src/scripts/ci/circle/gcc-shared-debug.sh
index 93530b8ac..4f5ed1b6d 100755
--- a/src/scripts/ci/circle/gcc-shared-debug.sh
+++ b/src/scripts/ci/circle/gcc-shared-debug.sh
@@ -5,6 +5,6 @@ which shellcheck > /dev/null && shellcheck "$0" # Run shellcheck on this if avai
BUILD_NICKNAME=$(basename "$0" .sh)
BUILD_DIR="./build-$BUILD_NICKNAME"
-./configure.py --with-build-dir="$BUILD_DIR" --build-mode=debug
+./configure.py --with-build-dir="$BUILD_DIR" --with-debug
make -j 2 -f "$BUILD_DIR"/Makefile
"$BUILD_DIR"/botan-test
diff --git a/src/scripts/ci/circle/gcc-static-debug.sh b/src/scripts/ci/circle/gcc-static-debug.sh
index c7d23b9b0..76f4c46b7 100755
--- a/src/scripts/ci/circle/gcc-static-debug.sh
+++ b/src/scripts/ci/circle/gcc-static-debug.sh
@@ -5,6 +5,6 @@ which shellcheck > /dev/null && shellcheck "$0" # Run shellcheck on this if avai
BUILD_NICKNAME=$(basename "$0" .sh)
BUILD_DIR="./build-$BUILD_NICKNAME"
-./configure.py --with-build-dir="$BUILD_DIR" --build-mode=debug --disable-shared --via-amalgamation
+./configure.py --with-build-dir="$BUILD_DIR" --with-debug-info --disable-shared --via-amalgamation
make -j 2 -f "$BUILD_DIR"/Makefile
"$BUILD_DIR"/botan-test
diff --git a/src/scripts/ci/travis/build.sh b/src/scripts/ci/travis/build.sh
index bb52f0648..092e9cbe6 100755
--- a/src/scripts/ci/travis/build.sh
+++ b/src/scripts/ci/travis/build.sh
@@ -7,10 +7,9 @@ if [ "$BUILD_MODE" = "static" ]; then
elif [ "$BUILD_MODE" = "shared" ]; then
CFG_FLAGS=()
elif [ "$BUILD_MODE" = "coverage" ]; then
- # lcov gets confused by symlinks
- CFG_FLAGS=(--build-mode=coverage --link-method=copy)
+ CFG_FLAGS=(--with-coverage)
elif [ "$BUILD_MODE" = "sanitizer" ]; then
- CFG_FLAGS=(--build-mode=sanitizer)
+ CFG_FLAGS=(--with-sanitizer)
fi
if [ "$MODULES" = "min" ]; then
diff --git a/src/tests/test_ffi.cpp b/src/tests/test_ffi.cpp
index edc06f90a..5f788d8d9 100644
--- a/src/tests/test_ffi.cpp
+++ b/src/tests/test_ffi.cpp
@@ -155,8 +155,7 @@ TEST_CASE("FFI PBKDF", "[ffi]")
CHECK(iters_10ms >= 10000);
/*
- * Tests deactivated due to consistetly failing in debug mode where -W0 is set
- * (./configure.py --build-mode=debug).
+ * Tests deactivated due to consistently failing when optimizations are disabled
* See also: https://github.com/randombit/botan/commit/30b0e3c88e94ba04c1843798f7ac74a008e01d9b
*/
/*