]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Meson: Cleanup hardening modules
authorFred Morcos <fred.morcos@open-xchange.com>
Wed, 16 Aug 2023 10:01:28 +0000 (12:01 +0200)
committerFred Morcos <fred.morcos@open-xchange.com>
Wed, 20 Mar 2024 12:28:40 +0000 (13:28 +0100)
meson/hardening/fortify-source/meson.build
meson/hardening/global-offset-table/meson.build
meson/hardening/meson.build
meson/hardening/stack-prot/meson.build
meson/hardening/stack-smashing-prot/meson.build

index 2f260cc414b5450f2e88cce36a4a730c846b8e45..043ffcde4b946f29ee39dfd70af8d19b9cac7cd3 100644 (file)
@@ -1,9 +1,8 @@
-# Fortify Source
-# Inputs: hardening_features
-
 fortify_source_opt = get_option('fortify-source')
+fortify_source = fortify_source_opt != 'disabled'
+fortify_source_level = 0
 
-if fortify_source_opt != 'disabled'
+if fortify_source
   fortify_source_level = 2
   if fortify_source_opt == 'auto'
     fortify_source_level = 3
@@ -24,10 +23,12 @@ if fortify_source_opt != 'disabled'
     endif
   endforeach
 
-  if fortify_source_level == 0
-    fortify_source_level = 'no'
-  endif
-
   hardening_features += [[fortify_source_level != 0, 'Source Fortification']]
+endif
+
+fortify_source = fortify_source and fortify_source_level != 0
+summary('Source Fortification', fortify_source, bool_yn: true, section: 'Hardening')
+
+if fortify_source
   summary('Source Fortification Level', fortify_source_level, section: 'Hardening')
 endif
index 25622d6b70e699fba5a0d5a2b1066bd4e03c4bf1..a9754e5c9732806cbec6bf46d1e4e56b294249a0 100644 (file)
@@ -1,6 +1,3 @@
-# Read-only Global Offset Table
-# Inputs: hardening_features
-
 ld_help = run_command(cxx, '-Wl,-help', check: true).stdout().strip()
 variants = ['relro', 'now']
 found_variant = false
index eeb31c86a4031355a09c2b1144c85a41b0fe2662..c7b1f49d5ba7a04bd50c6a0d1c59291012f70300 100644 (file)
@@ -1,4 +1,3 @@
-# Hardening
 opt_hardening = get_option('hardening')
 
 if opt_hardening.enabled() or opt_hardening.auto()
@@ -10,7 +9,7 @@ if opt_hardening.enabled() or opt_hardening.auto()
     error('Hardening was requested but building position independent executables is disabled')
   endif
   hardening_features += [[opt_pie, 'Building position independent executables (PIEs)']]
-  conf.set10('PIE', opt_pie, description: 'Whether we enable building a Position Independent Executable (PIE)')
+  conf.set('PIE', opt_pie, description: 'Build a Position Independent Executable (PIE)')
   summary('PIE', opt_pie, bool_yn: true, section: 'Hardening')
 
   subdir('stack-prot')          # Stack Protector
index bede72a305c4a537e896331b4b25ce76ab33f524..33b8b564351323982df7f8a1cae1756b597d32d4 100644 (file)
@@ -1,6 +1,3 @@
-# Stack Protector
-# Inputs: hardening_features
-
 support_stack_protector = cxx.has_argument('-fstack-protector')
 
 if support_stack_protector
index 7a529a60caf43fbd34ed4425006c9d073ab74174..0baa5018c9cfed7e95cb0911aafe951b749af7a1 100644 (file)
@@ -1,6 +1,3 @@
-# Stack-smashing Protection
-# Inputs: hardening_features
-
 support_stack_smashing_protector = cxx.has_argument('--param=ssp-buffer-size=4')
 if support_stack_smashing_protector
   add_global_arguments('--param=ssp-buffer-size=4', language: ['c', 'cpp'])