]>
Commit | Line | Data |
---|---|---|
e4a47d66 | 1 | opt_hardening = get_option('hardening') |
e4a47d66 FM |
2 | if opt_hardening.enabled() or opt_hardening.auto() |
3 | hardening_features = [] | |
4 | ||
0711a4c3 FM |
5 | # PIE |
6 | opt_pie = get_option('b_pie') | |
affc8124 | 7 | if not opt_pie and opt_hardening.enabled() |
0711a4c3 FM |
8 | error('Hardening was requested but building position independent executables is disabled') |
9 | endif | |
10 | hardening_features += [[opt_pie, 'Building position independent executables (PIEs)']] | |
d848ef6d | 11 | conf.set('PIE', opt_pie, description: 'Build a Position Independent Executable (PIE)') |
0711a4c3 FM |
12 | summary('PIE', opt_pie, bool_yn: true, section: 'Hardening') |
13 | ||
e4a47d66 FM |
14 | subdir('stack-prot') # Stack Protector |
15 | subdir('stack-smashing-prot') # Stack-Smashing Protection | |
16 | subdir('fortify-source') # Fortify Source | |
c3ad3c3b | 17 | subdir('relro') # RELRO |
e4a47d66 FM |
18 | |
19 | foreach feature: hardening_features | |
20 | available = feature[0] | |
21 | name = feature[1] | |
22 | ||
23 | if not available | |
24 | if opt_hardening.auto() | |
cd29df18 | 25 | warning(name + ' is disabled or not supported') |
e4a47d66 | 26 | else |
c3ad3c3b FM |
27 | error('Failing because ' + name + ' is not supported but hardening was requested') |
28 | endif | |
29 | endif | |
30 | endforeach | |
31 | endif | |
32 | ||
33 | opt_full_hardening = get_option('hardening-full') | |
34 | if opt_full_hardening.enabled() or opt_full_hardening.auto() | |
35 | full_hardening_features = [] | |
36 | subdir('relro-full') # Full RELRO | |
37 | ||
38 | foreach feature: full_hardening_features | |
39 | available = feature[0] | |
40 | name = feature[1] | |
41 | ||
42 | if not available | |
43 | if opt_full_hardening.auto() | |
44 | warning(name + ' is disabled or not supported') | |
45 | else | |
46 | error('Failing because ' + name + ' is not supported but full hardening was requested') | |
e4a47d66 FM |
47 | endif |
48 | endif | |
49 | endforeach | |
50 | endif |