================ @@ -0,0 +1,157 @@ +#===-----------------------------------------------------------------------===// +# +# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +#===----------------------------------------------------------------------===// +# +# This is a Nix recipe for collecting reproducers for benchmarking purposes in a +# reproducible way. It works by injecting a linker wrapper that embeds a +# reproducer tarball into a non-allocated section of every linked object, which +# generally causes them to be smuggled out of the build tree in a section of the +# final binaries. In principle, this technique should let us collect reproducers +# from any project packaged by Nix without project-specific knowledge, but as +# you can see below, many interesting ones need a few hacks. +# +# If you have Nix installed, you can build the reproducers with the following +# command: +# +# TMPDIR=/var/tmp nix-build -j6 --log-format bar collect.nix +# +# This will result in building several large projects including Chromium and +# Firefox, which will take some time, and it will also build most of the +# dependencies for non-native targets. Eventually you will get a result +# directory containing all the reproducers. +# +# The following projects have been tested successfully: +# - chrome (native only, cross builds fail building the qtbase dependency) +# - firefox (all targets) +# - linux-kernel (all targets, requires patched nixpkgs) +# - ladybird (native only, same problem as chromium) +# - llvm (all targets) + +{ + nixpkgsDir ? fetchTarball "https://github.com/NixOS/nixpkgs/archive/992f916556fcfaa94451ebc7fc6e396134bbf5b1.tar.gz", + nixpkgs ? import nixpkgsDir, +}: +let + reproducerPkgs = + crossSystem: + let + pkgs = nixpkgs { inherit crossSystem; }; + # Wraps the given stdenv and lld package into a variant that collects + # the reproducer and builds with debug info. + reproducerCollectingStdenv = + stdenv: lld: + let + bintools = stdenv.cc.bintools.override { + extraBuildCommands = '' + wrap ${stdenv.cc.targetPrefix}nix-wrap-lld ${nixpkgsDir}/pkgs/build-support/bintools-wrapper/ld-wrapper.sh ${lld}/bin/ld.lld ---------------- pcc wrote:
Done https://github.com/llvm/llvm-project/pull/145789 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
