mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 16:33:15 +00:00
Add a stdenv adapter ‘useGoldLinker’ to force use of Gold
This commit is contained in:
parent
e060d9a2ff
commit
7703f04b75
@ -18,21 +18,21 @@ let
|
||||
|
||||
clangVersion = (builtins.parseDrvName clang.name).version;
|
||||
clangName = (builtins.parseDrvName clang.name).name;
|
||||
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name =
|
||||
(if name != "" then name else clangName + "-wrapper") +
|
||||
(if clang != null && clangVersion != "" then "-" + clangVersion else "");
|
||||
|
||||
|
||||
builder = ./builder.sh;
|
||||
setupHook = ./setup-hook.sh;
|
||||
clangWrapper = ./clang-wrapper.sh;
|
||||
ldWrapper = ./ld-wrapper.sh;
|
||||
utils = ./utils.sh;
|
||||
addFlags = ./add-flags;
|
||||
|
||||
|
||||
inherit nativeTools nativeLibc nativePrefix clang clangVersion libcxx;
|
||||
|
||||
libcxxabi = libcxx.abi or null;
|
||||
@ -42,7 +42,7 @@ stdenv.mkDerivation {
|
||||
binutils = if nativeTools then null else binutils;
|
||||
# The wrapper scripts use 'cat', so we may need coreutils
|
||||
coreutils = if nativeTools then null else coreutils;
|
||||
|
||||
|
||||
langC = true;
|
||||
langCC = true;
|
||||
shell = if shell == "" then stdenv.shell else
|
||||
@ -65,7 +65,7 @@ stdenv.mkDerivation {
|
||||
if stdenv.lib.hasSuffix "pc-gnu" stdenv.cross.config then "ld.so.1" else
|
||||
abort "don't know the name of the dynamic linker for this platform");
|
||||
};
|
||||
|
||||
|
||||
meta =
|
||||
let clang_ = if clang != null then clang else {}; in
|
||||
(if clang_ ? meta then removeAttrs clang.meta ["priority"] else {}) //
|
||||
|
@ -29,7 +29,7 @@ stdenv.mkDerivation {
|
||||
name =
|
||||
(if name != "" then name else gccName + "-wrapper") +
|
||||
(if gcc != null && gccVersion != "" then "-" + gccVersion else "");
|
||||
|
||||
|
||||
builder = ./builder.sh;
|
||||
setupHook = ./setup-hook.sh;
|
||||
gccWrapper = ./gcc-wrapper.sh;
|
||||
@ -39,13 +39,13 @@ stdenv.mkDerivation {
|
||||
ldSolarisWrapper = ./ld-solaris-wrapper.sh;
|
||||
utils = ./utils.sh;
|
||||
addFlags = ./add-flags;
|
||||
|
||||
|
||||
inherit nativeTools nativeLibc nativePrefix gcc;
|
||||
libc = if nativeLibc then null else libc;
|
||||
binutils = if nativeTools then null else binutils;
|
||||
# The wrapper scripts use 'cat', so we may need coreutils
|
||||
coreutils = if nativeTools then null else coreutils;
|
||||
|
||||
|
||||
langC = if nativeTools then true else gcc.langC;
|
||||
langCC = if nativeTools then true else gcc.langCC;
|
||||
langFortran = if nativeTools then false else gcc ? langFortran;
|
||||
@ -72,7 +72,7 @@ stdenv.mkDerivation {
|
||||
if stdenv.lib.hasSuffix "pc-gnu" stdenv.cross.config then "ld.so.1" else
|
||||
abort "don't know the name of the dynamic linker for this platform");
|
||||
};
|
||||
|
||||
|
||||
meta =
|
||||
let gcc_ = if gcc != null then gcc else {}; in
|
||||
(if gcc_ ? meta then removeAttrs gcc.meta ["priority"] else {}) //
|
||||
|
@ -2,8 +2,7 @@
|
||||
a new stdenv with different behaviour, e.g. using a different C
|
||||
compiler. */
|
||||
|
||||
{dietlibc, fetchurl, runCommand}:
|
||||
|
||||
pkgs:
|
||||
|
||||
rec {
|
||||
|
||||
@ -57,13 +56,13 @@ rec {
|
||||
|
||||
NIX_GCC = import ../build-support/gcc-wrapper {
|
||||
inherit stdenv;
|
||||
libc = dietlibc;
|
||||
libc = pkgs.dietlibc;
|
||||
inherit (stdenv.gcc) gcc binutils nativeTools nativePrefix;
|
||||
nativeLibc = false;
|
||||
};
|
||||
});
|
||||
isDietLibC = true;
|
||||
} // {inherit fetchurl;};
|
||||
};
|
||||
|
||||
|
||||
# Return a modified stdenv that uses klibc to create small
|
||||
@ -80,7 +79,7 @@ rec {
|
||||
configureFlags =
|
||||
args.configureFlags or "" + " --disable-shared"; # brrr...
|
||||
|
||||
NIX_GCC = runCommand "klibc-wrapper" {} ''
|
||||
NIX_GCC = pkgs.runCommand "klibc-wrapper" {} ''
|
||||
mkdir -p $out/bin
|
||||
ln -s ${klibc}/bin/klcc $out/bin/gcc
|
||||
ln -s ${klibc}/bin/klcc $out/bin/cc
|
||||
@ -90,7 +89,7 @@ rec {
|
||||
});
|
||||
isKlibc = true;
|
||||
isStatic = true;
|
||||
} // {inherit fetchurl;};
|
||||
};
|
||||
|
||||
|
||||
# Return a modified stdenv that tries to build statically linked
|
||||
@ -103,7 +102,7 @@ rec {
|
||||
+ " --disable-shared"; # brrr...
|
||||
});
|
||||
isStatic = true;
|
||||
} // {inherit fetchurl;};
|
||||
};
|
||||
|
||||
|
||||
# Return a modified stdenv that builds static libraries instead of
|
||||
@ -115,7 +114,7 @@ rec {
|
||||
toString args.configureFlags or ""
|
||||
+ " --enable-static --disable-shared";
|
||||
});
|
||||
} // {inherit fetchurl;};
|
||||
};
|
||||
|
||||
|
||||
# Return a modified stdenv that adds a cross compiler to the
|
||||
@ -277,7 +276,7 @@ rec {
|
||||
*/
|
||||
replaceMaintainersField = stdenv: pkgs: maintainers: stdenv //
|
||||
{ mkDerivation = args:
|
||||
pkgs.lib.recursiveUpdate
|
||||
stdenv.lib.recursiveUpdate
|
||||
(stdenv.mkDerivation args)
|
||||
{ meta.maintainers = maintainers; };
|
||||
};
|
||||
@ -354,4 +353,17 @@ rec {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/* Modify a stdenv so that it used the Gold linker. */
|
||||
useGoldLinker = stdenv:
|
||||
let
|
||||
binutils = stdenv.gcc.binutils;
|
||||
binutils' = pkgs.runCommand "${binutils.name}-gold" { }
|
||||
''
|
||||
mkdir -p $out/bin
|
||||
ln -s ${binutils}/bin/* $out/bin/
|
||||
ln -sfn ${binutils}/bin/ld.gold $out/bin/ld
|
||||
''; # */
|
||||
in overrideGCC stdenv (stdenv.gcc.override { binutils = binutils'; });
|
||||
|
||||
}
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
rec {
|
||||
|
||||
lib = import ../../../lib;
|
||||
|
||||
bootstrapFiles =
|
||||
if system == "i686-linux" then import ./bootstrap/i686
|
||||
else if system == "x86_64-linux" then import ./bootstrap/x86_64
|
||||
@ -134,9 +136,9 @@ rec {
|
||||
|
||||
# A helper function to call gcc-wrapper.
|
||||
wrapGCC =
|
||||
{gcc ? bootstrapTools, libc, binutils, coreutils, shell ? "", name ? "bootstrap-gcc-wrapper"}:
|
||||
{ gcc ? bootstrapTools, libc, binutils, coreutils, shell ? "", name ? "bootstrap-gcc-wrapper" }:
|
||||
|
||||
import ../../build-support/gcc-wrapper {
|
||||
lib.makeOverridable (import ../../build-support/gcc-wrapper) {
|
||||
nativeTools = false;
|
||||
nativeLibc = false;
|
||||
inherit gcc binutils coreutils libc shell name;
|
||||
|
@ -97,7 +97,7 @@ let
|
||||
(import ../build-support/trivial-builders.nix { inherit (pkgs) stdenv; inherit (pkgs.xorg) lndir; });
|
||||
|
||||
stdenvAdapters =
|
||||
import ../stdenv/adapters.nix { inherit (pkgs) dietlibc fetchurl runCommand; };
|
||||
import ../stdenv/adapters.nix pkgs;
|
||||
|
||||
|
||||
# Allow packages to be overriden globally via the `packageOverrides'
|
||||
@ -3060,9 +3060,9 @@ let
|
||||
inherit stdenv coreutils zlib;
|
||||
};
|
||||
|
||||
wrapClang = wrapClangWith (import ../build-support/clang-wrapper) glibc;
|
||||
wrapClang = wrapClangWith (makeOverridable (import ../build-support/clang-wrapper)) glibc;
|
||||
|
||||
wrapGCC = wrapGCCWith (import ../build-support/gcc-wrapper) glibc;
|
||||
wrapGCC = wrapGCCWith (makeOverridable (import ../build-support/gcc-wrapper)) glibc;
|
||||
|
||||
wrapGCCCross =
|
||||
{gcc, libc, binutils, cross, shell ? "", name ? "gcc-cross-wrapper"}:
|
||||
|
Loading…
Reference in New Issue
Block a user