[rtems-libbsd commit] build: Ensure mandatory compiler/linker flags
Sebastian Huber
sebh at rtems.org
Mon Sep 21 05:11:44 UTC 2020
Module: rtems-libbsd
Branch: master
Commit: 77938ac3e3f409635591e3bc0a4917edba4d78f5
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=77938ac3e3f409635591e3bc0a4917edba4d78f5
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed Jul 8 11:17:38 2020 +0200
build: Ensure mandatory compiler/linker flags
---
waf_libbsd.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/waf_libbsd.py b/waf_libbsd.py
index 558690b..17cab50 100644
--- a/waf_libbsd.py
+++ b/waf_libbsd.py
@@ -57,6 +57,10 @@ if windows:
else:
host_shell = ''
+def _add_flags_if_not_present(current_flags, addional_flags):
+ for flag in addional_flags:
+ if flag not in current_flags:
+ current_flags.append(flag)
#
# The waf builder for libbsd.
@@ -182,6 +186,10 @@ class Builder(builder.ModuleManager):
mandatory=False)
else:
bld.fatal('invalid config test: %s' % (configTest))
+ section_flags = ["-fdata-sections", "-ffunction-sections"]
+ _add_flags_if_not_present(conf.env.CFLAGS, section_flags)
+ _add_flags_if_not_present(conf.env.CXXFLAGS, section_flags)
+ _add_flags_if_not_present(conf.env.LINKFLAGS, ["-Wl,--gc-sections"])
def build(self, bld):
#
More information about the vc
mailing list