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

linux: allow building with ld.lld (for LTO) #344665

Open
wants to merge 4 commits into
base: staging
Choose a base branch
from

Commits on Oct 21, 2024

  1. Configuration menu
    Copy the full SHA
    0739e0c View commit details
    Browse the repository at this point in the history
  2. linux: allow building with ld.lld

    Even when building with pkgsLLVM.stdenv where ld is ld.lld and not
    binutils ld, the build picks up binutils ld for linking. This prevents
    features from working that require ld.lld.
    
    The reason is that when the LD environment variable is not set, Linux
    defaults to `ld` as a linker and ld is:
    
    /nix/store/zznja5f8v3jafffyah1rk46vpfcn38dv-gcc-wrapper-13.3.0/bin/ld
    GNU ld (GNU Binutils) 2.42
    
    This ld comes from pkgsLLVM.buildPackages.stdenv.cc.
    
    Fix by being more specific about which tools we want to build with.
    This just extends what manual-config.nix has already done for quite a
    while to avoid similar problems for other tools.
    
    It's important to pass LD and other toolchain environment variables to
    `make config` in generate-config.pl, because otherwise `make config`
    will also make decisions based on the wrong toolchain.
    blitz committed Oct 21, 2024
    Configuration menu
    Copy the full SHA
    9bf1c83 View commit details
    Browse the repository at this point in the history
  3. linux: workaround ld wrapper issue

    The ld wrapper leads to the following linking error on x86_64, when
    building pkgsLLVM.linux_latest:
    
    x86_64-unknown-linux-gnu-ld: error: ../arch/x86/boot/setup.ld:15: unable to move location counter (0x204) backward to 0x1ef for section '.bstext'
    blitz committed Oct 21, 2024
    Configuration menu
    Copy the full SHA
    a2f6525 View commit details
    Browse the repository at this point in the history
  4. linux: simplify toolchain selection

    When we set CROSS_COMPILE to set the toolchain prefix, everything
    works out of the box without trying to drop absolute paths everywhere.
    This removes a lot of duplication from the kernel derivations.
    blitz committed Oct 21, 2024
    Configuration menu
    Copy the full SHA
    89da132 View commit details
    Browse the repository at this point in the history