- add patch from 2 upstream commits that were not backported to llvm_18
and llvm_19:
https://github.com/llvm/llvm-project/commit/41eb186fbb024898bacc2577fa3b88db0510ba1f
Fixes build failure with gcc15:
```
In file included from /build/mlir-src-18.1.8/mlir/lib/Dialect/Affine/IR/ValueBoundsOpInterfaceImpl.cpp:9:
/build/mlir-src-18.1.8/mlir/include/mlir/Dialect/Affine/IR/ValueBoundsOpInterfaceImpl.h:31:11:
error: 'int64_t' was not declared in this scope
31 | FailureOr<int64_t> fullyComposeAndComputeConstantDelta(Value value1,
| ^~~~~~~
/build/mlir-src-18.1.8/mlir/include/mlir/Dialect/Affine/IR/ValueBoundsOpInterfaceImpl.h:13:1:
note: 'int64_t' is defined in header '<cstdint>'; this is probably
fixable by adding '#include <cstdint>'
12 | #include "mlir/Support/LogicalResult.h"
+++ |+#include <cstdint>
13 |
```
https://github.com/llvm/llvm-project/commit/101109fc5460d5bb9bb597c6ec77f998093a6687
Fixes failure with gcc15:
```
In file included from /build/mlir-src-19.1.7/mlir/lib/Target/SPIRV/Deserialization/Deserialization.cpp:9:
/build/mlir-src-19.1.7/mlir/include/mlir/Target/SPIRV/Deserialization.h:29:51:
error: 'uint32_t' was not declared in this scope
29 | OwningOpRef<spirv::ModuleOp> deserialize(ArrayRef<uint32_t> binary,
| ^~~~~~~~
/build/mlir-src-19.1.7/mlir/include/mlir/Target/SPIRV/Deserialization.h:18:1:
note: 'uint32_t' is defined in header '<cstdint>'; this is probably
fixable by adding '#include <cstdint>'
17 | #include "mlir/Support/LLVM.h"
+++ |+#include <cstdint>
18 |
```
First patch can be applied with `fetchpatch`, but only on llvm_19, because
of changed include line right above.
So use 2 versions of combined patches with 2 commits.
update code to not assume that x64 darwin uses sdk 10.12. These changes
want to reach into apple_sdk.sdk to grab a header file which is only
required for sdk 10.12.
Native builds on nixpkgs FreeBSD always use llvm's libc++ as the
C++ standard library, with libcxxrt and "libgcc" from the FreeBSD tree
providing lower level ABI functions.
However, the cross LLVM stdenv assumed that we wanted libunwind instead
of libgcc. As libgcc headers are already in FreeBSD's libc, some C++
functions failed with duplicate header errors.
Disable all references to libunwind in libcxx on FreeBSD and the LLVM
cross stdenvs for FreeBSD.
... consistently.
Further to #307211, allow overriding arguments through llvmPackages.override.
This makes it possible to override any dependency of LLVM or
clang by overriding it on `llvmPackages.override { <dependency> = ...; }`.
This is useful in development or customization where sometimes it is
desirable to turn features on or off.
Without this patch the only way to for example override ncurses was to
do `overriddenLLVM = llvmPackages.llvm.override { ncurses }`, but then
you would have to thread `overriddenLLVM` as dependencies into clang and
other packages, which results in quite a difficult expression to write
correctly in cross compilation scenarios.
Signed-off-by: Peter Waller <p@pwaller.net>
This patch is not intended to introduce any functional change. drvPaths
should remain unchanged; if they do change, it's a bug.
Prior to this patch, a set of packages gets passed through from the
llvmPackages top level function to the individual packages via
callPackages, which is a newScope constructed with some specific
arguments.
As it stands this makes it harder to override dependencies of LLVM; for
example take ncurses. If you want to override it, it is an argument to
libllvm, however, if you override libllvm you then have to write a lot
of code to have correctly overridden clang, given how llvmPackages is
previously composed (out of tools and libraries).
Instead, I propose to make sure that all the dependencies of all
llvmPackages are listed as an inputs to the top leve llvmPackages,
and then the resulting newScope will contain all of them. This in
turn will make `llvmPackages.override` work as expected for any
input to each of the llvm packages.
We'll achieve this by first simplifying the code a bit and ensuring that
all arguments to llvmPackage get forwarded to all packages (via
`{}@args`).
This represents a chance to simplify things a bit so I propose doing it
in two steps:
1. This patch: Simplify argument pass through.
2. (Later): Ensure all arguments to each llvm package are listed in the
top level `llvm/X/default.nix`.
Once the second patch lands, this means that `(llvmPackages.override {
ncurses = myncurses; }).clang` would consist of a clang whose libllvm
had the ncurses overridden. This is not the case prior to this patch.
Signed-off-by: Peter Waller <p@pwaller.net>
Currently, overriding llvmPackages.libllvm doesn’t work correctly. The
original version of libllvm will also be built because it is referenced
by libclang. Switching to the fixpoint allows the override to be
propagated to clang as expected. This will be needed for future Darwin
stdenv bootstrap improvements.