-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Coverage for rust projects with clang 13 #6449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
cc @jonathanmetzman @inferno-chromium
|
# Keep all steps in the same script to decrease the number of intermediate | ||
# layes in docker file. | ||
RUN /root/checkout_build_install_llvm.sh | ||
RUN rm /root/checkout_build_install_llvm.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checkout_build_install_llvm.sh is now reused by install_rust
apt-get remove --purge -y $LLVM_DEP_PACKAGES | ||
apt-get autoremove -y | ||
if [ $# -eq 0 ] ; then | ||
apt-get remove --purge -y $LLVM_DEP_PACKAGES |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not remove git in base-builder-rust image
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this change.
If it's just a matter of installing git, then install it in the install_rust.sh script. There's tons of other stuff here being installed that should be removed. As is this pretty hacky.
@@ -1,5 +1,5 @@ | |||
homepage: "https://suricata-ids.org" | |||
language: c++ | |||
language: rust |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so that we get rust llvm-cov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how this works.
Here's my understanding.
suricata's c++ code is compiled with clang 14. suricata's rust code is compiled with clang 13.
Are the profraw files produced by suricata coverage builds compatible with clang 13 but not clang 14?
CI is failing because it does not rebuild base-clang |
This version mgmt is getting messy, can we spend time to make things work with clang 13 |
Things (that is rust coverage) work with clang 13. For swift, I think we will need clang 12 What would you suggest ? |
C++ is use clang14, we should strive to get everything working for clang14.
Does rust not work with clang 14?
Can you explain why? How long would it take to fix this issue?
My preference is to get everything working for one version of clang and we only use that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change is going to introduce complexity that we will regret.
I'd really like to be using the same clang version of everywhere to avoid this. How easy will that be to do?
unset CFLAGS | ||
unset CXXFLAGS | ||
# so that compile_libfuzzer can copy, without knowing the clang version | ||
rm /usr/local/lib/clang/*/lib/linux/libclang_rt.fuzzer-* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This uses an older version of libfuzzer for some of our projects right?
This can be a huge hassle for us and I don't think we want it.
( | ||
unset CFLAGS | ||
unset CXXFLAGS | ||
# so that compile_libfuzzer can copy, without knowing the clang version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please begin comment with captial and end with peirod.
apt-get remove --purge -y $LLVM_DEP_PACKAGES | ||
apt-get autoremove -y | ||
if [ $# -eq 0 ] ; then | ||
apt-get remove --purge -y $LLVM_DEP_PACKAGES |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this change.
If it's just a matter of installing git, then install it in the install_rust.sh script. There's tons of other stuff here being installed that should be removed. As is this pretty hacky.
cd $OUT | ||
|
||
# copy version/language-specific coverage tools if any | ||
cp $OUT/llvm-cov /usr/local/bin || true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a fan of this. We copy llvm-cov and llvm-profdata into the build for rust and swift and then copy those from build into /usr/local/bin if they exist?
Here's a way I like more (assuming we end up using multiple versions of clang): Copy llvm-cov and llvm-profdata into build for all fuzzers no matter the language, then instead of copying those into /usr/local/bin, use them directly.
@@ -1,5 +1,5 @@ | |||
homepage: "https://suricata-ids.org" | |||
language: c++ | |||
language: rust |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how this works.
Here's my understanding.
suricata's c++ code is compiled with clang 14. suricata's rust code is compiled with clang 13.
Are the profraw files produced by suricata coverage builds compatible with clang 13 but not clang 14?
This change makes rust projects use a different libfuzzer than c++. I think this is a bad idea. |
This got replaced by #6517, forgot to close |
Suricata needs to be labelled as rust project because we need rust std coverage |
#6517 does that
Nope
#6517 makes it work with clang 14 |
Is it possible to briefly explain the issue with clang 14 and rust? |
I want to understand, but I don't want to waste your time explaining this to me. |
Rust and Swift compiler use llvm (I do not fully understand how much) llvm 12, 13 and 14 generate different profraw file formats, and their llvm-cov/llvm-profdata tools can only read their current file format
|
Fixes #6268
As discussed in https://reviews.llvm.org/D104556 since clang supports only one version of profraw files at a time, we need for llvm-based languages such as rust and swift, to use the right version of clang
For rust, this is now clang 13, (as clang 14 introduced some changes)
compile
script now copies llvm-profdata and llvm-covin $OUT if needed (as is done for llvm-symbolizer)coverage
script takes specificllvm-profdata
if anyThe same change likely needs to be done for swift, but with clang 12 I guess.