Commit graph

788 commits

Author SHA1 Message Date
github-actions[bot] 8d9549f31c
Merge master into staging-next 2021-06-10 00:06:41 +00:00
Andreas Rammhold cb51b41ccf
llvmPackages_git: fix variable shadowing
The first substitution was not passed to the 2nd re.sub call as seems to
be the intention of the original change.
2021-06-09 18:49:41 +02:00
github-actions[bot] 6076dbb085
Merge master into staging-next 2021-06-06 12:14:32 +00:00
Robert Scott 20b3d65d34
Merge pull request #125472 from veprbl/pr/clang_12_darwin_fix
llvmPackages_12.compiler-rt: fix build on darwin
2021-06-06 11:40:58 +01:00
github-actions[bot] 68272fcebd
Merge master into staging-next 2021-06-05 12:14:47 +00:00
Michael Weiss c330272504
llvmPackages_git: Add update-git.py
Not that pretty but it should get the job done.
2021-06-05 13:39:17 +02:00
github-actions[bot] 5b9da195a0
Merge master into staging-next 2021-06-04 01:45:17 +00:00
John Ericson 67eb7b4acc
Merge pull request #120780 from primeos/llvm_git
llvmPackages_git: init at 12.0.0
2021-06-03 19:48:03 -04:00
Michael Weiss a7f062d898
llvmPackages_git: Build from Git
The version will initially remain the same so that no additional changes
to the packaging are required (i.e. this commit only includes the
required changes to build from the mono repository instead of individual
tarballs).
2021-06-03 20:33:35 +02:00
Michael Weiss e458a01401
llvmPackages_git: Copy from llvmPackages_12
The purpose of this package is to continuously improve the LLVM
packaging in Nixpkgs without causing a lot of rebuilds and provide more
recent LLVM builds for users. For more details see:
https://github.com/NixOS/nixpkgs/issues/114828
2021-06-03 20:14:05 +02:00
github-actions[bot] a12e0d5bff
Merge master into staging-next 2021-06-03 12:49:11 +00:00
Domen Kožar aeb44a891a
Merge pull request #125184 from domenkozar/aarch64-darwin-eval
Aarch64 darwin eval
2021-06-03 11:21:20 +02:00
Domen Kožar 9e6417f2a4
fix tarball job evaluation for aarch64-darwin 2021-06-03 10:52:46 +02:00
Dmitry Kalinkin cf4e1b9e62
llvmPackages_12.compiler-rt: fix build on darwin
```
/tmp/nix-build-compiler-rt-libc-12.0.0.drv-0/compiler-rt-12.0.0.src/lib/sanitizer_common/sanitizer_mac.cpp:617:7: error: use of undeclared
      identifier 'TARGET_OS_IOS'
  if (TARGET_OS_IOS || TARGET_OS_TV) return 6;
      ^
/tmp/nix-build-compiler-rt-libc-12.0.0.drv-0/compiler-rt-12.0.0.src/lib/sanitizer_common/sanitizer_mac.cpp:617:24: error: use of undeclared
      identifier 'TARGET_OS_TV'
  if (TARGET_OS_IOS || TARGET_OS_TV) return 6;
                       ^
/tmp/nix-build-compiler-rt-libc-12.0.0.drv-0/compiler-rt-12.0.0.src/lib/sanitizer_common/sanitizer_mac.cpp:618:7: error: use of undeclared
      identifier 'TARGET_OS_WATCH'
  if (TARGET_OS_WATCH) return 13;
      ^
/tmp/nix-build-compiler-rt-libc-12.0.0.drv-0/compiler-rt-12.0.0.src/lib/sanitizer_common/sanitizer_mac.cpp:687:7: error: use of undeclared
      identifier 'TARGET_OS_IOS'
  if (TARGET_OS_IOS || TARGET_OS_TV)
      ^
/tmp/nix-build-compiler-rt-libc-12.0.0.drv-0/compiler-rt-12.0.0.src/lib/sanitizer_common/sanitizer_mac.cpp:687:24: error: use of undeclared
      identifier 'TARGET_OS_TV'
  if (TARGET_OS_IOS || TARGET_OS_TV)
                       ^
/tmp/nix-build-compiler-rt-libc-12.0.0.drv-0/compiler-rt-12.0.0.src/lib/sanitizer_common/sanitizer_mac.cpp:689:12: error: use of undeclared
      identifier 'TARGET_OS_WATCH'
  else if (TARGET_OS_WATCH)
           ^
6 errors generated.
```
2021-06-03 03:08:10 -04:00
github-actions[bot] 65e3e9dc51
Merge master into staging-next 2021-06-01 07:50:21 +00:00
Zhaofeng Li 8f80568885 llvm{9,11}: Disable tests on RISC-V
The test suite leads to nothing but tears, sorrow, and wasted build
time. It probably should be disabled for all of them but doing only
9 (llvmPackages) and 11 (llvmPackages_latest, Rust) for now. Some of
the failures have been fixed in LLVM main:

- https://reviews.llvm.org/D97490
- https://reviews.llvm.org/D91043
2021-05-31 14:55:19 -07:00
github-actions[bot] 0a0c0a9fb9
Merge staging-next into staging 2021-05-20 18:36:04 +00:00
Andrew Childs 2987d66d0f llvmPackages_11.compiler-rt: fix build on x86_64-darwin
Amendment to changes in 56fcbcd154.

Co-authored-by: John Ericson <John.Ericson@Obsidian.Systems>
2021-05-19 12:33:53 -07:00
sternenseemann 3530837417 llvmPackages*.clang: fix linker invocation with LLVMgold plugin
When using GNU binutils, clang passes the LLVMgold.so plugin to the
linker for certain operations that require special support in the linker
like doing link time optimization (LTO). When passing the plugin to the
linker's command line, clang assumes that llvm and itself are installed
in the same prefix and thus `/path/to/clang/bin/../lib/LLVMgold.so` is
the plugin.

Since we install clang and llvm to separate store paths, this assumption
does not hold. When clang-unwrapped only had a single output, we worked
around this issue by symlinking `$out/lib/LLVMgold.so` to
`${llvm}/lib/LLVMgold.so`. However since we split all llvm packages into
multiple outputs clang's `$out` no longer has a lib directory and clang
can't discover clangs lib output on its own. As a result LTO was broken.

Instead of introducing yet another hack and having a symlink to
LLVMgold.so in `$out/lib` (despite having `$lib/lib` as well), we patch
clang to use a hard coded path to `${libllvm.lib}/lib` for discovering
`LLVMgold.so`.

Resolves #123361.
2021-05-18 16:15:03 +02:00
Andrew Childs 56fcbcd154 llvmPackages_11: darwin cross compilation and bootstrapping 2021-05-17 00:28:05 +09:00
Andrew Childs c99904e113 clang_11: revert -fno-common default 2021-05-17 00:27:02 +09:00
John Ericson 4236fb1c7f
Merge pull request #123103 from sternenseemann/compiler-rt-resources
llvmPackages_{7-12}.compiler-rt: install resource files to DATADIR
2021-05-15 12:06:57 -07:00
github-actions[bot] c10600230e
Merge staging-next into staging 2021-05-15 18:30:31 +00:00
sternenseemann 74f709f62e llvmPackages_{7,8,9}: link ${compiler-rt.out}/share to resource root
This is done for 10-12, but not for the earlier llvm package sets.
2021-05-15 18:35:44 +02:00
sternenseemann 0046076950 llvmPackages_{7-12}.compiler-rt: install resource files to DATADIR
This is in an effort to fix the following build failure shown by
chromium:

    clang++: error: no such file or directory: '/nix/store/fhd89wrmkx6nflzjk0d6waz70bk3zc4i-clang-wrapper-12.0.0/resource-root/share/cfi_blacklist.txt'

As it turns out a change introduced via the gnu-install-dirs.patch
caused `add_compiler_rt_resource_file` to install resource files to
$dev/include (FULL_INCLUDEDIR) instead of $out/share (FULL_DATADIR)
which in turn meant that the clang wrappers we had didn't link those
files to its resource root at all.

Alternative fix to this would have been to link
compiler-rt.dev/include/*.txt to the wrappers resource-root/share as
well, but since this was handled inconsistently across the patch anyways
(the dfsan list is installed correctly), opt to handle this
consistently within the patch.

llvmPackages_{5,6} install the resource files to a completely different
location and need separate investigation.
2021-05-15 18:35:43 +02:00
sternenseemann 91cba7b0a9 llvmPackages_{10,11,12}.compiler-rt: install resource txts to $out/share
7869d16545 changed how resource files are
installed. Likely by accident, now some of the resource files are
installed to $dev/include instead of $out/share. This causes the cc
wrapper's resource-root to miss those files from compiler-rt as they are
in a different place than expected.

This commit fixes all instances of this incorrect installation for
llvmPackages_10, 11 and 12 which are the only llvm package sets which
link ${targetLlvmLibraries.compiler-rt.out}/share to the resource-root.

For the other llvm package set this will likely also need to be fixed,
but it doesn't have to have immediate urgency and doing it in two steps
allows us to (hopefully) fix the chromium build without causing a darwin
stdenv rebuild.

The full fix can be found in #123103 and should probably be included in
the next staging-next rotation.
2021-05-15 17:40:24 +02:00
John Ericson 7dd53fe56e
Merge pull request #122778 from Ericson2314/choose-linker
treewide: Allow the linker to be chosen independently
2021-05-14 18:53:14 -04:00
John Ericson 93e6a25f50
Merge pull request #123047 from sternenseemann/usellvm-lunwind
llvmPackages_*.lldClang: pass -lunwind if exceptions are enabled
2021-05-14 18:51:34 -04:00
sternenseemann f506019942 llvmPackages_*.lldClang: pass -lunwind if exceptions are enabled
To successfully compile C++ with useLLVM we need an unwinder and
thus to explicitly -lunwind like it has been done for the android
cross targets.
2021-05-15 00:34:50 +02:00
John Ericson 18c38f8aee treewide: All the linker to be chosen independently
This will begin the process of breaking up the `useLLVM` monolith. That
is good in general, but I hope will be good for NetBSD and Darwin in
particular.

Co-authored-by: sterni <sternenseemann@systemli.org>
2021-05-14 21:29:51 +00:00
Vladimír Čunát 1a7ef60b2f
Merge #122803: llvm*: patch to fix a test on older CPUs 2021-05-14 22:31:23 +02:00
John Ericson 49d2653653
Merge pull request #122974 from sternenseemann/lldClang-no-double-wrap
llvmPackages_*.lldClang: don't wrap bintools twice
2021-05-14 14:52:57 -04:00
sternenseemann f7b49ea2af llvmPackages_12.lld: make sure llvm libunwind is passed
lld needs LLVM's libunwind for its headers. That libunwind is not part
of the tools scope in pkgs/development/compilers/llvm/12/default.nix,
which means that lld previously received libunwind from top-level pkgs
which of course doesn't have the required headers.

To resolve this pass libunwind from the libraries scope — platform
concerns don't really mattern as only libunwind.src is used.

libunwind was initially passed correctly, but that was removed in
e830db4320. This regression was likely
introduced accidentally.
2021-05-14 16:23:12 +02:00
sternenseemann 3eaa00879c llvmPackages_*.lldClang: don't wrap bintools twice
The bintools argument received a wrapped version of tools.bintools which
is already wrapped. Wrapped bintools twice leads to users of lldClang
being unable to find the tools which are not wrapped like ar.
2021-05-14 12:50:41 +02:00
Vladimír Čunát ea306f6dfc
llvm*: patch to fix a test on older CPUs
- 10, 11, 12: use the upstream patch
- 9: use Luke's patch as the upstream patch won't apply
2021-05-13 10:43:45 +02:00
Vladimír Čunát ba2140b657
Merge #122044: compiler-rt: Fix build by passing resource dir
Fast-forwarded from staging to staging-next.  See:
https://github.com/NixOS/nixpkgs/pull/111487#issuecomment-840088733
2021-05-12 22:55:14 +02:00
John Ericson 22da550728
Fast-forward PR #122399 from staging to staging-next
compiler-rt: Revert passing `COMPILER_RT_OS_DIR` and not symlinking libs
(cherry picked from commit 680b33fe37)
https://github.com/NixOS/nixpkgs/pull/111487#issuecomment-840078869
2021-05-12 22:43:52 +02:00
John Ericson e830db4320 llvmPackages: Fix more inconsistencies
The main thing was using `llvm_meta` in all versions.

Secondarily:

 - libunwindx7: Forgot to split outputs

 - libcxx{,abi} 12: Forgot to apply output-splitting patches.

 - simplify `useLLVM` stdenv-switching logic.

 - openmp always gets its own directory
2021-05-12 00:16:11 +00:00
John Ericson 37194a325d treewide: Try to make a few bootstrapping things more consistent
- Introduce `preLibcCrossHeaders` to bootstrap libgcc and compiler-rt
  the same way.

- Organize LLVM bintools as `bintools{-unwrapped,,NoLibc}` for
  consistency with GNU Binutils and Apple's cctools.

- Do Android changes for all `llvmPackages` for consistency.

- Improve the way the default GCC and LLVM versions are selected.
2021-05-12 00:14:56 +00:00
John Ericson e0d3c9d031 llvmPackages*.libcxx*: Always use the attribute name for pname
This decision was made in a902d99422 but
just for LLVM 12. Now we apply it consitently.
2021-05-12 00:14:56 +00:00
John Ericson 894f0c6ec8 llvmPackages: Always put libunwind before openmp
This keeps the "main bootstrap" together.
2021-05-12 00:13:13 +00:00
sternenseemann 4caedc060f llvmPackages_12.libunwind: Make sure we get right llvm version 2021-05-12 00:12:51 +00:00
sternenseemann 894a09dfd2 llvmPackages_7.lldClang: add libunwind to extraLibraries 2021-05-12 00:12:40 +00:00
sternenseemann 53adcfb798 llvmPackages_7.libunwind: simplify expressions
* Use LLVM_PATH instead of llvm-config
* Pass less unnecessary options to cmake
2021-05-12 00:08:02 +00:00
John Ericson cf02b24813 Merge remote-tracking branch 'upstream/staging-next' into staging 2021-05-11 22:30:46 +00:00
s1341 1e1d29c2af treewide: Support aarch64-android using minimal prebuilt components
This PR adds a new aarch64 android toolchain, which leverages the
existing crossSystem infrastructure and LLVM builders to generate a
working toolchain with minimal prebuilt components.

The only thing that is prebuilt is the bionic libc. This is because it
is practically impossible to compile bionic outside of an AOSP tree. I
tried and failed, braver souls may prevail. For now I just grab the
relevant binaries from https://android.googlesource.com/.

I also grab the msm kernel sources from there to generate headers. I've
included a minor patch to the existing kernel-headers derivation in
order to expose an internal function.

Everything else, from binutils up, is using stock code. Many thanks to
@Ericson2314 for his help on this, and for building such a powerful
system in the first place!

One motivation for this is to be able to build a toolchain which will
work on an aarch64 linux machine. To my knowledge, there is no existing
toolchain for an aarch64-linux builder and an aarch64-android target.
2021-05-11 15:39:08 +00:00
Vladimír Čunát 6b3b7940ff
llvm*Packages: fix output selection (lib.get*) 2021-05-11 10:45:11 +02:00
John Ericson 8629936f82 compiler-rt: Revert passing COMPILER_RT_OS_DIR and not symlinking libs
In 7869d16545 I got rid of the symlinking
by forcing `COMPILER_RT_OS_DIR` to always be the empty string. I thought
this was good because it just make compiler-rt be installed in a normal
way.

However, various LLVM tools expect the `COMPILER_RT_OS_DIR` to be set
normally, and fail to find things when they aren't in the expected lib
subdir.

Maybe it would be best to patch that too in the long term, but for now
we just undo this change.
2021-05-09 22:52:09 +00:00
John Ericson fc7a998748 compiler-rt: Fix build by passing resource dir
Before, clang was able to find some headers with a relative path to the
`-B` flag pointing near the unwrapped clang binary. But with multiple
outputs that doesn't work, so we use a "resource directory" as it done
later in the bootstrap.
2021-05-07 16:39:19 +00:00
Andrew Childs 7869d16545 llvmPackages: Multuple outputs for everythting
Also begin to start work on cross compilation, though that will have to
be finished later.

The patches are based on the first version of
https://reviews.llvm.org/D99484. It's very annoying to do the
back-porting but the review has uncovered nothing super major so I'm
fine sticking with what I've got.

Beyond making the outputs work, I also strove to re-sync the packages,
as they have been drifting pointlessly apart for some time.

----

Other misc notes, highly incomplete

- lvm-config-native and llvm-config are put in `dev` because they are
  tools just for build time.

- Clang no longer has an lld dep. That was introduced in
  db29857eb3, but if clang needs help
  finding lld when it is used we should just pass it flags / put in the
  resource dir. Providing it at build time increases critical path
  length for no good reason.

----

A note on `nativeCC`:

`stdenv` takes tools from the previous stage, so:

1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.stdenv.cc`: `(?0, ?1, x)`

while:

1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.targetPackages`: `(x, x, ?2)`
3. `pkgsBuildBuild.targetPackages.stdenv.cc`: `(?1, x, x)`
2021-04-30 05:41:00 +00:00