anchor.diff:        }
       ''
   
  +    + (if nativeTools then ''
  +      echo ${if targetPlatform.isDarwin then cc else nativePrefix} > $out/nix-support/orig-cc
  +
  +      ccPath="${if targetPlatform.isDarwin then cc else nativePrefix}/bin"
  +      ldPath="${nativePrefix}/bin"
  +    '' else ''
  +      echo $cc > $out/nix-support/orig-cc
  +
  +      ccPath="${cc}/bin"
  +      ldPath="${binutils_bin}/bin"
  +    ''
  +
  +    + optionalString (targetPlatform.isSunOS && nativePrefix != "") ''
  +      # Solaris needs an additional ld wrapper.
  +      ldPath="${nativePrefix}/bin"
  +      exec="$ldPath/${prefix}ld"
  +      wrap ld-solaris ${./ld-solaris-wrapper.sh}
  +    '')
  +
  +    + ''
  +      # Create a symlink to as (the assembler).  This is useful when a
  +      # cc-wrapper is installed in a user environment, as it ensures that
  +      # the right assembler is called.
  +      if [ -e $ldPath/${prefix}as ]; then
  +        ln -s $ldPath/${prefix}as $out/bin/${prefix}as
  +      fi
  +
  +    '' + (if !useMacosReexportHack then ''
  +      wrap ${prefix}ld ${./ld-wrapper.sh} ''${ld:-$ldPath/${prefix}ld}
  +    '' else ''
  +      ldInner="${prefix}ld-reexport-delegate"
  +      wrap "$ldInner" ${./macos-sierra-reexport-hack.bash} ''${ld:-$ldPath/${prefix}ld}
  +      wrap "${prefix}ld" ${./ld-wrapper.sh} "$out/bin/$ldInner"
  +      unset ldInner
  +    '') + ''
  +
  +      if [ -e ${binutils_bin}/bin/${prefix}ld.gold ]; then
  +        wrap ${prefix}ld.gold ${./ld-wrapper.sh} ${binutils_bin}/bin/${prefix}ld.gold
  +      fi
  +
  +      if [ -e ${binutils_bin}/bin/ld.bfd ]; then
  +        wrap ${prefix}ld.bfd ${./ld-wrapper.sh} ${binutils_bin}/bin/${prefix}ld.bfd
  +      fi
  +
  +      # We export environment variables pointing to the wrapped nonstandard
  +      # cmds, lest some lousy configure script use those to guess compiler
  +      # version.
  +      export named_cc=${prefix}cc
  +      export named_cxx=${prefix}c++
  +
  +      export default_cxx_stdlib_compile="${default_cxx_stdlib_compile}"
  +
  +      if [ -e $ccPath/${prefix}gcc ]; then
  +        wrap ${prefix}gcc ${./cc-wrapper.sh} $ccPath/${prefix}gcc
  +        ln -s ${prefix}gcc $out/bin/${prefix}cc
  +        export named_cc=${prefix}gcc
  +        export named_cxx=${prefix}g++
  +      elif [ -e $ccPath/clang ]; then
  +        wrap ${prefix}clang ${./cc-wrapper.sh} $ccPath/clang
  +        ln -s ${prefix}clang $out/bin/${prefix}cc
  +        export named_cc=${prefix}clang
  +        export named_cxx=${prefix}clang++
  +      fi
  +
  +      if [ -e $ccPath/${prefix}g++ ]; then
  +        wrap ${prefix}g++ ${./cc-wrapper.sh} $ccPath/${prefix}g++
  +        ln -s ${prefix}g++ $out/bin/${prefix}c++
  +      elif [ -e $ccPath/clang++ ]; then
  +        wrap ${prefix}clang++ ${./cc-wrapper.sh} $ccPath/clang++
  +        ln -s ${prefix}clang++ $out/bin/${prefix}c++
  +      fi
  +
  +      if [ -e $ccPath/cpp ]; then
  +        wrap ${prefix}cpp ${./cc-wrapper.sh} $ccPath/cpp
  +      fi
  +    ''
  +
  +    + optionalString cc.langFortran or false ''
  +      wrap ${prefix}gfortran ${./cc-wrapper.sh} $ccPath/${prefix}gfortran
  +      ln -sv ${prefix}gfortran $out/bin/${prefix}g77
  +      ln -sv ${prefix}gfortran $out/bin/${prefix}f77
  +    ''
  +
  +    + optionalString cc.langJava or false ''
  +      wrap ${prefix}gcj ${./cc-wrapper.sh} $ccPath/${prefix}gcj
  +    ''
  +
  +    + optionalString cc.langGo or false ''
  +      wrap ${prefix}gccgo ${./cc-wrapper.sh} $ccPath/${prefix}gccgo
  +    ''
  +
  +    + optionalString cc.langAda or false ''
  +      wrap ${prefix}gnatgcc ${./cc-wrapper.sh} $ccPath/${prefix}gnatgcc
  +      wrap ${prefix}gnatmake ${./gnat-wrapper.sh} $ccPath/${prefix}gnatmake
  +      wrap ${prefix}gnatbind ${./gnat-wrapper.sh} $ccPath/${prefix}gnatbind
  +      wrap ${prefix}gnatlink ${./gnatlink-wrapper.sh} $ccPath/${prefix}gnatlink
  +    ''
  +
  +    + optionalString cc.langVhdl or false ''
  +      ln -s $ccPath/${prefix}ghdl $out/bin/${prefix}ghdl
  +    '';
  +
  +  propagatedBuildInputs = extraPackages;
  +
  +  setupHook = ./setup-hook.sh;
  +
  +  postFixup =
  +    ''
  +      set -u
  +    ''
  +
       + optionalString (libc != null) (''
  -      if [[ -z ''${dynamicLinker+x} ]]; then
  -        echo "Don't know the name of the dynamic linker for platform '${targetPlatform.config}', so guessing instead." >&2
  -        dynamicLinker="${libc_lib}/lib/ld*.so.?"
  -      fi
  -
  -      # Expand globs to fill array of options
  -      dynamicLinker=($dynamicLinker)
  -
  -      case ''${#dynamicLinker[@]} in
  -        0) echo "No dynamic linker found for platform '${targetPlatform.config}'." >&2;;
  -        1) echo "Using dynamic linker: '$dynamicLinker'" >&2;;
  -        *) echo "Multiple dynamic linkers found for platform '${targetPlatform.config}'." >&2;;
  -      esac
  -
  -      if [ -n "$dynamicLinker" ]; then
  -        echo $dynamicLinker > $out/nix-support/dynamic-linker
  -
  -    '' + (if targetPlatform.isDarwin then ''
  -        printf "export LD_DYLD_PATH=%q\n" "$dynamicLinker" >> $out/nix-support/setup-hook
  -    '' else ''
  -        if [ -e ${libc_lib}/lib/32/ld-linux.so.2 ]; then
  -          echo ${libc_lib}/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32
  -        fi
  -
  -        ldflagsBefore=(-dynamic-linker "$dynamicLinker")
  -    '') + ''
  -      fi
  -
  -      # The dynamic linker is passed in `ldflagsBefore' to allow
  -      # explicit overrides of the dynamic linker by callers to gcc/ld
  -      # (the *last* value counts, so ours should come first).
  -      printWords "''${ldflagsBefore[@]}" > $out/nix-support/libc-ldflags-before
  -    '')
  -
  -    + optionalString (libc != null) ''
  +      ##
  +      ## General libc support
  +      ##
  +
         # The "-B${libc_lib}/lib/" flag is a quick hack to force gcc to link
         # against the crt1.o from our own glibc, rather than the one in
         # /usr/lib.  (This is only an issue when using an `impure'
  
positive.code:     '';
    };
  
    buildCommand =
      ''
        set -u
  
  
negative.code:       substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh
        substituteAll ${./add-hardening.sh} $out/nix-support/add-hardening.sh
        substituteAll ${./utils.sh} $out/nix-support/utils.sh
  
        ##
        ## Extra custom steps
        ##
  
      ''
      + extraBuildCommands;
  
  