[PATCH] build: Ensure mandatory compiler/linker flags

Chris Johns chrisj at rtems.org
Wed Jul 8 11:35:12 UTC 2020


Are these flags needed for all BSPs? If so why add to here ...

https://git.rtems.org/rtems/tree/c/src/bsp.pc.in

Chris

On 8/7/20 7:17 pm, Sebastian Huber wrote:
> ---
>  waf_libbsd.py | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/waf_libbsd.py b/waf_libbsd.py
> index a817e574..bfe23845 100644
> --- a/waf_libbsd.py
> +++ b/waf_libbsd.py
> @@ -55,6 +55,11 @@ 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.
>  #
> @@ -168,6 +173,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 devel mailing list