[PATCH v1 0/1] Update rtems-llvm to version 11.1.0

Jan.Sommer at dlr.de Jan.Sommer at dlr.de
Wed Feb 22 15:06:59 UTC 2023



> -----Original Message-----
> From: Hesham Almatary <heshamelmatary at gmail.com>
> Sent: Mittwoch, 22. Februar 2023 14:34
> To: Sommer, Jan <Jan.Sommer at dlr.de>
> Cc: joel at rtems.org; devel at rtems.org
> Subject: Re: [PATCH v1 0/1] Update rtems-llvm to version 11.1.0
> 
> On Tue, 21 Feb 2023 at 14:30, <Jan.Sommer at dlr.de> wrote:
> >
> > Hello everyone,
> >
> > I tried to build a riscv BSP with the information from Hesham. Thanks again.
> > It now compiles the files, but produces a lot of warnings and fails to link in
> the end.
> >
> > The warnings are of this type
> > ../../../cpukit/score/cpu/riscv/riscv-exception-handler.S:48:10: warning:
> unknown option, expected 'push', 'pop', 'rvc', 'norvc', 'relax' or 'norelax'
> >    .option arch, +zicsr
> >            ^
> Does this happen if you use the latest LLVM?
> 

The latest I tried so far was llvm14 and there it happened. Do you know if this might be solved in more recent versions?
llvm14 was the latest I could build with the shipped compilers of my workstation.

> > And in the end the linker cannot find the " _RISCV_Exception_handler", so
> I guess the warning prevents those symbols from being built. My best guess
> is that it is related to this llvm issue: https://reviews.llvm.org/D141666 which
> is actively worked on as of this month and we probably have to wait for this
> to become part of llvm.
> >
> Are you sure the right linker is used (lld?) I remember I had to add a custom
> patch for RTEMS to be able to use the right linker and options.
> https://github.com/CTSRD-
> CHERI/clang/blob/master/lib/Driver/ToolChains/RTEMS.cpp
> 

So far I used the linker of the rtems6-gcc toolchain.

> > Out of curiosity, I tried the same with the Zedboard BSP. There, linking
> passed and I got to this point for base_sp.exe:
> > *** BEGIN OF TEST OH ***
> > *** TEST VERSION: 6.0.0.c0fad60c59bf14b9d1a4eb3d76f872e2cf43e7b8
> > *** TEST STATE: (null)
> > *** TEST BUILD:
> > *** TEST TOOLS: Clang 11.1.0
> > (https://git.rtems.org/rtems-source-builder
> > 64df106288cf6c4289a9c78850a82bfb2b41caa2)
> > Creating and starting an application task
> >
> > *** FATAL ***
> > fatal source: 0 (INTERNAL_ERROR_CORE)
> > fatal code: 31
> (INTERNAL_ERROR_BAD_THREAD_DISPATCH_ENVIRONMENT)
> > RTEMS version: 6.0.0.c0fad60c59bf14b9d1a4eb3d76f872e2cf43e7b8
> > RTEMS tools: Clang 11.1.0 (https://git.rtems.org/rtems-source-builder
> > 64df106288cf6c4289a9c78850a82bfb2b41caa2)
> > executing thread is NULL
> >
> > So, let's say it's something. Now at least I have a system to debug. I will also
> have a look how to make the process more accessible. At the moment things
> are just crowbarred into the build system to make it work.
> >
> > Coming back to the patch: If there are no objections I would like to push
> the commit for llvm11.
> > Chances are that further updates are to come as I progress.
> >
> > Best regards,
> >
> >     Jan
> >
> > > -----Original Message-----
> > > From: Hesham Almatary <heshamelmatary at gmail.com>
> > > Sent: Mittwoch, 15. Februar 2023 11:17
> > > To: Sommer, Jan <Jan.Sommer at dlr.de>
> > > Cc: joel at rtems.org; devel at rtems.org
> > > Subject: Re: [PATCH v1 0/1] Update rtems-llvm to version 11.1.0
> > >
> > > On Wed, 15 Feb 2023 at 09:22, <Jan.Sommer at dlr.de> wrote:
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Hesham Almatary <heshamelmatary at gmail.com>
> > > > > Sent: Montag, 13. Februar 2023 16:19
> > > > > To: Sommer, Jan <Jan.Sommer at dlr.de>
> > > > > Cc: joel at rtems.org; devel at rtems.org
> > > > > Subject: Re: [PATCH v1 0/1] Update rtems-llvm to version 11.1.0
> > > > >
> > > > > On Mon, 13 Feb 2023 at 12:12, <Jan.Sommer at dlr.de> wrote:
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Joel Sherrill <joel at rtems.org>
> > > > > > > Sent: Freitag, 10. Februar 2023 15:21
> > > > > > > To: Sommer, Jan <Jan.Sommer at dlr.de>
> > > > > > > Cc: devel at rtems.org
> > > > > > > Subject: Re: [PATCH v1 0/1] Update rtems-llvm to version
> > > > > > > 11.1.0
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On Fri, Feb 10, 2023 at 3:16 AM Jan Sommer
> > > > > > > <jan.sommer at dlr.de <mailto:jan.sommer at dlr.de> > wrote:
> > > > > > >
> > > > > > >
> > > > > > >       Hello,
> > > > > > >
> > > > > > >       I couldn't get the rtems-llvm buildset to work.
> > > > > > >       As it was building llvm8 which is not that modern, I
> > > > > > > just tried to
> > > build
> > > > > > >       a more recent version with the scripts.
> > > > > > >       It works with llvm11. Are there any objections to updating?
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > Nope. Please feel free to add this.
> > > > > > >
> > > > > > >
> > > > > > >       And should we keep the rtems-llvm-8.cfg or should I
> > > > > > > remove this with
> > > > > > >       this patch?
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >  My main concern is if the architectures that built with
> > > > > > > llvm 8 still build with llvm 11. I think that's only SPARC and RISC-V.
> > > > > > > Are there
> > > > > others?
> > > > > > >
> > > > > Why not the latest LLVM (especially to pick up the latest RISC-V
> > > > > fixes/support). I am not sure how mature the RISC-V support is
> > > > > in LLVM 8, if it was supported at all.
> > > > >
> > > >
> > > > Yes, that is also my goal. I got llvm11 building with only small
> > > > changes to the
> > > buildset and wanted to go from there.
> > > > In the meantime I also managed to build llvm up to 14 locally.
> > > > Once I have
> > > all the bits and pieces working to some degree I will probably
> > > consolidate to a more recent version.
> > > >
> > > Seems like a good plan.
> > >
> > > > > > > I guess that points to me not knowing the list of
> > > > > > > architectures that are expected to work. I wonder where we
> > > > > > > would keep this
> > > information.
> > > > > > > Any thoughts?
> > > > > > >
> > > > > >
> > > > > > Thanks for the information.
> > > > > > I tried to build those to check if they still work and failed,
> > > > > > but given that the
> > > > > information I could find is sparse I could very well be the problem.
> > > > > > What I did is:
> > > > > > - Build the gcc toolchains for sparc and riscv (as far as I
> > > > > > understand we need the binutils and libc from that)
> > > > > I haven't tried doing that for RISC-V. I used to build newlib
> > > > > manually, and not rely on GCC/binutils.
> > > > >
> > > >
> > > > Ah, I see. Just for clarification you also cross-built newlib with clang?
> > > >
> > > Yes, besides compiler-rt (LLVM's version of libgcc). But you don't
> > > need to go all the way there, you can just use GCC's newlib.
> > >
> > > > > > - Build the rtems-llvm build set
> > > > > > - Generate a config for waf using: ./waf bspdefaults
> > > > > > --rtems-bsps='sparc/gr712rc' --rtems-compiler=clang >
> > > > > > sparc.cfg
> > > > > > - Configure the build with the config: ./waf configure
> > > > > > --rtems-config=sparc.cfg -$INSTALL_DIR
> > > > > > - Run ./waf
> > > > > > - I also tried with some riscv BSPs with the same results.
> > > > > >
> > > > > > The build fails with missing std headers (stddef.h).
> > > > > > Looking at the generated config file there are only small
> > > > > > differences to the
> > > > > one for gcc (essentially the compiler name changed to clang).
> > > > > > And the verbose output confirms that the gcc toolchain is not
> > > > > > part of the
> > > > > include paths.
> > > > > > I didn't find an obvious option in "waf configure" to add this.
> > > > > I added [1] an option for "sysroot" in the old build system so
> > > > > that Clang could find the C library. I don't think that was
> > > > > integrated in waf. However, I was also using CHERI-based LLVM
> > > > > with a modified Driver so that it automatically fetches the C
> > > > > library (after it gets manually built and installed under a
> > > > > convenient LLVM) related to the
> > > LLVM install path.
> > > > >
> > > > > [1]
> > > > >
> > >
> https://github.com/RTEMS/rtems/commit/94481cedc4165f6a49ef528709825
> > > > > 1740922fee1
> > > > >
> > > >
> > > > Ah, thanks for this. I think this is a good starting point to experiment
> with.
> > > >
> > > > Best regards,
> > > >
> > > >     Jan
> > > >
> > > > > > If you say that building worked only for few BSPs. Do you
> > > > > > remember which
> > > > > ones and if there was some magic to do first?
> > > > > > Then I could try to reproduce this with the llvm11 compiler.
> > > > > I don't think they'll build as is without a few modifications to
> > > > > the build system. Simplest thing to do is to use GCC's libgcc
> > > > > and newlib and add a "sysroot" or "-L -I" options to the current
> > > > > build system for
> > > them.
> > > > >
> > > > > >
> > > > > > Best regards,
> > > > > >
> > > > > >     Jan
> > > > > >
> > > > > > > --joel
> > > > > > >
> > > > > > >
> > > > > > >       Have a nice weekend,
> > > > > > >
> > > > > > >           Jan
> > > > > > >
> > > > > > >       Jan Sommer (1):
> > > > > > >         rtems-tools: Update rtems-llvm to version 11.1.0
> > > > > > >
> > > > > > >        rtems/config/6/rtems-llvm.bset           |  2 +-
> > > > > > >        rtems/config/tools/rtems-llvm-11.1.0.cfg | 21
> > > > > > > +++++++++++++++++++++
> > > > > > >        source-builder/config/llvm-common-1.cfg  |  6 +++---
> > > > > > >        3 files changed, 25 insertions(+), 4 deletions(-)
> > > > > > >        create mode 100644
> > > > > > > rtems/config/tools/rtems-llvm-11.1.0.cfg
> > > > > > >
> > > > > > >       --
> > > > > > >       2.25.1
> > > > > > >
> > > > > > >       _______________________________________________
> > > > > > >       devel mailing list
> > > > > > >       devel at rtems.org <mailto:devel at rtems.org>
> > > > > > >       http://lists.rtems.org/mailman/listinfo/devel
> > > > > > >
> > > > > >
> > > > > > _______________________________________________
> > > > > > devel mailing list
> > > > > > devel at rtems.org
> > > > > > http://lists.rtems.org/mailman/listinfo/devel
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Regards,
> > > > > Hesham
> > >
> > >
> > >
> > > --
> > > Regards,
> > > Hesham
> 
> 
> 
> --
> Regards,
> Hesham


More information about the devel mailing list