[PATCH] Add support for ELF notes

Chris Johns chrisj at rtems.org
Tue Mar 28 07:03:48 UTC 2023


On 28/3/2023 5:48 pm, Sebastian Huber wrote:
> On 25.03.23 00:39, Chris Johns wrote:
>> On 24/3/2023 7:32 pm, Sebastian Huber wrote:
>>> On 23.03.23 20:07, Chris Johns wrote:
>>>> On 24/3/2023 3:57 am, Sebastian Huber wrote:
>>>>> On 23.03.23 17:52, Will wrote:
>>>>>> Great idea to store this information in the executable itself. Does this need
>>>>>> a RTEMS_TEST_STATE_LINK_ONLY test state or something similar for minimum.exe?
>>>>>
>>>>> With the notes you can build the test. The test runner would look at the notes
>>>>> and then decide if it makes sense to run the test or not. It could still
>>>>> run the
>>>>> minimum.exe and see if it terminates.
>>>>
>>>> I welcome notes support. Thanks for adding it.
>>>>
>>>> How will we control and manage the notes we support?
>>>
>>> In the new elfnote.h header file there are defines for the note type
>>> (domain-specific integer).
>>
>> Great.
>>
>>>>
>>>> Should we document the top level notes domains (?) with some we control and
>>>> restrict and others users can use? For example `note.rtems.test`,
>>>> `note.rtems.kernel`, `note.rtems.bsp`, and `note.rtems.user`?
>>>
>>> The section name doesn't matter. You can divide the number space of the note
>>> type for this.
>>
>> Does this mean we define the numbers or number ranges or is it left open? I am
>> not sure I am following this bit.
> 
> The patch has this:
> 
> #define ELF_NOTE_RTEMS_TYPE( _index ) ( ( _index ) + 0x10000 )
> 
> We basically have 32-bits available. We could also use something like this:
> 
> #define ELF_NOTE_RTEMS_BASE_TYPE( _index ) ( ( _index ) + 0x10000000 )
> 
> #define ELF_NOTE_RTEMS_TEST_TYPE( _index ) ( ( _index ) + 0x20000000 )
> 
> #define ELF_NOTE_RTEMS_USER_TYPE( _index ) ( ( _index ) + 0x30000000 )
> 
> ...
> 

Nice.

>>>> Do you have any host side tools in mind to access notes apart from the
>>>> standards
>>>> like readefl? Maybe the rtems-exe-info tool could do this?
>>>
>>> Yes, it should be added to this tool.
>>
>> Great. Once we have something merged I can take a look.
>>
>>> I think the most important use case is the
>>> RTEMS tester currently. You can read the notes with the elftools for Python.
>>
>> I could not see an elftools module in the standard cpython support and I have
>> carefully avoided any pipy dependences in user facing tools. We have elf support
>> in the tool kit so if we can sort something out without needing to add something
>> else I would prefer it. I think the first thing to do is the get this into
>> rtems.git and then we can address the tooling we need.
> 
> We could add a JSON output to rtems-exe-info which is used by the RTEMS Tester.
> The drawback is that you need a process for each executable.

The exe info tool is fast and yes exporting JSON is a good idea. I have a decent
C++ JSON implementation I am using that can be added to the toolkit and used.

>> We have a GSoC project to sort out the post link stuff that was stripped out
>> when we moved to waf. Could that detail be added as notes? There is something
>> nice about each executable having the needed info and not needing to match an
>> exe with a specific installed configuration set up.
> 
> I think we just have to try it out.

Great.

Chris


More information about the devel mailing list