anchor.diff:      # upstream patch. Don't forget to check backport status of the upstream patch
       # when adding new GHC releases in nixpkgs.
       ./respect-ar-path.patch
  +
  +    # cabal passes incorrect --host= when cross-compiling
  +    # https://github.com/haskell/cabal/issues/5887
  +    (fetchpatch {
  +            url = "https://raw.githubusercontent.com/input-output-hk/haskell.nix/122bd81150386867da07fdc9ad5096db6719545a/overlays/patches/ghc/cabal-host.patch";
  +      sha256 = "sha256:0yd0sajgi24sc1w5m55lkg2lp6kfkgpp3lgija2c8y3cmkwfpdc1";
  +    })
     ] ++ lib.optionals stdenv.isDarwin [
       # Make Block.h compile with c++ compilers. Remove with the next release
       (fetchpatch {
  
positive.code:     GhcRtsHcOpts += -fPIC
    '' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
      EXTRA_CC_OPTS += -std=gnu99
    '';
  
    # Splicer will pull out correct variations
  
negative.code:   # Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues.
    # But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
    # see #84670 and #49071 for more background.
    useLdGold = targetPlatform.linker == "gold" || (targetPlatform.linker == "bfd" && !targetPlatform.isMusl && !targetPlatform.isWindows);
  
    runtimeDeps = [
      targetPackages.stdenv.cc.bintools
  