-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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 mingwW64-llvm cross-system. #171418
Add mingwW64-llvm cross-system. #171418
Changes from all commits
4447d40
504d38a
4b503b2
a73b59a
dee9af9
4c0d5f8
078a077
5ca96b9
b7b9b73
5c0654f
15aa32e
d68a532
98a853c
f4d5830
b08eed0
f28101d
5e8a857
ece10a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# ld.lld has two incompatible command-line drivers: One for the gnu-compatible COFF linker and one for | ||
# the ELF linker. If no emulation is set (with -m), it will default to the ELF linker; | ||
# unfortunately, some configure scripts use `ld --help` to check for certain Windows-specific flags, | ||
# which don't show up in the help for the ELF linker. So we set a default -m here. | ||
|
||
extraBefore+=("-m" "@mtype@") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ lib, stdenv, llvm_meta, src, cmake, python3, fixDarwinDylibNames, version | ||
, libcxxabi | ||
, libcxxabi, libunwind | ||
, enableShared ? !stdenv.hostPlatform.isStatic | ||
|
||
# If headersOnly is true, the resulting package would only include the headers. | ||
|
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec { | |
nativeBuildInputs = [ cmake python3 ] | ||
++ lib.optional stdenv.isDarwin fixDarwinDylibNames; | ||
|
||
buildInputs = lib.optionals (!headersOnly) [ libcxxabi ]; | ||
buildInputs = lib.optionals (!headersOnly) ([ libcxxabi ] ++ lib.optional libcxxabi.useLLVMUnwinder libunwind); | ||
|
||
cmakeFlags = [ "-DLIBCXX_CXX_ABI=libcxxabi" ] | ||
++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1" | ||
|
@@ -41,7 +41,13 @@ stdenv.mkDerivation rec { | |
"-DLIBCXX_ENABLE_THREADS=OFF" | ||
"-DLIBCXX_ENABLE_FILESYSTEM=OFF" | ||
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF" | ||
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF"; | ||
] | ||
++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF" | ||
++ lib.optionals (!headersOnly && libcxxabi.semi-static) [ | ||
"-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=TRUE" | ||
"-DLIBCXX_CXX_ABI_LIBRARY_PATH=${libcxxabi}/lib" | ||
] ++ lib.optional (!headersOnly && libcxxabi.useLLVMUnwinder) | ||
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious about this; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I got link errors without this, I wouldn't be surprised if it's only needed when There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In which versions, @sternenseemann? I don't see that in LLVM 13's There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was looking at LLVM 9, but the comment is still there on |
||
|
||
buildFlags = lib.optional headersOnly "generate-cxx-headers"; | ||
installTargets = lib.optional headersOnly "install-cxx-headers"; | ||
|
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.
Isn't
useLLVM
the only way to get a compiler-rtstdenv.cc
at the moment?stdenv.hostPlatform.useLLVM or false
should also be a feasible replacement.This disambiguator is probably useful regardless, but I'm wondering if we should be conservative about what we tack on here and if there's possibly a better system for this?
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.
No, you can use this with
llvmPackages.tools.clangUseLLVM
etc.Probably there is a better system. e.g. something like
compiler-rt
is perhaps plausibly an attribute of the platform (if it's required to be consistent across libraries and executables being linked together) whereas something like the linker really isn't (at least on platforms where there are multiple interchangeable linkers). But I'd prefer to separate out these improvements to how these are handled from the functional addition in this PR, unless there's a better current alternative.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.
@sternenseemann yeah I think this is good too.
useLLVM
is kind of a sledge hammer when we ought to support more mix and match. I would not be opposed to specifying the default like we do for the linker in the platform description, but non-default compilers can do different things so we can track in the wrapper too.