NEW BUILD SYSTEM: Cannot build rtems-libbsd

Christian Mauderer christian.mauderer at embedded-brains.de
Wed Jul 8 06:22:35 UTC 2020


On 08/07/2020 08:13, Sebastian Huber wrote:
> On 08/07/2020 08:10, Niteesh G. S. wrote:
> 
>> On Tue, Jul 7, 2020 at 10:42 AM Sebastian Huber
>> <sebastian.huber at embedded-brains.de
>> <mailto:sebastian.huber at embedded-brains.de>> wrote:
>>
>>     Hello,
>>
>>     the problem is that the new build system doesn't export optimization
>>     flags such as -Wl,--gc-sections. The libbsd build should enable this
>>     linker option unconditionally.
>>
>>
>> Thank you. I got it fixed (temporarily) by modifying rtems.py.
>>
>> conf.env.CFLAGS    = cflags['cflags'] + ['-ffunction-sections'] +
>> ['-fdata-sections']
> This instructs the compiler to add data elements and functions into
> separate sections. This is necessary so that the linker can carry out
> the garbage collection.

There is an unused function in libbsd that can't link because a function
it calls isn't there. Till now the two flags had been provided by the
BSP. It seems that now they are not provided anymore.

The problematic function is m_unmappedtouio in uipc_mbuf.c. It tries to
use PHYS_TO_VM_PAGE which isn't defined in libbsd. I think we should
just remove m_unmappedtouio (with #ifndef __rtems__) on the longer term.
But not having the -ffunction-sections and -fdata-sections most likely
makes our binary bigger and maybe leads to other similar bugs. Therefore
I suggested to add the CFLAGS first.

>>
>> As per Christian suggestions, I tried exporting CFLAGS with these GCC
>> flags and then calling ./waf configure but they didn't work.
> You have to add -Wl,--gc-sections to the linker flags.

As far as I know Niteesh used that one too. I think for that one LDFLAGS
worked as a workarround.

Best regards

Christian
-- 
--------------------------------------------
embedded brains GmbH
Herr Christian Mauderer
Dornierstr. 4
D-82178 Puchheim
Germany
email: christian.mauderer at embedded-brains.de
Phone: +49-89-18 94 741 - 18
Fax:   +49-89-18 94 741 - 08
PGP: Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.


More information about the devel mailing list