-
Notifications
You must be signed in to change notification settings - Fork 116
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
Add support for building with ClangCL on Windows #111
Conversation
I need to add flag checking probably... |
CMakeLists.txt should probably exclude if(CMAKE_C_COMPILER_ID MATCHES "AppleClang|Clang") |
I just had a few minutes to test earlier 😅 I think a better way is to check if the compiler supports a given flag so it works without explicit compiler checks, I'll give that a try... |
Ok, we need the |
4c83b39
to
27d4c91
Compare
@bnoordhuis Can I have an extra brain here? :-) Currently this is failing with:
Which AFAIS is because the int128 functions are in clang-rt and not in MS's crt. I guess we need to embed that? A cursory look suggests it got fixed in Clang 17.X but that doesn't seem available here... Any ideas? |
You probably only need to reimplement divdq and muldq and I think you can do that with _udiv128 and _umul128 from |
I'm going to need a passport to travel so far away from my comfort zone 😅 I'll give it a try! |
I had a look and I don't think my suggestion is going to work - libbf.h also references int128_t and uint128_t - but what you can probably do is forcing LIMB_BITS to 32, i.e.: diff --git a/libbf.h b/libbf.h
index dacc2a6..a11016d 100644
--- a/libbf.h
+++ b/libbf.h
@@ -27,7 +27,7 @@
#include <stddef.h>
#include <stdint.h>
-#if INTPTR_MAX >= INT64_MAX
+#if INTPTR_MAX >= INT64_MAX && !defined(_WIN32)
#define LIMB_LOG2_BITS 6
#else
#define LIMB_LOG2_BITS 5 |
Thanks for taking a look! 🙏 |
Fucking A Ben! I think the test can be related to !defined(_MSC_VER) since compiling with MinGW GCC is ok, only ClangCL seems to be the problem. In addition, I'll check if the direct dispatch change is necessary. It gives a warning about gnu style labels but if it works I guess we don't need to change it. |
I'm not 100% sure but I can see that breaking when:
...because compiler-rt doesn't provide the builtins mingw emits. |
52b65ba
to
6e6a4fd
Compare
@bnoordhuis I think this one is ready! The rabbithole was deeper than I thought! 😅 |
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.
👍
Since ClangCL is compatible with MSVC this should get us almost there. Ref: https://clang.llvm.org/docs/MSVCCompatibility.html
No description provided.