summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-07-08 11:17:38 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-09-21 07:11:29 +0200
commit77938ac3e3f409635591e3bc0a4917edba4d78f5 (patch)
tree737c215e5c96e9adadd13720f51d8e7beecac11b
parenti386: Delete old machine dependent files (diff)
downloadrtems-libbsd-77938ac3e3f409635591e3bc0a4917edba4d78f5.tar.bz2
build: Ensure mandatory compiler/linker flags
-rw-r--r--waf_libbsd.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/waf_libbsd.py b/waf_libbsd.py
index 558690b1..17cab509 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):
#