Commit Graph

114 Commits

Author SHA1 Message Date
Vladimír Čunát
43f9c191bf
Merge #110571: treewide: migrate to -fno-common
...into staging
2022-07-07 10:06:38 +02:00
Gaelan Steele
5b47eb13ac gcc, clang11: don't force -fcommon on GCC 10 or clang11
GCC 10 sets -fno-common by default. This broke some packages, so
when moving to GCC 10 we initially disabled this behavior. This
commit reverts that, bringing us closer to the standard and
upstream.

Co-authored-by: Sergei Trofimovich <slyich@gmail.com>
2022-07-06 08:37:00 +01:00
sternenseemann
0083a683d7 Revert "llvmPackages: do not include static archives when shared…"
Reverts #162607 / 1748887ff2.

Reason for revert: This change caused llvm-config{,-native} to be unable
to find static archives bundled with LLVM, as has been [reported]. Ever
since #152944 using moveToOutput in LLVM is _evil_ because llvm-config
obtains it knowledge about the installation locations from the CMake
configure step.

Consequently a change like #162607 will need to be implemented by making
LLVM itself install the static archives to the correct location or by
adding yet another patch which updates llvm-config's knowledge of the
location. The latter is not desireable in my opinion, though, since it
is just asking for this sort of trouble: Before #152944 we had an
outputs.patch that did this sort of things which broke spectacularly in
edge cases.

Fixes #148117.

[reported]: https://github.com/NixOS/nixpkgs/issues/148117#issuecomment-1158245576
2022-07-05 15:03:12 +02:00
misuzu
f8c1774e25 llvm_11: disable tools/gold/X86/split-dwarf.ll test on armv7l 2022-06-06 20:33:50 +03:00
Lassulus
a1780e4b7d
Merge pull request #162607 from waldheinz/libllvm-drop-static
llvmPackages/libllvm: do not include static archives when shared is r…
2022-04-08 19:39:18 +01:00
Aleksey Kladov
6d111cbf61 Clarify that lld package provides unwrapped lld
lld package provides an unwrapped lld. It doesn't always work on NixOS
(eg, it doesn't set rpath), and so dosen't always work.

What one should be using instead is the `lld` from
`llvmPackages.bintools` package. This super counterintutive.

One incremental step we can take here is to clarify that the `lld`
package is unrwapped -- right now, it looks like 100% legit thing one
should be using!
2022-03-27 18:14:55 -04:00
Matthias Treydte
1748887ff2 llvmPackages/libllvm: move static archives to dev output
Reduces closure size by ~240MiB (down to ~100MiB) for
LLVM 13, the others are similar.

Having those archives in the lib output makes no sense
as they are no runtime dependencies. Removing them
alltogether is also not an option because the dynamic
libraries offer only the C API while many users of
libllvm require the C++ API. Those users must have an
dependency on libllvm.dev anyway and will find those
files for linking.
2022-03-04 13:05:53 +01:00
John Ericson
baf290023c
Merge pull request #153790 from sternenseemann/cross-bootstrap-logic
Cross bootstrapping logic fixes benefitting llvmPackages
2022-01-08 12:39:30 -08:00
sternenseemann
e238f456b8 llvmPackages_*.clang: pick clangUseLLVM if targetPlatform.useLLVM
libcxxClang still depends on cc wrapper's gccForLibs for libgcc which is
not available when useLLVM is set. In such cases we need to switch to
clangUseLLVM and (try) to use compiler-rt instead.

Resolves #153759: pkgsLLVM.llvmPackages.stdenv now correctly
clangUseLLVM as cc, allowing compilation to work as expected.
2022-01-07 14:52:13 +01:00
sternenseemann
766f5ffb76 llvmPackages_*: respect cc for target when choosing C++ flavour
llvmPackages_*.clang should check the default compiler for the package
set it is targeting (targetPackages.stdenv.cc) instead of the compiler
that has been used to build it (stdenv.cc) in order to get some sense of
whether to use libc++ or libstdc++.

Since we are now inspecting targetPackages in the llvmPackages.clang
attribute, we need to avoid using it in the cross stdenv — which just
forces us to explicitly request libcxxClang for darwin instead of
relying on the clang attribute to pick it for us.

We also need to do something similar for targetPackages.stdenv.cc: Here
the llvmPackages.clang logic would work as we want (inspect
targetPackages.stdenv.cc and if it doesn't exist, make the choice based
on stdenv.cc), but it gets locked in a cycle with the previous package.
We can easily break this, however: We know that the previous set had
clang and the next one doesn't exist, so we'd choose libcxxClang any day
of the week.
2022-01-07 14:42:41 +01:00
sternenseemann
e4fddecdb3 llvmPackages_{11,12,13,git}.libllvm: enable static build
The main thing we need to pass LLVM_ENABLE_PIC=OFF to prevent LLVM from
building shared objects because our cc-wrapper is incapable of producing
shared objects. Building LLVM statically also influences other LLVM
projects like clang and lld -- which can be built linked fully
statically with this change.
2022-01-04 18:40:32 +01:00
sternenseemann
e5ccc412d2 llvmPackages_*.libllvm: only build tests if doCheck
To make the value of doCheck in the argument attribute set accurate we
also need to include the condition for cross compilation which normally
is added by stdenv.mkDerivation.
2022-01-04 18:40:32 +01:00
sternenseemann
c70dca8249 llvmPackages_*.libllvm: make llvm-config and llvm-config equivalent
LLVM's build system creates NATIVE/bin/llvm-config by reexecuting cmake
with entirely new flags. Problematically, the `CMAKE_INSTALL_*` flags
are not inherited, causing llvm-config-native to return wrong
installation paths, e. g. CMAKE_INSTALL_LIBDIR would default to `lib64`
on x86_64-linux. Previously this was masked by outputs.patch which
replaced ActiveLibDir with a string passed in from Nix, however
`--cmakedir` for example would turn out to be wrong always, breaking
cross-compilation of e. g. lld.

Additionally LLVM_ENABLE_RTTI needs to be repassed, as it is used to
determine if RTTI is available. Passing LLVM_LINK_LLVM_DYLIB is crucial
if we are building LLVM non-statically: It influences the --shared-mode
flag (which should indicate that -lLLVM is enough to link all
components) and makes --link-shared work in the first place,
i. e. llvm-config-native believes the built shared libs don't exist
unless we repass this flag.

Passing LLVM_LINK_LLVM_DYLIB=ON, however, makes the native build produce
a full libLLVM.so which is something we don't want, so we introduce a
patch which forces llvm-config to link statically against the LLVM
components it needs.
2022-01-04 11:09:43 +01:00
sternenseemann
d807aaa30c llvmPackages*.libllvm: drop outputs.patch for llvm-config.patch
Due to gnu-install-dirs.patch llvm-config will return correct results
for --link-shared as well as --link-static even without this patch.
2022-01-04 11:09:43 +01:00
sternenseemann
c58517aeed llvmPackages_*.clang: stop passing LLVM_CONFIG_PATH unnecessarily
Starting with LLVM 8, clang does no longer use llvm-config to detect the
LLVM installation: https://github.com/llvm/llvm-project/commit/e4faa5c7986b7
Consequently, there is no point passing LLVM_CONFIG_PATH (in fact the
variable is unused currently).
2022-01-03 16:46:38 +01:00
7c6f434c
84fb429d21
Merge pull request #150018 from trofi/fix-llvm-for-gcc-12
llvm_{5..12}: fix tests against upcoming gcc-12
2021-12-31 21:45:53 +00:00
Dmitry Kalinkin
508623b372
clang_{11,12,13,git}: enable RTTI 2021-12-24 22:24:00 -05:00
7c6f434c
58a27ea378
Merge pull request #148367 from r-burns/llvm-config-static
llvmPackages_*.llvm: fix llvm-config-native with static libs
2021-12-24 10:25:03 +00:00
Dmitry Kalinkin
e1aaaa90fe
llvmPackages.libcxx: unset _LIBCPP_USE_AVAILABILITY_APPLE 2021-12-18 10:09:25 -05:00
Sergei Trofimovich
35223810a1 llvm_{5..12}: fix tests against upcoming gcc-12
In https://gcc.gnu.org/PR103598 we found out that gcc-12
changed __PRETTY_FUNCTION__ slightly and broke llvm-12 (and older)
tests that rely on exact type match. llvm-13 already removed the
qualified names from the expected output.

This change changes expected output to avoid llvm:: namespace prefix.
This is enough to get tests pass on x86_64 again.

Tested against this week's gcc-12 and against gcc-10.
2021-12-10 09:08:04 +00:00
Ryan Burns
544707d6a4 llvmPackages_*.llvm: fix llvm-config-native with static libs
Since both static and shared libs are installed to the same `lib`
output, we override the ActiveLibDir unconditionally.

Fixes `llvm-config-native --link-static --libs`
2021-12-02 19:21:21 -08:00
toonn
d964f211f6 llvmPackages_11.libcxxabi: More precise libunwind inclusion 2021-11-24 15:17:13 -08:00
toonn
73d3d0de7f libcxxabi: Use standalone instead of expression
Co-authored-by: Sandro Jäckel <sandro.jaeckel@gmail.com>
2021-11-24 15:17:13 -08:00
toonn
1be8e73fb3 stdenv: libcxxabi dropped standalone in favor of useLLVM
The libcxxabi expression had a `standalone` argument in LLVM 7 which
triggered passing of the `-DLLVM_ENABLE_LIBCXX=ON` flag. In LLVM 11 this
flag and others are toggled by the `useLLVM` attribute of
`stdenv.hostPlatform` but this toggles a flag we don't need on Darwin.

Similar to the refactoring of LLVM 7 libc++abi by Ericson2314 in
3af7e98470, I have reintroduced the standalone argument for use in
bootstrapping the Darwin stdenv.
2021-11-24 15:17:13 -08:00
Sergei Trofimovich
e9dfe892ef llvm_{5..11}: pull upstream build fix for for gcc-12
Without the fix build fails on gcc-12 as:

    /build/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp:
      In member function 'std::string llvm::NVPTXAsmPrinter::getPTXFundamentalTypeStr(...':
    /build/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp:1319:10:
      error: use of deleted function 'std::__cxx11::basic_string<...>; std::nullptr_t = std::nullptr_t]'
     1319 |   return nullptr;
          |          ^~~~~~~

The patch is present in upstream releases since llvm-12.
2021-11-21 09:50:01 +00:00
Vladimír Čunát
68c40000a7
Merge #141397: llvmPackages_{5,6,7}.compiler-rt: fix patches 2021-10-21 20:26:37 +02:00
Sergei Trofimovich
a410420844 pkgsStatic.llvmPackages_{{5..13},git}.compiler-rt: drop unused musl patches
Commit 199b7c50 "compiler-rt: remove <cyclades.h> from libsanitizer"
broke conditional conditional musl patches.

The change has a few effects:
- pkgsStatic.llvmPackages_{5,6,7}.compiler-rt: fix build on musl after cyclades backport
- pkgsStatic.llvmPackages_{{5..13},git}.compiler-rt: drop incomplete musl patches as
  sanitizers are disabled anyway and require more upstream porting.
2021-10-21 18:42:31 +01:00
pennae
dc895fb281 lib: make extendDerivation lighter on eval
the fix to extendDerivation in #140051 unwittingly worsened eval performance by
quite a bit. set elements alone needed over 1GB extra after the change, which
seems disproportionate to how small it was. if we flip the logic used to
determine which outputs to install around and keep a "this one exactly" flag in
the specific outputs instead of a "all of them" in the root we can avoid most
of that cost.
2021-10-15 16:39:10 +02:00
Sergei Trofimovich
199b7c505b compiler-rt: remove <cyclades.h> from libsanitizer
linux-headers-5.13 removed <cyclades.h> along with device support.
Backport a single https://reviews.llvm.org/D102059 upstream change to
fix compiler-rt build.

Use local patches as there is a whitespace change compared to upstream.
2021-09-20 19:37:19 +01:00
Tom Repetti
c33c7c3d5f
clang_11: Fix RISC-V builds for compiler-rt. (#135718)
Closes: #135628
2021-08-29 19:31:30 -04:00
Yureka
b0f27ee74d llvmPackages_*: expose release_version 2021-08-20 23:07:43 +02:00
Sergey Makarov
a70bc70c14
compiler-rt: Rename llvm argument to libllvm for consistency.
All other `llvm` derivations use name `libllvm` for this argument.
2021-08-09 18:30:59 +03:00
Sandro
419f03859d
Merge pull request #121693 from misuzu/llvm11-armv7l
llvm_11: disable failing 'dependent-libraries.test' on armv7l
2021-08-02 14:08:04 +00:00
github-actions[bot]
dcfc502458
Merge master into staging-next 2021-06-11 00:09:47 +00:00
tcmal
cc7740ae77 lldb: python into lib & wrap binary 2021-06-09 16:09:29 +01:00
tcmal
e097f7efc7 lldb: fix python lldb library
_lldb.so is now properly symlinked to the shared library.
applies to lldb 8 through 12.
fixes #125183
2021-06-08 13:36:06 +01: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
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
github-actions[bot]
c10600230e
Merge staging-next into staging 2021-05-15 18:30:31 +00: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