NEW BUILD SYSTEM: Cannot build rtems-libbsd
Niteesh G. S.
niteesh.gs at gmail.com
Wed Jul 8 06:35:56 UTC 2020
On Wed, Jul 8, 2020 at 11:52 AM Christian Mauderer <
christian.mauderer at embedded-brains.de> wrote:
> 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.
>
Yes, I did try exporting LDFLAGS too but they also didn't work out.
I tried the following:
1) export LDFLAGS="-Wl,--gc-sections"
2) ./waf configure --prefix=$RTEMS/6 --rtems-version=6
--rtems-bsps=arm/beagleboneblack --buildset=buildset/minimal.ini
I also tried running
1) LDFLAGS="-Wl,--gc-sections" ./waf configure --prefix=$RTEMS/6
--rtems-version=6 --rtems-bsps=arm/beagleboneblack
--buildset=buildset/minimal.ini
Both of them didn't work out.
I might be wrong here but waf seems to add the "-Wl,--gc-sections"
flags if "--function-sections" flags are defined.
https://git.rtems.org/rtems_waf/tree/rtems.py#n389
> 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200708/b6626c01/attachment-0001.html>
More information about the devel
mailing list