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-19 13:26:41 +0200
commitf1f03620800b14146977d78fb4322d80da04b53a (patch)
tree5e4f43b95a57e720448e8ffa6fcaa3357721ba06
parent089780d2de7014a9c451bbd54cd3bcc64b58dfc7 (diff)
downloadrtems-libbsd-f1f03620800b14146977d78fb4322d80da04b53a.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 b8ec0ce0..ac7c2752 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):
#