Skip to content
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

[Backport release-22.11] llvmPackages_15: init at 15.0.7 #213092

Merged
merged 30 commits into from
Jan 28, 2023

Commits on Jan 28, 2023

  1. llvmPackages_15: copy from llvmPackages_git

    (cherry picked from commit 201ef33)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    281516c View commit details
    Browse the repository at this point in the history
  2. llvmPackages_15: apply some patches from llvmPackages_14

    See #194634 for details.
    
    PRs:
      - #191372
      - #190936
      - #82131
      - #199844
      - #197674
      - #184408
      - #193004
    (cherry picked from commit 81ef82a)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    4fb7083 View commit details
    Browse the repository at this point in the history
  3. llvmPackages_15: apply some patches from llvmPackages_14, part 2

    See #194634 (comment) for
    details.
    
    PRs:
      - #211401
      - #211161
      - #206742
      - #211687
    (cherry picked from commit 9bd9267)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    2bc885c View commit details
    Browse the repository at this point in the history
  4. 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:
        https://github.com/llvm/llvm-project/blob/4f827318e3e8ccab4ff131e06234caa827e91e4e/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: #194634 (comment)
    
    Co-authored-by: Bernardo Meurer <[email protected]>
    (cherry picked from commit bc4dbee)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    f460f0f View commit details
    Browse the repository at this point in the history
  5. llvmPackages_15.compiler_rt: apply #196909 to LLVM 15

    `llvmPackages_15` originates from `llvmPackages_git` which does
    not include this change
    
    (cherry picked from commit 3b6d98d)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    a7d2d75 View commit details
    Browse the repository at this point in the history
  6. llvmPackages_15: apply #211230 to llvmPackages_15

    See the comments here for context: #194634 (comment)
    
    Co-authored-by: Weijia Wang <[email protected]>
    (cherry picked from commit 4fabcf4)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    97a97f1 View commit details
    Browse the repository at this point in the history
  7. 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: llvm/llvm-project@a9c9183
    
    These essentially require a modern C++ compiler (clang gained support in
    LLVM 13: llvm/llvm-project@369c648,
    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.
    
    (cherry picked from commit ca59a20)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    b526c29 View commit details
    Browse the repository at this point in the history
  8. llvmPackages_15.libcxxabi: fix cycles that arise when stdenv is the…

    … LLVM stdenv
    
    (cherry picked from commit 501a9e1)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    ace04ab View commit details
    Browse the repository at this point in the history
  9. llvmPackages_15.compiler-rt: fixes for Darwin

    this introduces a codesigning related patch that we can drop once #195107
    goes through
    
    see: #194634 (comment)
    (cherry picked from commit 00839fe)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    690c2d8 View commit details
    Browse the repository at this point in the history
  10. llvmPackages_15.compiler-rt: apply #186575 to llvmPackages_15

    (cherry picked from commit 09b8886)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    068139d View commit details
    Browse the repository at this point in the history
  11. llvmPackages_15.compiler-rt: update the armv7l patch

    see the discussion here for context:
    #194634 (comment)
    
    (cherry picked from commit f91fad4)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    f11d5e6 View commit details
    Browse the repository at this point in the history
  12. llvmPackages_15.compiler-rt: gate the libxcrypt dep on `plat.libc =…

    …= "glibc"`
    
    This restores this check to what it originally was in #196909 (see:
    #196909 (comment)) 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`).
    
    (cherry picked from commit d729907)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    572014a View commit details
    Browse the repository at this point in the history
  13. llvmPackages_15.lldb: fix lldb on x86_64 macOS

    See:
    #194634 (comment)
    (cherry picked from commit 1d3ca42)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    ab956d0 View commit details
    Browse the repository at this point in the history
  14. 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)
    
    (cherry picked from commit b4ee532)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    3207be5 View commit details
    Browse the repository at this point in the history
  15. llvmPackages_15.lldb: fix the manpages

    (cherry picked from commit 19d1571)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    1860e40 View commit details
    Browse the repository at this point in the history
  16. llvmPackages_15: switch to using ninja

    (cherry picked from commit 912056c)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    5aea670 View commit details
    Browse the repository at this point in the history
  17. llvmPackages_15: expand the NIX_BUILD_CORES arg passed to lit at co…

    …nfigure time
    
    this previously worked because, when using Make, this variable was
    expanded at build time
    
    (cherry picked from commit 4d3857d)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    3fdc84c View commit details
    Browse the repository at this point in the history
  18. llvmPackages_15.llvm: enable polly by default

    this comment has a more complete history: #194634 (comment)
    
    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
    
    (cherry picked from commit 2a58596)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    f394388 View commit details
    Browse the repository at this point in the history
  19. llvmPackages_15.llvm: add in a missing check dep

    (cherry picked from commit 6d0c876)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    a50d0b6 View commit details
    Browse the repository at this point in the history
  20. 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.
    
    (cherry picked from commit c7231c0)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    2084262 View commit details
    Browse the repository at this point in the history
  21. llvmPackages_15.llvm: adjust a path, skip an xfail test on darwin

    (cherry picked from commit 0ee5251)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    4d44e1d View commit details
    Browse the repository at this point in the history
  22. 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
    
    (cherry picked from commit eafb8fb)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    2e996b9 View commit details
    Browse the repository at this point in the history
  23. llvmPackages_15.llvm: disable some RISC-V ZBP tests on arm32

    see this thread for context: #194634 (comment)
    
    Co-authored-by: misuzu <[email protected]>
    (cherry picked from commit 5e5ed7d)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    67a5ccc View commit details
    Browse the repository at this point in the history
  24. llvmPackages_15.llvm: specify some deps explicitly to fix cross-compi…

    …lation
    
    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
    (cherry picked from commit 3436075)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    6730215 View commit details
    Browse the repository at this point in the history
  25. llvmPackages_15.clang: drop the C++ std version -DCMAKE_CXX_FLAG

    Context: #194634 (comment)
    (cherry picked from commit 404ef6b)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    13d396e View commit details
    Browse the repository at this point in the history
  26. llvmPackages_15.openmp: add a missing darwin check dependency

    the tests still don't all pass so `doCheck` is still disabled
    
    (cherry picked from commit 8f16b4b)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    cd567ce View commit details
    Browse the repository at this point in the history
  27. llvmPackages_15: misc fixes, notes

    (cherry picked from commit f8cbbdd)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    ee64ddd View commit details
    Browse the repository at this point in the history
  28. llvmPackages_15: update licenses

    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    ace2aa8 View commit details
    Browse the repository at this point in the history
  29. 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
    
    (cherry picked from commit 8afa321)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    f2583cb View commit details
    Browse the repository at this point in the history
  30. llvmPackages_15: expose the release information and monorepo source a…

    …s overridable args
    
    this makes it easier for users to use their own LLVM in nixpkgs
    
    (cherry picked from commit d231d18)
    rrbutani authored and github-actions[bot] committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    7270892 View commit details
    Browse the repository at this point in the history