Commit Graph

51 Commits

Author SHA1 Message Date
Adam Joseph
2e77eb8190 clang_15: fix build!=(host==target) cross compilation
clang_15 appears to not cross compile in the build!=(host==target)
case due to two problems, which this commit fixes:

- It trips -Wmaybe-uninitialized on recent gcc, but only in the
  build!=host case (likely due to #ifdefs)

- Two more buildPlatform tools have been added:
  clang-tidy-confusable-chars-gen and clang-pseudo-gen

Co-authored-by: Rahul Butani <rrbutani@users.noreply.github.com>
2023-04-19 01:06:08 +00:00
github-actions[bot]
590fb73d67
Merge staging-next into staging 2023-03-11 00:03:08 +00:00
Alyssa Ross
8c70bfb9f2
Merge remote-tracking branch 'origin/master' into staging-next
Conflicts:
	pkgs/development/libraries/librsvg/default.nix
	pkgs/development/python-modules/r2pipe/default.nix
2023-03-10 18:46:21 +00:00
John Ericson
975e73668f
Merge pull request #219356 from alyssais/llvm-platforms
llvm: tighten platforms
2023-03-10 08:33:29 -05:00
Alyssa Ross
0fd04a5918 llvmPackages.compiler-rt: enable libclang_rt.profile-....a build
Port of 94cad6ec1a ("llvm 14 compiler-rt: enable
libclang_rt.profile-....a build").
2023-03-10 12:57:55 +00:00
Alyssa Ross
a10d676199
llvm: tighten platforms
LLVM can't be built for all architectures supported by Nixpkgs (s390,
and for some versions m68k and RISC-V).
2023-03-03 13:45:14 +00:00
Martin Weinelt
0580d85143 Merge remote-tracking branch 'origin/staging-next' into staging 2023-03-03 04:46:31 +01:00
Alyssa Ross
9bfc5871c1 llvmPackages_15.compiler-rt: drop codesign patch
This was added in 00839fea22 ("llvmPackages_15.compiler-rt: fixes for Darwin"),
which says:

> this introduces a codesigning related patch that we can drop once
> #195107 goes through

The referenced PR ("sigtool: 0.1.2 → 0.1.3") has now been merged, so
I'm dropping the patch as instructed.
2023-03-02 12:36:21 +00:00
Alyssa Ross
1db7f30d1f lld: explain why we change the stack size on Musl
Suggested-by: Rahul Butani <rrbutani@users.noreply.github.com>
2023-02-28 10:56:53 +00:00
Alyssa Ross
ed209e6279 clang_15: mark hardeningUnsupportedFlags fortify3
Port of 74ea4fe24f ("llvm*Packages.clang: mark
hardeningUnsupportedFlags fortify3").
2023-02-28 10:53:33 +00:00
github-actions[bot]
51c18e4be1
Merge staging-next into staging 2023-02-28 06:01:38 +00:00
Robert Hensing
359a46e751 llvm*: Remove outputSpecified workaround where possible
The effect of `.out // { outputSpecified = false; }` in these cases
is to select the default output explicitly, but then make the
selection implicit until `overrideAttrs` is called. Previously
`overrideAttrs` would not preserve output selection, masking the
apparently unnecessary behavior of this workaround.

For `libllvm-polly`, this logic does not apply, as it does not
select the default output.

The `outputSpecified` workaround was introduced in
https://github.com/NixOS/nixpkgs/pull/122554

and was perhaps rushed because of a release deadline, and expected
delays from mass rebuilds.

The change in `overrideAttrs` behavior was added in
5b2f597b11 / https://github.com/NixOS/nixpkgs/pull/211685

and the problem was discovered in https://github.com/NixOS/nixpkgs/pull/218537,
which may contain further information.
2023-02-28 00:34:00 +00:00
Alyssa Ross
e731fba414 llvmPackages_git.compiler-rt: fix armv7l patch
Use the same patch as compiler-rt 15.
2023-02-27 10:56:20 +00:00
Alyssa Ross
1e26d33371 clang_15: add nostdlibinc flag
Port of 44165d3657 ("llvmPackages_{14, git}.clang: add nostdlibinc flag")
to Clang 15.  It was originally thought this wasn't needed[1], but it is,
to fix expressions like the following:

	with import ./. {};

	llvmPackages_15.libcxxStdenv.mkDerivation {
	  name = "libcxx-stdenv-c++-test";

	  dontUnpack = true;

	  input = ''
	    #include <cstdlib>

	    int main() {
	        std::abort();
	        return 0;
	    }
	  '';
	  passAsFile = [ "input" ];

	  installPhase = ''
	    $CXX -c -o $out -x c++ $inputPath
	   '';
	}

[1]: https://github.com/NixOS/nixpkgs/pull/194634#issue-1398202534
2023-02-26 13:40:24 +00:00
Alyssa Ross
f9afd57302 Revert "llvmPackages_15: update licenses"
This reverts commit 386aba3115.

As I understand it from reading
<https://llvm.org/docs/DeveloperPolicy.html#copyright-license-and-patents>,
the structure of LLVM licensing is as follows:

 - They're in the process of relicensing to Apache-2.0 WITH LLVM-exception,
   but they haven't got permission to relicense all the code yet.
   This means that some of the code can be used under the new license,
   but not all of it, and it's difficult to know which is which.  This
   license is therefore probably not useful yet, until the relicensing
   effort is commit.

 - While the relicensing effort is ongoing, code being contributed to
   LLVM has to have permission to be used under the old and new
   licensing schemes.  Since the new licensing scheme can't be used
   for all code yet, it only makes sense to use LLVM's code under the
   old licensing scheme at the moment.

 - The old licensing scheme is that code for the LLVM components we
   care about is all available under the NCSA license, and some
   components are optionally available under a different license,
   usually the MIT license, instead.

So I think we should go back to just listing NCSA, or NCSA/MIT, and
forget about the new license until it actually becomes useful,
i.e. LLVM's relicensing effort is complete.
2023-02-24 00:06:46 +00:00
Alyssa Ross
7ce8e7c4cf lib.licenses.asl20-llvm: replace llvm-exception
LLVM-exception only makes sense when used with the Apache 2.0 license,
so let's combine them, so it's not possible to forget one of them like
happened with llvm_15.
2023-02-23 17:42:15 +00:00
Artturin
f9fdf2d402 treewide: move NIX_CFLAGS_COMPILE to the env attrset
with structuredAttrs lists will be bash arrays which cannot be exported
which will be a issue with some patches and some wrappers like cc-wrapper

this makes it clearer that NIX_CFLAGS_COMPILE must be a string as lists
in env cause a eval failure
2023-02-22 21:23:04 +02:00
Artturin
6f6cc4a22d treewide: use toString on list NIX_CFLAGS_COMPILE
with structuredAttrs lists will be bash arrays which cannot be exported
which will be a issue with some patches and some wrappers like cc-wrapper
2023-02-22 21:23:04 +02:00
Yureka
e27be43360
llvm_15: reenable libclang_rt.profile-....a build on musl (#217042)
This was lost because of a bad merge
2023-02-19 01:38:31 +01:00
Felix Buehler
cdb39a86e0 treewide: use optionalString 2023-02-13 21:52:34 +01:00
Sergei Trofimovich
b9a9dfc3d4 binutils: consolidate plugin-api.h support in a single
I got the plugin API support at least once incorrect. Instead of
copying the deifnition let's consolidate it within binutils itself.

While at it forward-ported changes to llvm_{13,14,15}.
The change is a no-op from rebuild perspective.
2023-01-30 22:23:36 +00:00
Rahul Butani
d231d18e4a
llvmPackages_15: expose the release information and monorepo source as overridable args
this makes it easier for users to use their own LLVM in nixpkgs
2023-01-27 14:51:38 -08:00
Rahul Butani
8afa321b8a
llvmPackages_15.llvm: add checks for the LLVM version
this is in preparation for the next commit which exposes the release
information and monorepo source as overridable args (which makes it
easier for users to use their own LLVM in nixpkgs)

this commit only adds a check in the `llvm` package's postConfigure that
makes sure the LLVM source provided matches the version we were given;
the actual machinery (functionally just a cosmetic change; causes no
rebuilds) is in the next commit
2023-01-27 14:51:12 -08:00
Rahul Butani
386aba3115
llvmPackages_15: update licenses
Context: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r1073157093

All the subprojects seem to be uniformly licensed under NCSA and the
LLVM license now (with the exception of openmp which has an additional
Intel license that doesn't seem to be in SPDX?); see:
 - https://github.com/llvm/llvm-project/blob/llvmorg-15.0.7/compiler-rt/LICENSE.TXT
 - https://github.com/llvm/llvm-project/blob/llvmorg-15.0.7/libcxx/LICENSE.TXT
 - https://github.com/llvm/llvm-project/blob/llvmorg-15.0.7/libcxxabi/LICENSE.TXT
 - https://github.com/llvm/llvm-project/blob/llvmorg-15.0.7/openmp/LICENSE.TXT
2023-01-27 13:29:23 -08:00
Rahul Butani
f8cbbdd05b
llvmPackages_15: misc fixes, notes 2023-01-27 13:29:23 -08:00
Rahul Butani
8f16b4be50
llvmPackages_15.openmp: add a missing darwin check dependency
the tests still don't all pass so `doCheck` is still disabled
2023-01-27 13:29:23 -08:00
Rahul Butani
404ef6b6c9
llvmPackages_15.clang: drop the C++ std version -DCMAKE_CXX_FLAG
Context: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r1085220705
2023-01-27 13:29:23 -08:00
Rahul Butani
3436075b2a
llvmPackages_15.llvm: specify some deps explicitly to fix cross-compilation
The two scenarios described within where splicing doesn't handle
selecting the right package for us are observable in the following
(nix repl session):
```
> np = import <nixpkgs> { system = "x86_64-linux"; crossSystem = { config = "aarch64-linux"; }; }

> np.__splicedPackages.hello ? __spliced
true

> np.__splicedPackages.python3Packages.psutil ? __spliced
true

> np.__splicedPackages.python3.pkgs.psutil ? __spliced
false

> (np.__splicedPackages.python3.withPackages (ps: with ps; [psutil])) ? __spliced
false
```

See: #211340
2023-01-27 13:29:23 -08:00
Rahul Butani
5e5ed7d816
llvmPackages_15.llvm: disable some RISC-V ZBP tests on arm32
see this thread for context: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999790443

Co-authored-by: misuzu <bakalolka@gmail.com>
2023-01-27 13:29:23 -08:00
Rahul Butani
eafb8fbd32
llvmPackages_15.llvm: fix the tests on x86_64-darwin
Details within but ultimately there isn't a satisfying resolution for
any of the three test failures we were seeing and all three deserve
further exploration.

For the `sw_vers` macOS version issue in particular, it's possible to
observe the nixpkgs provided `CoreFoundation` vs system `CoreFoundation`
for `x86_64` and `aarch64` like so (on a host running macOS `13.0.1`):

```console
$ nix-shell -p darwin.DarwinTools --system aarch64-darwin --command "sw_vers"
ProductName:    macOS
ProductVersion: 13.0.1
BuildVersion:   22A400

$ nix-shell -p darwin.DarwinTools --system x86_64-darwin --command "sw_vers"
ProductName:    Mac OS X
ProductVersion: 10.16
BuildVersion:   22A400
```

Where `/System/Library/CoreServices/SystemVersion.plist` has:
```console
$ cat /System/Library/CoreServices/SystemVersion.plist | grep ProductVersion
-A 1
	<key>ProductVersion</key>
	<string>13.0.1</string>
```

Further:
```console
$ nix-shell -p darwin.DarwinTools --system aarch64-darwin --command 'otool -L $(which sw_vers)'
/nix/store/nb2q33ak2zif49ndcpc6m823z0vhmy8y-DarwinTools-1/bin/sw_vers:
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1770.255.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.60.1)

$ nix-shell -p darwin.DarwinTools --system x86_64-darwin --command 'otool -L $(which sw_vers)'
/nix/store/88v4kjvgwl71byfpvd0baviiq7l5appc-DarwinTools-1/bin/sw_vers:
	@rpath/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1454.90.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)
```

For the `x86_64` `sw_vers` binary we can see rpath:
```console
$ nix-shell -p darwin.DarwinTools --system x86_64-darwin --command 'otool -l $(which sw_vers)' | grep LC_RPATH -A 2 -B 1
Load command 13
          cmd LC_RPATH
      cmdsize 120
         path /nix/store/zvr4wypbgskhhw9cawfn7mmxfa75nh8f-swift-corefoundation-unstable-2018-09-14/Library/Frameworks (offset 12)
```

And we can confirm that the nixpkgs provided `CoreFoundation` is what
ultimately gets loaded:
```console
$ nix-shell -p darwin.DarwinTools --system x86_64-darwin --command 'DYLD_PRINT_LIBRARIES=1 sw_vers'
dyld[16215]: <no uuid> /nix/store/88v4kjvgwl71byfpvd0baviiq7l5appc-DarwinTools-1/bin/sw_vers
dyld[16215]: <no uuid> /nix/store/zvr4wypbgskhhw9cawfn7mmxfa75nh8f-swift-corefoundation-unstable-2018-09-14/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
dyld[16215]: <no uuid> /nix/store/xd2a4xh8kdwq0j67hzgw720npdw5hzkk-ICU-66108/lib/libicucore.A.dylib
<snipped>
```

```bash
nix-diff \
    $(nix path-info nixpkgs#legacyPackages.aarch64-darwin.darwin.DarwinTools --derivation) \
    $(nix path-info nixpkgs#legacyPackages.x86_64-darwin.darwin.DarwinTools --derivation)
```
doesn't show any _obvious_ discrepancies
2023-01-27 13:29:22 -08:00
Rahul Butani
0ee52512f0
llvmPackages_15.llvm: adjust a path, skip an xfail test on darwin 2023-01-27 13:29:22 -08:00
Rahul Butani
c7231c0b6d
llvmPackages_15.llvm: run the tests on macOS
there are a few parts to this:
  - adding darwin specific check deps
  - working around referencing LLVM dylibs during the checkPhase in a
    way that supports darwin
    + previously we just set `$LD_LIBRARY_PATH` and/or made some
      strategic symlinks
    + now we have LLVM's `lit` config set the appropriate env vars as
      needed (as is done for other LLVM subprojects)
    + in retrospect switching to `installCheckPhase` might have been the
      better move..
  - patching `lit` to deal with `$DYLD_LIBRARY_PATH` being purged for
    new "protected" processes

more details within.
2023-01-27 13:29:22 -08:00
Rahul Butani
6d0c87602f
llvmPackages_15.llvm: add in a missing check dep 2023-01-27 13:29:22 -08:00
Rahul Butani
2a58596dd2
llvmPackages_15.llvm: enable polly by default
this comment has a more complete history: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r1064089830

in short: polly was disabled in the llvm 11 -> llvm 12 copy, mostly by
accident

most of the Polly install dirs patch has been upstreamed; one change
remains
2023-01-27 13:29:22 -08:00
Rahul Butani
4d3857d6ed
llvmPackages_15: expand the NIX_BUILD_CORES arg passed to lit at configure time
this previously worked because, when using Make, this variable was
expanded at build time
2023-01-27 13:29:22 -08:00
Rahul Butani
912056c71e
llvmPackages_15: switch to using ninja 2023-01-27 13:29:22 -08:00
Rahul Butani
19d1571ee4
llvmPackages_15.lldb: fix the manpages 2023-01-27 13:29:22 -08:00
Rahul Butani
b4ee532f36
llvmPackages_15.lldb: fix the build on i686
as detailed within, adding `asm/ptrace.h` leads to `asm/ptrace-abi.h`
being included which defines preprocessor symbols that clash with
identifiers used in the LLVM headers (`FS` and `CS` only defined on
i686)
2023-01-27 13:29:22 -08:00
Rahul Butani
1d3ca42323
llvmPackages_15.lldb: fix lldb on x86_64 macOS
See:
https://github.com/NixOS/nixpkgs/pull/194634#issuecomment-1272129132
2023-01-27 13:29:22 -08:00
Rahul Butani
d7299071d4
llvmPackages_15.compiler-rt: gate the libxcrypt dep on plat.libc == "glibc"
This restores this check to what it originally was in #196909 (see:
https://github.com/NixOS/nixpkgs/pull/196909#discussion_r1000536298) and
lets `compiler-rt` eval successfully when trying to compile the
`llvmPackages_15` set for mingw targets (i.e. a platform that *is* GNU
but does *not* use glibc).

---

It's not clear to me what the `haveLibc` check is doing here (platforms
that seem to use glibc like `x86_64-linux` and have
`plat.libc == "glibc"` have `haveLibc = false` because `stdenv.cc.libc`
is `null`).
2023-01-27 13:29:21 -08:00
Rahul Butani
f91fad438b
llvmPackages_15.compiler-rt: update the armv7l patch
see the discussion here for context:
https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999829893
2023-01-27 13:29:21 -08:00
Rahul Butani
09b8886d5e
llvmPackages_15.compiler-rt: apply #186575 to llvmPackages_15 2023-01-27 13:29:21 -08:00
Rahul Butani
00839fea22
llvmPackages_15.compiler-rt: fixes for Darwin
this introduces a codesigning related patch that we can drop once #195107
goes through

see: https://github.com/NixOS/nixpkgs/pull/194634#issuecomment-1272116014
2023-01-27 13:29:21 -08:00
Rahul Butani
501a9e1b4c
llvmPackages_15.libcxxabi: fix cycles that arise when stdenv is the LLVM stdenv 2023-01-27 13:29:21 -08:00
Rahul Butani
ca59a201ca
llvmPackages_15.libcxx: use clang 15 instead of the stdenv's compiler
libc++ has switched to using `__attribute__((using_if_exists))` to handle
incomplete libc implementations; see: a9c9183ca4

These essentially require a modern C++ compiler (clang gained support in
LLVM 13: 369c648399,
gcc appears to not have support yet: https://gcc.gnu.org/bugzilla//show_bug.cgi?id=105584).

Previously this was not an issue for us (despite the transition happening
around LLVM 13) but something about the changes to the libc++/libc++-abi
build has made it so that on platforms with incomplete libc impls (i.e.
Darwin is missing `quick_exit`/`at_quick_exit`) we error during the `libcxx-abi`
build when the stdenv's (older, not supporting `using_if_exists`) compiler
tries to import libc symbols that aren't present.

The libc++ docs suggest we use a modern compiler to build libc++ anyways
(https://releases.llvm.org/15.0.0/projects/libcxx/docs/index.html#platform-and-compiler-support)
so this commit uses stdenv's containing the package set's clang to build
libcxx/libcxx-abi.

This is similar to how libc++ bootstrapping builds (https://releases.llvm.org/15.0.0/projects/libcxx/docs/BuildingLibcxx.html#bootstrapping-build)
work.
2023-01-27 13:29:21 -08:00
Rahul Butani
4fabcf4945
llvmPackages_15: apply #211230 to llvmPackages_15
See the comments here for context: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r1089389188

Co-authored-by: Weijia Wang <9713184+wegank@users.noreply.github.com>
2023-01-27 13:29:21 -08:00
Rahul Butani
3b6d98d2b0
llvmPackages_15.compiler_rt: apply #196909 to LLVM 15
`llvmPackages_15` originates from `llvmPackages_git` which does
not include this change
2023-01-27 13:29:21 -08:00
Rahul Butani
bc4dbee115
llvmPackages_15: updates for LLVM 15
None of the patches required any touch-up; the only change of note is:
  - due to changes in the libc++/libc++abi build
    (https://reviews.llvm.org/D120719 and https://reviews.llvm.org/D131037)
    we have to add an extra build option to the libc++ header only
    build that sidesteps bits of the libc++ build config that assume
    libc++-abi is present in the build:
    4f827318e3/libcxx/src/CMakeLists.txt (L255-L256)

Rather than maintaining a precise set of build options that let us dodge
referencing libc++-abi variables in the libc++ header only build, we set
`LIBCXX_CXX_ABI` to `none`, as suggested by @lovesegfault.

More discussion about this here: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r990267037

Co-authored-by: Bernardo Meurer <bernardo@meurer.org>
2023-01-27 13:29:21 -08:00
Rahul Butani
9bd92679c2
llvmPackages_15: apply some patches from llvmPackages_14, part 2
See https://github.com/NixOS/nixpkgs/pull/194634#issue-1398202534 for
details.

PRs:
  - #211401
  - #211161
  - #206742
  - #211687
2023-01-27 13:29:21 -08:00
Rahul Butani
81ef82a029
llvmPackages_15: apply some patches from llvmPackages_14
See #194634 for details.

PRs:
  - #191372
  - #190936
  - #82131
  - #199844
  - #197674
  - #184408
  - #193004
2023-01-27 13:29:20 -08:00