AW: [PATCH v3 2/3] amd64: Add to build

Chris Johns chrisj at rtems.org
Tue Feb 11 23:36:19 UTC 2020


On 12/2/20 12:21 am, Jan.Sommer at dlr.de wrote:
>> Von: Sebastian Huber [mailto:sebastian.huber at embedded-brains.de]
>> Gesendet: Dienstag, 11. Februar 2020 13:22
>> An: Sommer, Jan; devel at rtems.org
>> Betreff: Re: [PATCH v3 2/3] amd64: Add to build
>>> +                includes += ['freebsd/sys/x86/include']
>>> +            if cpu == "x86_64":
>>> +                cpu = 'amd64'
>>>                   includes += ['freebsd/sys/x86/include']
>>>               for i in config['cpu-include-paths']:
>>>                   includes += [i.replace('@CPU@', cpu)]
>> I am not sure what this should do. Here cpu x86_64 seems to be renamed
>> to amd64? Should it be named amd64 in general?
> 
> The problem is that the RTEMS_ARCH and the compiler prefix is x86_64, however in FreeBSD the related files are in amd64 subdirectories.

Yes, this is fixed and cannot change. As Joel points out it is from the tools
and we a long standing policy of following the tool names.

> libbsd.py uses @CPU@ to create the architecture specific include directories which then yields sys/x86_64/include for example, but should create sys/amd64/include.

Yes. The i386 has a hidden case as a hack in the generator code. It should also
be removed and cleaned up, see below.

> Before my last patch set,  cpu was overridden to x86 for i386, so I thought doing something similar saves me the trouble with the include directories here.
> Do you maybe have a more elegant solution?

I think we need some form of path matching. I doubt this will be the only place
we encounter something like this and it is not the first case.

What about adding something that maps one path to another path? eg to libbsd.py
add ...

 #
 # Map paths based on RTEMS naming to FreeBSD naming.
 #
 'path-mappings' : [('freebsd/sys/i386/include', 'freebsd/sys/x64/include'),
                    ('freebsd/sys/x86_64/include', 'freebsd/sys/amd64/include')]

The mapping code can be added here ...

https://git.rtems.org/rtems-libbsd/tree/waf_libbsd.py#n192

... and the special case of i386 removed. I would add a path_remap call so if
this is needed in other places it can be added easily.

Chris


More information about the devel mailing list