[Git][NTPsec/ntpsec][master] waf: add test for -flto, commented out as that breaks endianness test.
Gary E. Miller
gitlab at mg.gitlab.com
Thu Feb 16 20:45:23 UTC 2017
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
a6cea9b1 by Gary E. Miller at 2017-02-16T12:44:32-08:00
waf: add test for -flto, commented out as that breaks endianness test.
- - - - -
1 changed file:
- wafhelpers/configure.py
Changes:
=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -198,8 +198,16 @@ def cmd_configure(ctx, config):
from wafhelpers.check_fortify import check_fortify
check_fortify(ctx)
+ cc_test_flags = [
+ ('PIE', '-pie -fPIE'),
+ ]
+
if ctx.options.enable_debug_gdb:
ctx.env.CFLAGS += ["-g"]
+ else:
+ cc_test_flags += [
+ ('LTO', '-flto'),
+ ]
if not ctx.options.disable_debug:
ctx.define("DEBUG", 1, comment="Enable debug mode")
@@ -216,21 +224,28 @@ def cmd_configure(ctx, config):
("-z now", "-Wl,-z,now"), # no deferred symbol resolution
]
- # check if C compiler supports -fPIE
- ctx.check_cc(define_name='HAS_PIE',
- cflags='-pie -fPIEX',
- fragment='int main() {}\n',
- mandatory=False,
- msg='Checking if C compiler supports -fPIE',)
+ # check if C compiler supports some flags
+ for (name, ccflag) in cc_test_flags:
+ ctx.check_cc(define_name='HAS_' + name,
+ cflags=ccflag,
+ fragment='int main() {}\n',
+ mandatory=False,
+ msg='Checking if C compiler supports ' + name,)
if ctx.env.HAS_PIE:
ctx.env.CFLAGS += [
"-FPIE",
"-pie",
]
- ld_hardening_flags = [
- "-fPIE", # hardening
- "-Wl,-z,relro", # hardening, marks some section read only,
+ ld_hardening_flags += [
+ ('PIE', "-fPIE"), # hardening
+ ('relrow', "-Wl,-z,relro"), # hardening, marks some read only,
+ ]
+
+ # XXX: -flto breaks endianness test???
+ if ctx.env.HAS_LTO and False:
+ ctx.env.CFLAGS += [
+ "-flto",
]
if ctx.options.disable_debug:
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/a6cea9b19c9ce70a8f897951f571800678c124c3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170216/a19b1891/attachment.html>
More information about the vc
mailing list