On 08/07/2020 08:35, Niteesh G. S. wrote: > On Wed, Jul 8, 2020 at 11:52 AM Christian Mauderer > <christian.maude...@embedded-brains.de > <mailto:christian.maude...@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.hu...@embedded-brains.de > <mailto:sebastian.hu...@embedded-brains.de> > >> <mailto:sebastian.hu...@embedded-brains.de > <mailto:sebastian.hu...@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.
Have the flags been ignored and not used or did that not fix the problem? I would assume the second. You should see the difference if you call "./waf -v" and take a look at one of the linker calls to generate the test applications. > > 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 > That's a bit odd. I don't think that I ever used that flag. But you are right: If CFLAGS contains the -function-section (only one -), "-Wl,--gc-sections" is added to the LDFLAGS here. > > > Best regards > > Christian > -- > -------------------------------------------- > embedded brains GmbH > Herr Christian Mauderer > Dornierstr. 4 > D-82178 Puchheim > Germany > email: christian.maude...@embedded-brains.de > <mailto:christian.maude...@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. > -- -------------------------------------------- embedded brains GmbH Herr Christian Mauderer Dornierstr. 4 D-82178 Puchheim Germany email: christian.maude...@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. _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel