[libbsd] build: Ensure mandatory compiler/linker flags

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Feb 24 13:56:15 UTC 2022


Make sure the flags are present in all build configurations.
---
 waf_libbsd.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/waf_libbsd.py b/waf_libbsd.py
index dd391191..acf93a2f 100644
--- a/waf_libbsd.py
+++ b/waf_libbsd.py
@@ -194,16 +194,16 @@ class Builder(builder.ModuleManager):
                                 conf.env['HAVE_%s' % l.upper()] = True
                     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"])
             conf.env.CFLAGS = _remove_bsp_include_path(conf.env.IFLAGS,
                                                        conf.env.CFLAGS)
             conf.env.CXXFLAGS = _remove_bsp_include_path(conf.env.IFLAGS,
                                                                     conf.env.CXXFLAGS)
             conf.env.LINKFLAGS = _remove_bsp_include_path(conf.env.IFLAGS,
                                                           conf.env.LINKFLAGS)
+        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):
         #
-- 
2.34.1



More information about the devel mailing list