-
-
Notifications
You must be signed in to change notification settings - Fork 292
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
libafl_cc fixes for windows #710
Conversation
Awesome! |
Thank you! |
I think we want to put your code into a rust's |
Do we need to compile llvm from source? Can't we take the precompiled binaries and just download the respective headers? |
I believe it is not needed, if the information from |
If llvm-config is just for checking the versions of the llvm tools, I think we could just parse the output of clang --version |
Hey @abgeana , still working on this or should we eventually take over? |
Hi @domenukk, I think I reached a conclusion. I changed the code a bit to skip the Missing stuff includes some headers like So unfortunately, it seems that the distributed LLVM package cannot be used for Windows and manually compiling things is needed :/ For CI/CD purposes, an option could also be to create a Docker container which has a compiled version of LLVM readily available, such that building it would not be needed for every CI/CD run. I was able to do everything inside Docker myself, but I'm not sure about licensing stuff since msvc is being used. |
Just a stupid idea: is it possible to link against it, anyway, downloading only the headers but using the precompiled binaries? |
Yeah I thought about a repo+distributed headers combo, but these headers are generated by cmake during the build. They would have been included in the distributed package, but are now not included for windows. So a manually compiled version of llvm would still be needed from somewhere. I agree that putting this under a feature flag in cargo would be the most straightforward option. |
Thanks for your PR! Here are some potential ideas to compile llvm in CI:
|
Hi @syheliel, We decided to change the behavior of I was not sure why the macos-latest build was failing, but apparently it is also failing in other PRs so it is not related to the contents of my PR in particular. |
I can reproduce the CI failure on my Mac, some behavior seems to have changed. It seems to pick up a different clang (XCode instead of brew).
/edit: it does seem to pick up the right llvm-config (/opt/homebrew/Cellar/llvm/14.0.6_1/bin/llvm-config) |
Although not related, maybe we can fix this problem first for macos?
|
In
|
We need syscalls, so there's nothing we can do. |
@syheliel and @domenukk thank you for also looking into the CI/CD fails. Seems all checks are working fine now. There is one last bug(?) which popped up, namely the arguments passed to LLVM passes. An example is the aforementioned I believe the issue is with how arguments are passed in the old vs new LLVM pass manager. Currently in CI/CD (at least in the MacOS builds), the old pass manager is used regardless of the LLVM version. This is due to the logic behind version identification and the fact that no For now I suggest to leave this PR as is (unless there are some breaking things I'm missing), and have another PR for the aforementioned issue. |
I can reproduce these errors too with clang-14 |
llvm/llvm-project#56137 |
I guess this is fine. All these warnings appear on linking not on compiling. when clang is called with |
Nice, thx! |
oh, wait. |
anyways thank you for your pr! @abgeana |
* libafl_cc fixes for windows * libafl_cc checks for llvm-config (again) * libafl_cc clang-format * libafl_cc fixes for macos * maintain libafl_cc pass manager selection logic * libafl_cc rustfmt
This PR includes changes that enable LibAFL's optimization passes on Windows. I think this is not perfect, but could be used as a start.
In order to get these running, one has to:
llvm-config.exe
which is not distributed in the Windows package. I used the following commandsI made a
Dockerfile
to build a Windows container here which install the various dependencies required to set things up. I also wrote down some extended notes here.There is currently a problem that I am still trying to figure out. If I compile stuff with the
libafl_cc
wrapper and with-fsanitize=address
, there is anACCESS VIOLATION
triggered before the target is even started. This gist might be related.