[PATCH] build: Ensure mandatory compiler/linker flags

Chris Johns chrisj at rtems.org
Tue Jul 14 04:41:58 UTC 2020


On 13/7/20 3:05 pm, Sebastian Huber wrote:
> On 13/07/2020 02:09, Chris Johns wrote:
>> On 8/7/20 9:37 pm, Sebastian Huber wrote:
>>> On 08/07/2020 13:34, Chris Johns wrote:
>>>
>>>> Are these flags needed for all BSPs?
>>> Yes, these flags are needed to build and use libbsd.
>>
>> Why not define them for all BSPs 
> 
> In the new build system they are the default.
> 
>> and for all applications?
> 
> I don't think we should mandate any optimization flags for applications. These
> flags affect the code generation.

But there is a class of application, ie linking with libbsd, which must have
these flags as well.

>> What is special about libbsd that it needs these flags over any other type of
>> application?
> 
> libbsd needs these flags since FreeBSD was not designed as a static library. In
> addition, the porting to RTEMS is less intrusive and labour intensive using
> these flags.

Sure I understand this. Adding the flags to libbsd like this lets libbsd build
it's tests, it however does not transfer through to a user application and this
is what I would like to address. I see libbsd linking a test executable as the
same use case a user has when linking a libbsd application.

>>>> If so why add to here ...
>>>>
>>>> https://git.rtems.org/rtems/tree/c/src/bsp.pc.in
>>> These are optimization flags. I thought the consensus was to export only ABI
>>> relevant flags in the new build system.
>>
>> In CFLAGS yes. Pkgconfig files (.pc) support variables and I had always thought
>> we define a number of RTEMS specific variables and these hold various flags or
>> commands needed to handle other things, for example the options to mkimage. A
>> user could then test for a variable and if present know this BSP does or has
>> extra "what ever".
> 
> You mean some sort of recommended optimization flags? We should really define
> what the pkg-config files should export so that I can implement this in the new
> build system.

The ABI flags are in CFLAGS. You could define a recommended optimisation set of
flags as a variable. I was thinking of other things like the base addresses or
size limits or even a post link command users can use in a build without needed
to investigate then copy and paste the details.

Maybe pkgconfig can provide more specific support for example we add a .pc for
libbsd and then a user queries it for the needs flags to use?

Chris


More information about the devel mailing list