aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-02-05 14:36:07 -0500
committerJack Lloyd <[email protected]>2017-02-05 14:36:07 -0500
commit149a1ba8a4eeaf2613c1058a678dc3173a7ad047 (patch)
treef59251526022b9e405411d2a4b55a7a772bc472e
parent8121ca87e317d136773c6558d82452843e849a8e (diff)
parent7cfb839be6e386dc068b140fe883c7bc3ac60c80 (diff)
Merge GH #867 Add configure.py --without-stack-protector flag
-rwxr-xr-xconfigure.py11
-rw-r--r--src/build-data/botan.pc.in2
-rw-r--r--src/build-data/cc/clang.txt3
-rw-r--r--src/build-data/cc/gcc.txt3
4 files changed, 13 insertions, 6 deletions
diff --git a/configure.py b/configure.py
index 29fea93b9..9f4246775 100755
--- a/configure.py
+++ b/configure.py
@@ -278,6 +278,9 @@ def process_command_line(args):
build_group.add_option('--with-sanitizers', action='store_true', default=False, dest='with_sanitizers',
help='enable ASan/UBSan checks')
+ build_group.add_option('--without-stack-protector', action='store_false', default=True, dest='with_stack_protector',
+ help='disable stack smashing protections')
+
build_group.add_option('--with-coverage', action='store_true', default=False, dest='with_coverage',
help='add coverage info and disable opts')
@@ -908,6 +911,7 @@ class CompilerInfo(object):
'size_optimization_flags': '',
'coverage_flags': '',
'sanitizer_flags': '',
+ 'stack_protector_flags': '',
'shared_flags': '',
'lang_flags': '',
'warning_flags': '',
@@ -983,6 +987,9 @@ class CompilerInfo(object):
if flag != None and flag != '' and flag not in abi_link:
abi_link.append(flag)
+ if options.with_stack_protector and self.stack_protector_flags != '':
+ abi_link.append(self.stack_protector_flags)
+
if options.with_coverage_info:
if self.coverage_flags == '':
raise ConfigureError('No coverage handling for %s' % (self.basename))
@@ -1008,9 +1015,7 @@ class CompilerInfo(object):
if options.cc_abi_flags != '':
abi_flags += ' ' + options.cc_abi_flags
- if abi_flags != '':
- return ' ' + abi_flags
- return ''
+ return abi_flags
def cc_warning_flags(self, options):
def gen_flags():
diff --git a/src/build-data/botan.pc.in b/src/build-data/botan.pc.in
index 85943ab3f..e19f0efed 100644
--- a/src/build-data/botan.pc.in
+++ b/src/build-data/botan.pc.in
@@ -7,6 +7,6 @@ Name: Botan
Description: Crypto and TLS for C++11
Version: %{version}
-Libs: -L${libdir} -lbotan-%{version_major}
+Libs: -L${libdir} -lbotan-%{version_major} %{cxx_abi_flags}
Libs.private: %{link_to}
Cflags: -I${includedir}
diff --git a/src/build-data/cc/clang.txt b/src/build-data/cc/clang.txt
index 15538307c..2e6070390 100644
--- a/src/build-data/cc/clang.txt
+++ b/src/build-data/cc/clang.txt
@@ -8,7 +8,7 @@ add_lib_dir_option -L
add_lib_option -l
add_framework_option "-framework "
-lang_flags "-std=c++11 -D_REENTRANT -fstack-protector"
+lang_flags "-std=c++11 -D_REENTRANT"
warning_flags "-Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wunreachable-code"
maintainer_warning_flags "-Qunused-arguments -Werror -Wno-error=unused-parameter -Wno-error=unused-variable -Wno-error=unreachable-code -Wno-error=deprecated-declarations"
@@ -22,6 +22,7 @@ sanitizer_flags "-fsanitize=address,undefined"
shared_flags "-fPIC"
coverage_flags "--coverage"
+stack_protector_flags "-fstack-protector"
visibility_build_flags "-fvisibility=hidden"
visibility_attribute '__attribute__((visibility("default")))'
diff --git a/src/build-data/cc/gcc.txt b/src/build-data/cc/gcc.txt
index ce6cb8364..07c1d7d0a 100644
--- a/src/build-data/cc/gcc.txt
+++ b/src/build-data/cc/gcc.txt
@@ -21,6 +21,7 @@ size_optimization_flags "-Os"
shared_flags "-fPIC"
coverage_flags "--coverage"
+stack_protector_flags "-fstack-protector"
# GCC 4.8
sanitizer_flags "-D_GLIBCXX_DEBUG -fsanitize=address"
@@ -123,7 +124,7 @@ all_x86_64 -> "-momit-leaf-frame-pointer"
# Flags set here are included at compile and link time
<mach_abi_linking>
-all -> "-pthread -fstack-protector"
+all -> "-pthread"
cilkplus -> "-fcilkplus"
openmp -> "-fopenmp"