Ran clang

suyash singh suyashsingh234 at gmail.com
Fri Mar 27 17:19:12 UTC 2020


On Fri, Mar 27, 2020 at 9:36 PM Joel Sherrill <joel at rtems.org> wrote:

>
>
> On Fri, Mar 27, 2020 at 10:39 AM Gedare Bloom <gedare at rtems.org> wrote:
>
>> This appears to be a pretty standard llvm/clang build for a host system.
>>
>> There are two parts to consider:
>> * Using the host tools over RTEMS
>> * Using cross-compiler tools over RTEMS
>>
>> For analyzer I don't think the cross-target is a problem but I'm not
>> really sure. That should be understood before pushing further. My
>> understanding though is that most of the analyzers run on the LLVM IR, so
>> the backend is irrelevant.
>>
>
By cross compiler tools do you mean the Clang Static Analyzer should work
on all hosts after building only once?

>
> I think the RISC-V and SPARC  have BSPs that can be built with clang.
> clang/llvm has a package in the RSB. I would recommend building llvm using
> the RSB and then building the supported BSPs.
>
> That is a more solid base to use for analysis. Building RTEMS with the
> native compiler is hopeless (tilting at windmills).
>
> Also gcc 10 has improved analysis (
> https://developers.redhat.com/blog/2020/03/26/static-analysis-in-gcc-10/).
> I would like to see support for using either for static analysis.
>
> Supporting >1 open source/free tool for static analysis before fixing
> anything is important (to me). This is already built by the rtems6 RSB
> toolchain. When that builds anyway -- it tracks the tools head. :)
>
> Your project should include any additions to the RSB (if needed) and
> documenting use of the analyzers. If there is a technique to annotate
> source to avoid false positives or deliberate violations, your project
> should document that also
>

     Do you mean the RSB can already build Clang Static Analyzer and
UBSan?

     So build clang/llvm and then build BSPs for analysis?

Also gcc 10 has improved analysis (
> https://developers.redhat.com/blog/2020/03/26/static-analysis-in-gcc-10/).
> I would like to see support for using either for static analysis.
> Supporting >1 open source/free tool for static analysis before fixing
> anything is important (to me). This is already built by the rtems6 RSB
> toolchain. When that builds anyway -- it tracks the tools head. :)


 Do you mean adding both gcc 10 and clang static analyzer in RTEMS?
What is already built by rtems6 RSB toolchain?


UBSan needs code to be compiled. Will it be a problem?

Also I am quoting from clang mailing list

As of now we only analyze code that compiles without errors to begin
> with. This does force us to have some amount of interaction with the
> build system.


What are your problems with scan-build though? Is it somehow not working
> for your build system? RTEMS looks like it has a plain old Makefile; as
> long as it respects environment variables CC and CXX, "scan-build make"
> should work just fine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200327/fdf9c229/attachment.html>


More information about the devel mailing list