Use weak functions in the RTEMS core?

Chris Johns chrisj at rtems.org
Thu Apr 9 01:32:03 UTC 2020


On 2020-04-09 03:43, Sebastian Huber wrote:
> On 08/04/2020 19:34, Jonathan Brandmeyer wrote:
>> Instead of treating weak references as a single level of indirection, 
>> I think you have to treat them as a single overridable interface.  In 
>> a dynamically-linked application, we might try to perform an override 
>> using the LD_PRELOAD feature. But in a statically-linked application 
>> we have to do it differently.  The overriding archive must be named in 
>> full, and it must be named as an object to be linked instead of a 
>> library to be searched.  Furthermore, an interface can have only one 
>> override that ends up in the linked application.
> Yes, you can only have one strong implementation, otherwise you get 
> multiple definition errors.

I have only ever considered weak references as an overridable interface 
within a user's application and not layered within RTEMS itself. I am 
not sure about automatic indirection within an archive.

In the case of different heap allocators why not have confdefs.h select 
the one we want and manage the indirection with a const table of pointers?

Chris


More information about the devel mailing list