Merge staging-next into staging

This commit is contained in:
nixpkgs-ci[bot]
2025-06-07 18:05:50 +00:00
committed by GitHub
33 changed files with 930 additions and 134 deletions
+11 -12
View File
@@ -3,15 +3,15 @@
let
inherit (lib)
attrNames
concatMap
concatMapAttrs
concatMapStrings
flip
forEach
head
listToAttrs
mkDefault
mkOption
nameValuePair
optionalAttrs
optionalString
range
toLower
@@ -91,23 +91,22 @@ let
# interfaces, use the IP address corresponding to
# the first interface (i.e. the first network in its
# virtualisation.vlans option).
networking.extraHosts = flip concatMapStrings (attrNames nodes) (
m':
networking.hosts = concatMapAttrs (
name: config:
let
config = nodes.${m'};
hostnames =
optionalString (
config.networking.domain != null
) "${config.networking.hostName}.${config.networking.domain} "
+ "${config.networking.hostName}\n";
in
optionalString (
config.networking.primaryIPAddress != ""
) "${config.networking.primaryIPAddress} ${hostnames}"
+ optionalString (config.networking.primaryIPv6Address != "") (
"${config.networking.primaryIPv6Address} ${hostnames}"
)
);
optionalAttrs (config.networking.primaryIPAddress != "") {
"${config.networking.primaryIPAddress}" = [ hostnames ];
}
// optionalAttrs (config.networking.primaryIPv6Address != "") {
"${config.networking.primaryIPv6Address}" = [ hostnames ];
}
) nodes;
virtualisation.qemu.options = qemuOptions;
boot.initrd.services.udev.rules = concatMapStrings (x: x + "\n") udevRules;
@@ -365,9 +365,12 @@ in
keyFile = mkDefault key;
trustedCaFile = mkDefault caCert;
};
networking.extraHosts = mkIf (config.services.etcd.enable) ''
127.0.0.1 etcd.${top.addons.dns.clusterDomain} etcd.local
'';
networking.hosts = mkIf (config.services.etcd.enable) {
"127.0.0.1" = [
"etcd.${top.addons.dns.clusterDomain}"
"etcd.local"
];
};
services.flannel = with cfg.certs.flannelClient; {
kubeconfig = top.lib.mkKubeConfig "flannel" {
@@ -11,13 +11,7 @@ in
{
options = {
services.jenkins = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Whether to enable the jenkins continuous integration server.
'';
};
enable = lib.mkEnableOption "Jenkins, a continuous integration server";
user = lib.mkOption {
default = "jenkins";
@@ -89,11 +83,13 @@ in
package = lib.mkPackageOption pkgs "jenkins" { };
javaPackage = lib.mkPackageOption pkgs "jdk21" { };
packages = lib.mkOption {
default = [
pkgs.stdenv
pkgs.git
pkgs.jdk17
pkgs.jdk21
config.programs.ssh.package
pkgs.nix
];
@@ -239,7 +235,7 @@ in
# For reference: https://wiki.jenkins.io/display/JENKINS/JenkinsLinuxStartupScript
script = ''
${pkgs.jdk17}/bin/java ${lib.concatStringsSep " " cfg.extraJavaOptions} -jar ${cfg.package}/webapps/jenkins.war --httpListenAddress=${cfg.listenAddress} \
${cfg.javaPackage}/bin/java ${lib.concatStringsSep " " cfg.extraJavaOptions} -jar ${cfg.package}/webapps/jenkins.war --httpListenAddress=${cfg.listenAddress} \
--httpPort=${toString cfg.port} \
--prefix=${cfg.prefix} \
-Djava.awt.headless=true \
@@ -176,6 +176,13 @@ in
defaultText = lib.literalExpression "https://\${cfg.domain}";
description = "URL to the backend server base";
};
COLLABORATION_SERVER_ORIGIN = mkOption {
type = types.str;
default = "https://${cfg.domain}";
defaultText = lib.literalExpression "https://\${cfg.domain}";
description = "Origins allowed to connect to the collaboration server";
};
};
};
default = { };
@@ -70,10 +70,12 @@ in
# Rely on GCP's firewall instead
networking.firewall.enable = mkDefault false;
# Configure default metadata hostnames
networking.extraHosts = ''
169.254.169.254 metadata.google.internal metadata
'';
networking.hosts = {
"169.254.169.254" = [
"metadata.google.internal"
"metadata"
];
};
networking.timeServers = [ "metadata.google.internal" ];
@@ -1084,14 +1084,10 @@ in
) config.containers;
# Generate /etc/hosts entries for the containers.
networking.extraHosts = concatStrings (
mapAttrsToList (
name: cfg:
optionalString (cfg.localAddress != null) ''
${head (splitString "/" cfg.localAddress)} ${name}.containers
''
) config.containers
);
networking.hosts = lib.mapAttrs' (name: cfg: {
name = head (splitString "/" cfg.localAddress);
value = lib.optionals (cfg.localAddress != null) [ "${name}.containers" ];
}) config.containers;
networking.dhcpcd.denyInterfaces = [
"ve-*"
@@ -1960,6 +1960,19 @@ final: prev: {
meta.hydraPlatforms = [ ];
};
checkmate-nvim = buildVimPlugin {
pname = "checkmate.nvim";
version = "2025-06-05";
src = fetchFromGitHub {
owner = "bngarren";
repo = "checkmate.nvim";
rev = "aabe87c58d3c30f45aadab4bef38536e9933cd4a";
sha256 = "1qc3i32hkp59sha7rxbil1r76krlxgqqxn9wj7qlabc99bh11d3s";
};
meta.homepage = "https://github.com/bngarren/checkmate.nvim/";
meta.hydraPlatforms = [ ];
};
ci_dark = buildVimPlugin {
pname = "ci_dark";
version = "2022-03-27";
@@ -149,6 +149,7 @@ https://github.com/Eandrju/cellular-automaton.nvim/,HEAD,
https://github.com/ms-jpq/chadtree/,HEAD,
https://github.com/vim-scripts/changeColorScheme.vim/,,
https://github.com/sudormrfbin/cheatsheet.nvim/,,
https://github.com/bngarren/checkmate.nvim/,HEAD,
https://github.com/yunlingz/ci_dark/,,
https://github.com/declancm/cinnamon.nvim/,HEAD,
https://github.com/projekt0n/circles.nvim/,,
@@ -23,7 +23,7 @@
stdenv.mkDerivation (finalAttrs: {
pname = "palemoon-bin";
version = "33.7.1";
version = "33.7.2";
src = finalAttrs.passthru.sources."gtk${if withGTK3 then "3" else "2"}";
@@ -174,11 +174,11 @@ stdenv.mkDerivation (finalAttrs: {
{
gtk3 = fetchzip {
urls = urlRegionVariants "gtk3";
hash = "sha256-80L93pQaozdyqMnIswWnS+gNo+xVYv5eFVNnLiK/rcU=";
hash = "sha256-GE45GZ+OmNNwRLTD2pcZpqRA66k4q/+lkQnGJG+z6nQ=";
};
gtk2 = fetchzip {
urls = urlRegionVariants "gtk2";
hash = "sha256-dnDQKRCqADzdotJRUeETqaGV+S+M6/de5LuBgMYYvPE=";
hash = "sha256-yJPmmQ9IkGzort9OPPWzv+LSeJci8VNoso3NLYev51Q=";
};
};
@@ -8,13 +8,13 @@
let
drv = stdenv.mkDerivation rec {
pname = "controller-topology-project";
version = "1.0.2";
version = "1.0.3";
src = fetchFromGitHub {
owner = "kodi-game";
repo = "controller-topology-project";
rev = "v${version}";
sha256 = "sha256-pbYFNCDhKhYKREffWbMbcd9xBL4ZiKWR7hMZUCTUHRg=";
sha256 = "sha256-KHM4DAF6xLLlxF19R4UKfVMbLsmniuxy/C4STcL0IHQ=";
};
postPatch = ''
+3 -3
View File
@@ -7,20 +7,20 @@
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "air-formatter";
version = "0.6.0";
version = "0.7.0";
src = fetchFromGitHub {
owner = "posit-dev";
repo = "air";
tag = finalAttrs.version;
hash = "sha256-32/wdz4CFYM/PFVSQiqYErXGHHn2KJyreiQq48vQryY=";
hash = "sha256-jFOhTol5e3TcU217HgcCKutydTePmc5/viilgiJqpqE=";
};
# Remove duplicate entries from cargo lock
cargoPatches = [ ./cargo-lock.patch ];
useFetchCargoVendor = true;
cargoHash = "sha256-zPT47K8OGtprxQt3ZOF2xmf6IRV5rsKWXeaXlyBdVlE=";
cargoHash = "sha256-3v/pgm6BjPvQToSmZ2PrUWTrgffjifB3Xmp1liWCUck=";
useNextest = true;
+37
View File
@@ -0,0 +1,37 @@
{
lib,
stdenvNoCC,
dash,
fetchFromGitHub,
}:
stdenvNoCC.mkDerivation {
pname = "app2unit";
version = "0-unstable-2025-05-09";
src = fetchFromGitHub {
owner = "Vladimir-csp";
repo = "app2unit";
rev = "7b9672a2dc16bdfbe7b7b7c27043529ca3bcb6ae";
sha256 = "03dnx5v75530fwppfgpjl6xzzmdbk73ymrlix129d9n5sqrz9wgk";
};
installPhase = ''
install -Dt $out/bin app2unit
ln -s $out/bin/app2unit $out/bin/app2unit-open
'';
dontPatchShebangs = true;
postFixup = ''
substituteInPlace $out/bin/app2unit \
--replace-fail '#!/bin/sh' '#!${lib.getExe dash}'
'';
meta = {
description = "Launches Desktop Entries as Systemd user units";
homepage = "https://github.com/Vladimir-csp/app2unit";
license = lib.licenses.gpl3;
mainProgram = "app2unit";
maintainers = with lib.maintainers; [ fazzi ];
platforms = lib.platforms.linux;
};
}
+2 -2
View File
@@ -19,13 +19,13 @@ in
llvmPackages.stdenv.mkDerivation (finalAttrs: {
pname = "c3c${optionalString debug "-debug"}";
version = "0.7.1";
version = "0.7.2";
src = fetchFromGitHub {
owner = "c3lang";
repo = "c3c";
tag = "v${finalAttrs.version}";
hash = "sha256-2nTFQNoSAdD12BiwWMtrD9SeelTUOM3DYUdjBSjWnVU=";
hash = "sha256-/S2rcZZe441b1sbiJDH1rnxT/mEP1694d5L8MIV6QQc=";
};
cmakeBuildType = if debug then "Debug" else "Release";
+3 -3
View File
@@ -24,13 +24,13 @@
stdenv.mkDerivation (finalAttrs: {
pname = "cubeb";
version = "0-unstable-2025-05-29";
version = "0-unstable-2025-06-03";
src = fetchFromGitHub {
owner = "mozilla";
repo = "cubeb";
rev = "78ee5f0efaaa395e3e1806e8ef85dcb15c7c063d";
hash = "sha256-PsBlZQTPiBt8Y3okFOZYhiFn58adxVlaf/hLA0doX0o=";
rev = "24c170b2346bb675456449f51406dac6442a84a7";
hash = "sha256-/XTDaG48IFPFPrEcDd3IqX4bN+VbrpaHpzd/7N8J3a8=";
};
outputs = [
@@ -29,11 +29,11 @@ let
in
stdenv.mkDerivation (finalAttrs: {
pname = "debian-devscripts";
version = "2.25.10";
version = "2.25.14";
src = fetchurl {
url = "mirror://debian/pool/main/d/devscripts/devscripts_${finalAttrs.version}.tar.xz";
hash = "sha256-pEzXrKV/bZbYG7j5QXjRDATZRGLt0fhdpwTDbCoKcus=";
hash = "sha256-z95BOgGNYFvleqCv8e6B7Tl91xPzgQHkcxIg55maXvQ=";
};
patches = [
+2 -2
View File
@@ -9,14 +9,14 @@
stdenv.mkDerivation (finalAttrs: {
pname = "debianutils";
version = "5.22";
version = "5.23.1";
src = fetchFromGitLab {
domain = "salsa.debian.org";
owner = "debian";
repo = "debianutils";
rev = "debian/${finalAttrs.version}";
hash = "sha256-TcPWQIgCSJWvJiePqEdRK2kju9xDpl6c9+VOagDsOhs=";
hash = "sha256-kQFl57kusyL3kGG9pJ8j2AsKBH4245xiPoDUYHjjv1g=";
};
nativeBuildInputs = [
+3 -3
View File
@@ -17,13 +17,13 @@
}:
let
version = "0.204.1";
version = "0.204.2";
src = fetchFromGitHub {
owner = "evcc-io";
repo = "evcc";
tag = version;
hash = "sha256-z3SwTBcCETIe2xPN9VU3mqYxd7npvrs44FkGQp56Y00=";
hash = "sha256-e0z1DUXEYbfSIcJBI2gpxY2hb0Tak3sFoYOi5WdsQPY=";
};
vendorHash = "sha256-dBOZ5kYQxVTWB1CTTF3L+FIsuLnVQmA7Vjid7CdJbeo=";
@@ -52,7 +52,7 @@ buildGo124Module rec {
npmDeps = fetchNpmDeps {
inherit src;
hash = "sha256-z64qzc3rDFByJ6Usubm9IIHfu4/i07O/zjtq2VjN7lk=";
hash = "sha256-Hyx9jUVF6aCPD89cxQx7dl77lCfDxcOIZVhSXx0+q0U=";
};
nativeBuildInputs = [
-52
View File
@@ -1,52 +0,0 @@
{
stdenv,
lib,
fetchFromSourcehut,
pkg-config,
openssl,
mailcap,
scdoc,
}:
stdenv.mkDerivation rec {
pname = "gmnisrv";
version = "1.0";
src = fetchFromSourcehut {
owner = "~sircmpwn";
repo = "gmnisrv";
rev = version;
sha256 = "sha256-V9HXXYQIo3zeqZjJEn+dhemNg6AU+ee3FRmBmXgLuYQ=";
};
env.NIX_CFLAGS_COMPILE = toString [
"-Wno-error=deprecated-declarations"
];
postPatch = ''
substituteInPlace config.sh \
--replace "pkg-config" "${stdenv.cc.targetPrefix}pkg-config"
'';
MIMEDB = "${mailcap}/etc/mime.types";
nativeBuildInputs = [
pkg-config
scdoc
];
buildInputs = [
openssl
mailcap
];
meta = with lib; {
description = "Simple Gemini protocol server";
mainProgram = "gmnisrv";
homepage = "https://git.sr.ht/~sircmpwn/gmnisrv";
license = licenses.gpl3Only;
maintainers = with maintainers; [
bsima
jb55
];
platforms = platforms.linux;
};
}
+3 -3
View File
@@ -8,7 +8,7 @@
gnused,
makeWrapper,
nix,
openjdk,
jdk21,
writeScript,
nixosTests,
jq,
@@ -33,10 +33,10 @@ stdenv.mkDerivation (finalAttrs: {
cp "$src" "$out/webapps/jenkins.war"
# Create the `jenkins-cli` command.
${openjdk}/bin/jar -xf "$src" WEB-INF/lib/cli-${finalAttrs.version}.jar \
${jdk21}/bin/jar -xf "$src" WEB-INF/lib/cli-${finalAttrs.version}.jar \
&& mv WEB-INF/lib/cli-${finalAttrs.version}.jar "$out/share/jenkins-cli.jar"
makeWrapper "${openjdk}/bin/java" "$out/bin/jenkins-cli" \
makeWrapper "${jdk21}/bin/java" "$out/bin/jenkins-cli" \
--add-flags "-jar $out/share/jenkins-cli.jar"
'';
+2 -2
View File
@@ -9,11 +9,11 @@
stdenv.mkDerivation rec {
pname = "osinfo-db";
version = "20250124";
version = "20250606";
src = fetchurl {
url = "https://releases.pagure.org/libosinfo/${pname}-${version}.tar.xz";
hash = "sha256-fKcX8JdaeYE1orOe790UNqCwaC4paFx/0B73+DolclA=";
hash = "sha256-mUCqR98pgHPFHc+KTcyFX0lKuGTCTNvaRr2JeVc1f+E=";
};
nativeBuildInputs = [
+6 -6
View File
@@ -193,15 +193,15 @@
},
{
"pname": "Microsoft.DotNet.Arcade.Sdk",
"version": "9.0.0-beta.25255.5",
"hash": "sha256-AgHPYDKvoO3a2zoRSgnokC6XrF521V1lQ9KEPcKyS5E=",
"url": "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/1a5f89f6-d8da-4080-b15f-242650c914a8/nuget/v3/flat2/microsoft.dotnet.arcade.sdk/9.0.0-beta.25255.5/microsoft.dotnet.arcade.sdk.9.0.0-beta.25255.5.nupkg"
"version": "9.0.0-beta.25263.2",
"hash": "sha256-mFVYybJiMi58vu+hT4VfXgWCWAXGeKxI7OwUQi2FO/A=",
"url": "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/1a5f89f6-d8da-4080-b15f-242650c914a8/nuget/v3/flat2/microsoft.dotnet.arcade.sdk/9.0.0-beta.25263.2/microsoft.dotnet.arcade.sdk.9.0.0-beta.25263.2.nupkg"
},
{
"pname": "Microsoft.DotNet.XliffTasks",
"version": "9.0.0-beta.25255.5",
"hash": "sha256-yigTPcb88S+1FUal0K/fL5pu5I/dmPACAo2sPOTDfZk=",
"url": "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/1a5f89f6-d8da-4080-b15f-242650c914a8/nuget/v3/flat2/microsoft.dotnet.xlifftasks/9.0.0-beta.25255.5/microsoft.dotnet.xlifftasks.9.0.0-beta.25255.5.nupkg"
"version": "9.0.0-beta.25263.2",
"hash": "sha256-J86joC1OMlnjMppEBf9GwEbc0IdVJ/XjshBiZunH/EU=",
"url": "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/1a5f89f6-d8da-4080-b15f-242650c914a8/nuget/v3/flat2/microsoft.dotnet.xlifftasks/9.0.0-beta.25263.2/microsoft.dotnet.xlifftasks.9.0.0-beta.25263.2.nupkg"
},
{
"pname": "Microsoft.Extensions.Configuration",
+3 -3
View File
@@ -32,18 +32,18 @@ in
buildDotnetModule rec {
inherit pname dotnet-sdk dotnet-runtime;
vsVersion = "2.78.15";
vsVersion = "2.80.16";
src = fetchFromGitHub {
owner = "dotnet";
repo = "roslyn";
rev = "VSCode-CSharp-${vsVersion}";
hash = "sha256-Lim2f2//NFiMrZzvpREMlk6/5NWatVTiQrciAAxIiLY=";
hash = "sha256-4kFu0bxbLZ31ifGluSrN9sN5EwzLg3bVHnh9iB9TGpA=";
};
# versioned independently from vscode-csharp
# "roslyn" in here:
# https://github.com/dotnet/vscode-csharp/blob/main/package.json
version = "5.0.0-1.25263.3";
version = "5.0.0-1.25266.2";
projectFile = "src/LanguageServer/${project}/${project}.csproj";
useDotnetFromEnv = true;
nugetDeps = ./deps.json;
+3 -3
View File
@@ -2,9 +2,9 @@
teleport,
}:
teleport.override {
version = "16.5.10";
hash = "sha256-i+2IK+X0Opyv2tQPpj2XhY64aQGdbylS/C7LsTykuXI=";
vendorHash = "sha256-DdVBtMwz0AIGCYj/QLczG8GPP9mqKrdF+M0NqmM6J0I=";
version = "16.5.11";
hash = "sha256-uLis1oRTr5J2bKaJtnVAIQ0ixYT8BYLo4jQPcdFp82s=";
vendorHash = "sha256-OcVHckqxpTVz6Gaemt3+9WxBQc5D5QBxb3IMGOMq4LI=";
pnpmHash = "sha256-JQca2eFxcKJDHIaheJBg93ivZU95UWMRgbcK7QE4R10=";
cargoHash = "sha256-04zykCcVTptEPGy35MIWG+tROKFzEepLBmn04mSbt7I=";
}
+2 -2
View File
@@ -4,8 +4,8 @@ let
base = callPackage ./generic.nix (
_args
// {
version = "8.3.21";
hash = "sha256-0HaebhHPpsWaFt4kFmi+jH8xpymVCo0GGQ360thiKwQ=";
version = "8.3.22";
hash = "sha256-mRM+LNoq83uqedsX2O/UFGKPFKAux18UGKCqP2qmZzs=";
}
);
in
@@ -260,6 +260,7 @@ stdenv.mkDerivation (
// (removeAttrs args [
"withLinuxHeaders"
"linuxHeaders"
"withGd"
"enableCET"
"postInstall"
+2 -1
View File
@@ -3,6 +3,7 @@
stdenv,
callPackage,
withLinuxHeaders ? true,
linuxHeaders ? null,
profilingLibraries ? false,
withGd ? false,
enableCET ? if stdenv.hostPlatform.isx86_64 then "permissive" else false,
@@ -19,7 +20,7 @@ let
];
in
(callPackage ./common.nix { inherit stdenv; } {
(callPackage ./common.nix { inherit stdenv linuxHeaders; } {
inherit
withLinuxHeaders
withGd
+2 -2
View File
@@ -5,14 +5,14 @@
# nix build .#legacyPackages.x86_64-darwin.mesa .#legacyPackages.aarch64-darwin.mesa
rec {
pname = "mesa";
version = "25.1.2";
version = "25.1.3";
src = fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "mesa";
repo = "mesa";
rev = "mesa-${version}";
hash = "sha256-oE1QZyCBFdWCFq5T+Unf0GYpvCssVNOEQtPQgPbatQQ=";
hash = "sha256-BFncfkbpjVYO+7hYh5Ui6RACLq7/m6b8eIJ5B5lhq5Y=";
};
meta = {
@@ -15,7 +15,7 @@
buildPythonPackage rec {
pname = "pylamarzocco";
version = "2.0.7";
version = "2.0.8";
pyproject = true;
disabled = pythonOlder "3.12";
@@ -24,7 +24,7 @@ buildPythonPackage rec {
owner = "zweckj";
repo = "pylamarzocco";
tag = "v${version}";
hash = "sha256-IFac66zBGvRASXJDa/Y6F3BxZhRD9tG8yAB2l2IsDVk=";
hash = "sha256-Fsxs3ugjzU9l3SlxqKs+Bej34kRn2mKrwzCZ94P2UGo=";
};
build-system = [ setuptools ];
@@ -0,0 +1,730 @@
From e3a1797dbab3eaa1c808d53215b32c8759d27ac7 Mon Sep 17 00:00:00 2001
From: Collin Baker <collinbaker@chromium.org>
Date: Fri, 4 Apr 2025 14:08:18 -0700
Subject: [PATCH] Reland "Use #[global_allocator] to provide Rust allocator
implementation"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This is a reland of commit cfa3beef52625e03ba6ce2b2ac98e1b89dde5cdb
Original was reverted due to a cronet gn2bp failure. The script
filtered out GN rules in //build/rust/std, but this caused an exception
when //build/rust/std:allocator was referenced later.
Moving the rules to //build/rust/allocator sidesteps the issue.
Original change's description:
> Use #[global_allocator] to provide Rust allocator implementation
>
> The allocator shim hack we have been using no longer works with
> upstream Rust. Replace it with a less-unsupported method: provide a
> https://github.com/rust-lang/rust/issues/123015, which still requires
> us to provide a few symbol definitions.
>
> Bug: 408221149, 407024458
> Change-Id: If1808ca24b12dc80ead35a25521313a3d2e148d5
>
> Cq-Include-Trybots: luci.chromium.try:android-rust-arm32-rel,android-rust-arm64-dbg,android-rust-arm64-rel,linux-rust-x64-dbg,linux-rust-x64-rel,mac-rust-x64-dbg,win-rust-x64-dbg,win-rust-x64-rel
> Change-Id: If1808ca24b12dc80ead35a25521313a3d2e148d5
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6427855
> Reviewed-by: Alan Zhao <ayzhao@google.com>
> Reviewed-by: Lei Zhang <thestig@chromium.org>
> Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
> Commit-Queue: Collin Baker <collinbaker@chromium.org>
> Auto-Submit: Collin Baker <collinbaker@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1442472}
Bug: 408221149, 407024458
Cq-Include-Trybots: luci.chromium.try:android-rust-arm32-rel,android-rust-arm64-dbg,android-rust-arm64-rel,linux-rust-x64-dbg,linux-rust-x64-rel,mac-rust-x64-dbg,win-rust-x64-dbg,win-rust-x64-rel
Change-Id: I36fef217297bfe64ae81519be24b8c653f6fdfa1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6432410
Reviewed-by: Mohannad Farrag <aymanm@google.com>
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Auto-Submit: Collin Baker <collinbaker@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1442922}
---
build/rust/allocator/BUILD.gn | 90 ++++++++++++++++
build/rust/{std => allocator}/alias.cc | 4 +-
build/rust/{std => allocator}/alias.h | 6 +-
.../allocator_impls.cc} | 100 ++++++++----------
build/rust/allocator/allocator_impls.h | 25 +++++
.../allocator/allocator_shim_definitions.cc | 30 ++++++
.../{std => allocator}/compiler_specific.h | 6 +-
.../rust/{std => allocator}/immediate_crash.h | 6 +-
build/rust/allocator/lib.rs | 48 +++++++++
build/rust/cargo_crate.gni | 9 ++
build/rust/rust_macro.gni | 3 +
build/rust/rust_target.gni | 4 +
build/rust/std/BUILD.gn | 41 -------
components/cronet/android/dependencies.txt | 1 +
third_party/breakpad/BUILD.gn | 10 +-
15 files changed, 272 insertions(+), 111 deletions(-)
create mode 100644 build/rust/allocator/BUILD.gn
rename build/rust/{std => allocator}/alias.cc (87%)
rename build/rust/{std => allocator}/alias.h (91%)
rename build/rust/{std/remap_alloc.cc => allocator/allocator_impls.cc} (67%)
create mode 100644 build/rust/allocator/allocator_impls.h
create mode 100644 build/rust/allocator/allocator_shim_definitions.cc
rename build/rust/{std => allocator}/compiler_specific.h (87%)
rename build/rust/{std => allocator}/immediate_crash.h (97%)
create mode 100644 build/rust/allocator/lib.rs
diff --git a/build/rust/allocator/BUILD.gn b/build/rust/allocator/BUILD.gn
new file mode 100644
index 00000000000000..06aa47f097c9c4
--- /dev/null
+++ b/build/rust/allocator/BUILD.gn
@@ -0,0 +1,90 @@
+# Copyright 2025 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/buildflag_header.gni")
+import("//build/config/rust.gni")
+import("//build/rust/rust_static_library.gni")
+
+rust_allocator_uses_partition_alloc = false
+if (build_with_chromium) {
+ import("//base/allocator/partition_allocator/partition_alloc.gni")
+ rust_allocator_uses_partition_alloc = use_partition_alloc_as_malloc
+}
+
+buildflag_header("buildflags") {
+ header = "buildflags.h"
+ flags = [
+ "RUST_ALLOCATOR_USES_PARTITION_ALLOC=$rust_allocator_uses_partition_alloc",
+ ]
+ visibility = [ ":*" ]
+}
+
+if (toolchain_has_rust) {
+ # All targets which depend on Rust code but are not linked by rustc must
+ # depend on this. Usually, this dependency will come from the rust_target() GN
+ # template. However, cargo_crate() does *not* include this dependency so any
+ # C++ targets which directly depend on a cargo_crate() must depend on this.
+ rust_static_library("allocator") {
+ sources = [ "lib.rs" ]
+ crate_root = "lib.rs"
+ cxx_bindings = [ "lib.rs" ]
+
+ deps = [
+ ":allocator_impls",
+ ":allocator_shim_definitions",
+ ]
+
+ no_chromium_prelude = true
+ no_allocator_crate = true
+ allow_unsafe = true
+ }
+
+ static_library("allocator_impls") {
+ public_deps = []
+ if (rust_allocator_uses_partition_alloc) {
+ public_deps += [ "//base/allocator/partition_allocator:partition_alloc" ]
+ }
+
+ sources = [
+ "allocator_impls.cc",
+ "allocator_impls.h",
+ ]
+
+ deps = [
+ ":allocator_cpp_shared",
+ ":buildflags",
+
+ # TODO(crbug.com/408221149): remove the C++ -> Rust dependency for the
+ # default allocator.
+ "//build/rust/std",
+ ]
+
+ visibility = [ ":*" ]
+ }
+
+ source_set("allocator_shim_definitions") {
+ sources = [ "allocator_shim_definitions.cc" ]
+
+ deps = [ ":allocator_cpp_shared" ]
+
+ visibility = [ ":*" ]
+ }
+
+ source_set("allocator_cpp_shared") {
+ sources = [
+ # `alias.*`, `compiler_specific.h`, and `immediate_crash.*` have been
+ # copied from `//base`.
+ # TODO(crbug.com/40279749): Avoid duplication / reuse code.
+ "alias.cc",
+ "alias.h",
+ "compiler_specific.h",
+ "immediate_crash.h",
+ ]
+
+ visibility = [
+ ":allocator_impls",
+ ":allocator_shim_definitions",
+ ]
+ }
+}
diff --git a/build/rust/std/alias.cc b/build/rust/allocator/alias.cc
similarity index 87%
rename from build/rust/std/alias.cc
rename to build/rust/allocator/alias.cc
index 42febac3ed1fc5..ca20986f8ed496 100644
--- a/build/rust/std/alias.cc
+++ b/build/rust/allocator/alias.cc
@@ -7,9 +7,9 @@
//
// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
-#include "build/rust/std/alias.h"
+#include "build/rust/allocator/alias.h"
-#include "build/rust/std/compiler_specific.h"
+#include "build/rust/allocator/compiler_specific.h"
namespace build_rust_std {
namespace debug {
diff --git a/build/rust/std/alias.h b/build/rust/allocator/alias.h
similarity index 91%
rename from build/rust/std/alias.h
rename to build/rust/allocator/alias.h
index 0eaba6766148fa..80995ecfb045e3 100644
--- a/build/rust/std/alias.h
+++ b/build/rust/allocator/alias.h
@@ -8,8 +8,8 @@
//
// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
-#ifndef BUILD_RUST_STD_ALIAS_H_
-#define BUILD_RUST_STD_ALIAS_H_
+#ifndef BUILD_RUST_ALLOCATOR_ALIAS_H_
+#define BUILD_RUST_ALLOCATOR_ALIAS_H_
#include <stddef.h>
@@ -34,4 +34,4 @@ void Alias(const void* var);
const int line_number = __LINE__; \
build_rust_std::debug::Alias(&line_number)
-#endif // BUILD_RUST_STD_ALIAS_H_
+#endif // BUILD_RUST_ALLOCATOR_ALIAS_H_
diff --git a/build/rust/std/remap_alloc.cc b/build/rust/allocator/allocator_impls.cc
similarity index 67%
rename from build/rust/std/remap_alloc.cc
rename to build/rust/allocator/allocator_impls.cc
index a443b11ec513df..1fde98f23cd124 100644
--- a/build/rust/std/remap_alloc.cc
+++ b/build/rust/allocator/allocator_impls.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "build/rust/allocator/allocator_impls.h"
+
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/390223051): Remove C-library calls to fix the errors.
#pragma allow_unsafe_libc_calls
@@ -11,9 +13,9 @@
#include <cstring>
#include "build/build_config.h"
-#include "build/rust/std/alias.h"
-#include "build/rust/std/buildflags.h"
-#include "build/rust/std/immediate_crash.h"
+#include "build/rust/allocator/alias.h"
+#include "build/rust/allocator/buildflags.h"
+#include "build/rust/allocator/immediate_crash.h"
#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
#include "partition_alloc/partition_alloc_constants.h" // nogncheck
@@ -22,6 +24,11 @@
#include <cstdlib>
#endif
+// NOTE: this documentation is outdated.
+//
+// TODO(crbug.com/408221149): update this documentation, or replace it with docs
+// in the Rust allocator implementation.
+//
// When linking a final binary, rustc has to pick between either:
// * The default Rust allocator
// * Any #[global_allocator] defined in *any rlib in its dependency tree*
@@ -87,19 +94,6 @@
// enabling it breaks Win32 APIs like CreateProcess:
// https://issues.chromium.org/u/1/issues/368070343#comment29
-extern "C" {
-
-#ifdef COMPONENT_BUILD
-#if BUILDFLAG(IS_WIN)
-#define REMAP_ALLOC_ATTRIBUTES __declspec(dllexport) __attribute__((weak))
-#else
-#define REMAP_ALLOC_ATTRIBUTES \
- __attribute__((visibility("default"))) __attribute__((weak))
-#endif
-#else
-#define REMAP_ALLOC_ATTRIBUTES __attribute__((weak))
-#endif // COMPONENT_BUILD
-
#if !BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC) && BUILDFLAG(IS_WIN) && \
defined(ADDRESS_SANITIZER)
#define USE_WIN_ALIGNED_MALLOC 1
@@ -107,17 +101,19 @@ extern "C" {
#define USE_WIN_ALIGNED_MALLOC 0
#endif
-// This must exist as the stdlib depends on it to prove that we know the
-// alloc shims below are unstable. In the future we may be required to replace
-// them with a #[global_allocator] crate (see file comment above for more).
-//
-// Marked as weak as when Rust drives linking it includes this symbol itself,
-// and we don't want a collision due to C++ being in the same link target, where
-// C++ causes us to explicitly link in the stdlib and this symbol here.
-[[maybe_unused]]
-__attribute__((weak)) unsigned char __rust_no_alloc_shim_is_unstable;
+// The default allocator functions provided by the Rust standard library.
+extern "C" void* __rdl_alloc(size_t size, size_t align);
+extern "C" void __rdl_dealloc(void* p, size_t size, size_t align);
+extern "C" void* __rdl_realloc(void* p,
+ size_t old_size,
+ size_t align,
+ size_t new_size);
+
+extern "C" void* __rdl_alloc_zeroed(size_t size, size_t align);
+
+namespace rust_allocator_internal {
-REMAP_ALLOC_ATTRIBUTES void* __rust_alloc(size_t size, size_t align) {
+unsigned char* alloc(size_t size, size_t align) {
#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
// PartitionAlloc will crash if given an alignment larger than this.
if (align > partition_alloc::internal::kMaxSupportedAlignment) {
@@ -125,19 +121,19 @@ REMAP_ALLOC_ATTRIBUTES void* __rust_alloc(size_t size, size_t align) {
}
if (align <= alignof(std::max_align_t)) {
- return allocator_shim::UncheckedAlloc(size);
+ return static_cast<unsigned char*>(allocator_shim::UncheckedAlloc(size));
} else {
- return allocator_shim::UncheckedAlignedAlloc(size, align);
+ return static_cast<unsigned char*>(
+ allocator_shim::UncheckedAlignedAlloc(size, align));
}
#elif USE_WIN_ALIGNED_MALLOC
- return _aligned_malloc(size, align);
+ return static_cast<unsigned char*>(_aligned_malloc(size, align));
#else
- extern void* __rdl_alloc(size_t size, size_t align);
- return __rdl_alloc(size, align);
+ return static_cast<unsigned char*>(__rdl_alloc(size, align));
#endif
}
-REMAP_ALLOC_ATTRIBUTES void __rust_dealloc(void* p, size_t size, size_t align) {
+void dealloc(unsigned char* p, size_t size, size_t align) {
#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
if (align <= alignof(std::max_align_t)) {
allocator_shim::UncheckedFree(p);
@@ -147,54 +143,44 @@ REMAP_ALLOC_ATTRIBUTES void __rust_dealloc(void* p, size_t size, size_t align) {
#elif USE_WIN_ALIGNED_MALLOC
return _aligned_free(p);
#else
- extern void __rdl_dealloc(void* p, size_t size, size_t align);
__rdl_dealloc(p, size, align);
#endif
}
-REMAP_ALLOC_ATTRIBUTES void* __rust_realloc(void* p,
- size_t old_size,
- size_t align,
- size_t new_size) {
+unsigned char* realloc(unsigned char* p,
+ size_t old_size,
+ size_t align,
+ size_t new_size) {
#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
if (align <= alignof(std::max_align_t)) {
- return allocator_shim::UncheckedRealloc(p, new_size);
+ return static_cast<unsigned char*>(
+ allocator_shim::UncheckedRealloc(p, new_size));
} else {
- return allocator_shim::UncheckedAlignedRealloc(p, new_size, align);
+ return static_cast<unsigned char*>(
+ allocator_shim::UncheckedAlignedRealloc(p, new_size, align));
}
#elif USE_WIN_ALIGNED_MALLOC
- return _aligned_realloc(p, new_size, align);
+ return static_cast<unsigned char*>(_aligned_realloc(p, new_size, align));
#else
- extern void* __rdl_realloc(void* p, size_t old_size, size_t align,
- size_t new_size);
- return __rdl_realloc(p, old_size, align, new_size);
+ return static_cast<unsigned char*>(
+ __rdl_realloc(p, old_size, align, new_size));
#endif
}
-REMAP_ALLOC_ATTRIBUTES void* __rust_alloc_zeroed(size_t size, size_t align) {
+unsigned char* alloc_zeroed(size_t size, size_t align) {
#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC) || USE_WIN_ALIGNED_MALLOC
// TODO(danakj): When RUST_ALLOCATOR_USES_PARTITION_ALLOC is true, it's
// possible that a partition_alloc::UncheckedAllocZeroed() call would perform
// better than partition_alloc::UncheckedAlloc() + memset. But there is no
// such API today. See b/342251590.
- void* p = __rust_alloc(size, align);
+ unsigned char* p = alloc(size, align);
if (p) {
memset(p, 0, size);
}
return p;
#else
- extern void* __rdl_alloc_zeroed(size_t size, size_t align);
- return __rdl_alloc_zeroed(size, align);
+ return static_cast<unsigned char*>(__rdl_alloc_zeroed(size, align));
#endif
}
-REMAP_ALLOC_ATTRIBUTES void __rust_alloc_error_handler(size_t size,
- size_t align) {
- NO_CODE_FOLDING();
- IMMEDIATE_CRASH();
-}
-
-REMAP_ALLOC_ATTRIBUTES extern const unsigned char
- __rust_alloc_error_handler_should_panic = 0;
-
-} // extern "C"
+} // namespace rust_allocator_internal
diff --git a/build/rust/allocator/allocator_impls.h b/build/rust/allocator/allocator_impls.h
new file mode 100644
index 00000000000000..afb335412faf9c
--- /dev/null
+++ b/build/rust/allocator/allocator_impls.h
@@ -0,0 +1,25 @@
+// Copyright 2025 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_
+#define BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_
+
+#include <cstddef>
+
+#include "build/build_config.h"
+#include "build/rust/allocator/buildflags.h"
+
+namespace rust_allocator_internal {
+
+unsigned char* alloc(size_t size, size_t align);
+void dealloc(unsigned char* p, size_t size, size_t align);
+unsigned char* realloc(unsigned char* p,
+ size_t old_size,
+ size_t align,
+ size_t new_size);
+unsigned char* alloc_zeroed(size_t size, size_t align);
+
+} // namespace rust_allocator_internal
+
+#endif // BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_
diff --git a/build/rust/allocator/allocator_shim_definitions.cc b/build/rust/allocator/allocator_shim_definitions.cc
new file mode 100644
index 00000000000000..a4d1bd77b7016e
--- /dev/null
+++ b/build/rust/allocator/allocator_shim_definitions.cc
@@ -0,0 +1,30 @@
+// Copyright 2025 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <cstddef>
+
+#include "build/rust/allocator/alias.h"
+#include "build/rust/allocator/immediate_crash.h"
+
+extern "C" {
+
+// As part of rustc's contract for using `#[global_allocator]` without
+// rustc-generated shims we must define this symbol, since we are opting in to
+// unstable functionality. See https://github.com/rust-lang/rust/issues/123015
+//
+// Mark it weak since rustc will generate it when it drives linking.
+[[maybe_unused]]
+__attribute__((weak)) unsigned char __rust_no_alloc_shim_is_unstable;
+
+__attribute__((weak)) void __rust_alloc_error_handler(size_t size,
+ size_t align) {
+ NO_CODE_FOLDING();
+ IMMEDIATE_CRASH();
+}
+
+__attribute__((
+ weak)) extern const unsigned char __rust_alloc_error_handler_should_panic =
+ 0;
+
+} // extern "C"
diff --git a/build/rust/std/compiler_specific.h b/build/rust/allocator/compiler_specific.h
similarity index 87%
rename from build/rust/std/compiler_specific.h
rename to build/rust/allocator/compiler_specific.h
index ea79a7a8dc2842..f9079679a3e9af 100644
--- a/build/rust/std/compiler_specific.h
+++ b/build/rust/allocator/compiler_specific.h
@@ -7,8 +7,8 @@
//
// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
-#ifndef BUILD_RUST_STD_COMPILER_SPECIFIC_H_
-#define BUILD_RUST_STD_COMPILER_SPECIFIC_H_
+#ifndef BUILD_RUST_ALLOCATOR_COMPILER_SPECIFIC_H_
+#define BUILD_RUST_ALLOCATOR_COMPILER_SPECIFIC_H_
#include "build/build_config.h"
@@ -35,4 +35,4 @@
#define NOINLINE
#endif
-#endif // BUILD_RUST_STD_COMPILER_SPECIFIC_H_
+#endif // BUILD_RUST_ALLOCATOR_COMPILER_SPECIFIC_H_
diff --git a/build/rust/std/immediate_crash.h b/build/rust/allocator/immediate_crash.h
similarity index 97%
rename from build/rust/std/immediate_crash.h
rename to build/rust/allocator/immediate_crash.h
index e4fd5a09d9379f..9cbf9fd65f3e09 100644
--- a/build/rust/std/immediate_crash.h
+++ b/build/rust/allocator/immediate_crash.h
@@ -5,8 +5,8 @@
// This file has been copied from //base/immediate_crash.h.
// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
-#ifndef BUILD_RUST_STD_IMMEDIATE_CRASH_H_
-#define BUILD_RUST_STD_IMMEDIATE_CRASH_H_
+#ifndef BUILD_RUST_ALLOCATOR_IMMEDIATE_CRASH_H_
+#define BUILD_RUST_ALLOCATOR_IMMEDIATE_CRASH_H_
#include "build/build_config.h"
@@ -168,4 +168,4 @@
#endif // defined(__clang__) || defined(COMPILER_GCC)
-#endif // BUILD_RUST_STD_IMMEDIATE_CRASH_H_
+#endif // BUILD_RUST_ALLOCATOR_IMMEDIATE_CRASH_H_
diff --git a/build/rust/allocator/lib.rs b/build/rust/allocator/lib.rs
new file mode 100644
index 00000000000000..7f4a0fc2456942
--- /dev/null
+++ b/build/rust/allocator/lib.rs
@@ -0,0 +1,48 @@
+// Copyright 2025 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+//! Define the allocator that Rust code in Chrome should use.
+//!
+//! Any final artifact that depends on this crate, even transitively, will use
+//! the allocator defined here. Currently this is a thin wrapper around
+//! allocator_impls.cc's functions; see the documentation there.
+
+use std::alloc::{GlobalAlloc, Layout};
+
+struct Allocator;
+
+unsafe impl GlobalAlloc for Allocator {
+ unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
+ unsafe { ffi::alloc(layout.size(), layout.align()) }
+ }
+
+ unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
+ unsafe {
+ ffi::dealloc(ptr, layout.size(), layout.align());
+ }
+ }
+
+ unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
+ unsafe { ffi::alloc_zeroed(layout.size(), layout.align()) }
+ }
+
+ unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
+ unsafe { ffi::realloc(ptr, layout.size(), layout.align(), new_size) }
+ }
+}
+
+#[global_allocator]
+static GLOBAL: Allocator = Allocator;
+
+#[cxx::bridge(namespace = "rust_allocator_internal")]
+mod ffi {
+ extern "C++" {
+ include!("build/rust/allocator/allocator_impls.h");
+
+ unsafe fn alloc(size: usize, align: usize) -> *mut u8;
+ unsafe fn dealloc(p: *mut u8, size: usize, align: usize);
+ unsafe fn realloc(p: *mut u8, old_size: usize, align: usize, new_size: usize) -> *mut u8;
+ unsafe fn alloc_zeroed(size: usize, align: usize) -> *mut u8;
+ }
+}
diff --git a/build/rust/cargo_crate.gni b/build/rust/cargo_crate.gni
index 6d11c538bf4d5a..d9912722b4ecdb 100644
--- a/build/rust/cargo_crate.gni
+++ b/build/rust/cargo_crate.gni
@@ -259,6 +259,12 @@ template("cargo_crate") {
# Don't import the `chromium` crate into third-party code.
no_chromium_prelude = true
+ # Don't depend on the chrome-specific #[global_allocator] crate from
+ # third-party code. This avoids some dependency cycle issues. The allocator
+ # crate will still be used if it exists anywhere in the dependency graph for
+ # a given linked artifact.
+ no_allocator_crate = true
+
rustc_metadata = _rustc_metadata
# TODO(crbug.com/40259764): don't default to true. This requires changes to
@@ -483,6 +489,9 @@ template("cargo_crate") {
# Don't import the `chromium` crate into third-party code.
no_chromium_prelude = true
+ # Build scripts do not need to link to chrome's allocator.
+ no_allocator_crate = true
+
# The ${_build_script_name}_output target looks for the exe in this
# location. Due to how the Windows component build works, this has to
# be $root_out_dir for all EXEs. In component build, C++ links to the
diff --git a/build/rust/rust_macro.gni b/build/rust/rust_macro.gni
index bcbb30ed441115..41d857632ccdc9 100644
--- a/build/rust/rust_macro.gni
+++ b/build/rust/rust_macro.gni
@@ -16,6 +16,9 @@ template("rust_macro") {
forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
proc_macro_configs = invoker.configs
target_type = "rust_proc_macro"
+
+ # Macros are loaded by rustc and shouldn't use chrome's allocation routines.
+ no_allocator_crate = true
}
}
diff --git a/build/rust/rust_target.gni b/build/rust/rust_target.gni
index 1a2f96337d4361..1003a7b678352d 100644
--- a/build/rust/rust_target.gni
+++ b/build/rust/rust_target.gni
@@ -339,6 +339,10 @@ template("rust_target") {
_rust_deps += [ "//build/rust/std" ]
}
+ if (!defined(invoker.no_allocator_crate) || !invoker.no_allocator_crate) {
+ _rust_deps += [ "//build/rust/allocator" ]
+ }
+
if (_build_unit_tests) {
_unit_test_target = "${_target_name}_unittests"
if (defined(invoker.unit_test_target)) {
diff --git a/build/rust/std/BUILD.gn b/build/rust/std/BUILD.gn
index 6b996aa1fe3865..25db126076b2fa 100644
--- a/build/rust/std/BUILD.gn
+++ b/build/rust/std/BUILD.gn
@@ -15,51 +15,12 @@
# allocator functions to PartitionAlloc when `use_partition_alloc_as_malloc` is
# true, so that Rust and C++ use the same allocator backend.
-import("//build/buildflag_header.gni")
import("//build/config/compiler/compiler.gni")
import("//build/config/coverage/coverage.gni")
import("//build/config/rust.gni")
import("//build/config/sanitizers/sanitizers.gni")
-rust_allocator_uses_partition_alloc = false
-if (build_with_chromium) {
- import("//base/allocator/partition_allocator/partition_alloc.gni")
- rust_allocator_uses_partition_alloc = use_partition_alloc_as_malloc
-}
-
-buildflag_header("buildflags") {
- header = "buildflags.h"
- flags = [
- "RUST_ALLOCATOR_USES_PARTITION_ALLOC=$rust_allocator_uses_partition_alloc",
- ]
- visibility = [ ":*" ]
-}
-
if (toolchain_has_rust) {
- # If clang performs the link step, we need to provide the allocator symbols
- # that are normally injected by rustc during linking.
- #
- # We also "happen to" use this to redirect allocations to PartitionAlloc,
- # though that would be better done through a #[global_allocator] crate (see
- # above).
- source_set("remap_alloc") {
- public_deps = []
- if (rust_allocator_uses_partition_alloc) {
- public_deps += [ "//base/allocator/partition_allocator:partition_alloc" ]
- }
- deps = [ ":buildflags" ]
- sources = [
- # `alias.*`, `compiler_specific.h`, and `immediate_crash.*` have been
- # copied from `//base`.
- # TODO(crbug.com/40279749): Avoid duplication / reuse code.
- "alias.cc",
- "alias.h",
- "compiler_specific.h",
- "immediate_crash.h",
- "remap_alloc.cc",
- ]
- }
-
# List of Rust stdlib rlibs which are present in the official Rust toolchain
# we are using from the Android team. This is usually a version or two behind
# nightly. Generally this matches the toolchain we build ourselves, but if
@@ -269,8 +230,6 @@ if (toolchain_has_rust) {
foreach(libname, stdlib_files + skip_stdlib_files) {
deps += [ "rules:$libname" ]
}
-
- public_deps = [ ":remap_alloc" ]
}
} else {
action("find_stdlib") {
diff --git a/components/cronet/android/dependencies.txt b/components/cronet/android/dependencies.txt
index bf56bc45ed41f7..c0e41ef7c6766a 100644
--- a/components/cronet/android/dependencies.txt
+++ b/components/cronet/android/dependencies.txt
@@ -14,6 +14,7 @@
//build/config
//build/config/compiler
//build/rust
+//build/rust/allocator
//build/rust/chromium_prelude
//build/rust/std
//build/rust/std/rules
diff --git a/third_party/breakpad/BUILD.gn b/third_party/breakpad/BUILD.gn
index 2f4e1ab0156609..e140ecbedcc9a0 100644
--- a/third_party/breakpad/BUILD.gn
+++ b/third_party/breakpad/BUILD.gn
@@ -495,7 +495,10 @@ if (is_mac) {
defines = [ "HAVE_MACH_O_NLIST_H" ]
# Rust demangle support.
- deps = [ "//third_party/rust/rustc_demangle_capi/v0_1:lib" ]
+ deps = [
+ "//build/rust/allocator",
+ "//third_party/rust/rustc_demangle_capi/v0_1:lib",
+ ]
defines += [ "HAVE_RUSTC_DEMANGLE" ]
include_dirs += [ "//third_party/rust/chromium_crates_io/vendor/rustc-demangle-capi-v0_1/include" ]
sources += [ "//third_party/rust/chromium_crates_io/vendor/rustc-demangle-capi-v0_1/include/rustc_demangle.h" ]
@@ -743,7 +746,10 @@ if (is_linux || is_chromeos || is_android) {
include_dirs = [ "breakpad/src" ]
# Rust demangle support.
- deps = [ "//third_party/rust/rustc_demangle_capi/v0_1:lib" ]
+ deps = [
+ "//build/rust/allocator",
+ "//third_party/rust/rustc_demangle_capi/v0_1:lib",
+ ]
defines += [ "HAVE_RUSTC_DEMANGLE" ]
include_dirs += [ "//third_party/rust/chromium_crates_io/vendor/rustc-demangle-capi-v0_1/include" ]
sources += [ "//third_party/rust/chromium_crates_io/vendor/rustc-demangle-capi-v0_1/include/rustc_demangle.h" ]
@@ -5,6 +5,7 @@
nodejs,
fetchYarnDeps,
fetchNpmDeps,
fetchpatch,
fixup-yarn-lock,
npmHooks,
yarn,
@@ -91,6 +92,65 @@ in
# This patch makes those older versions also use the new adler2 library
++ lib.optionals (lib.versionOlder info.version "35") [
./use-rust-adler2.patch
]
# Requirements for the next section
++ lib.optionals (lib.versionOlder info.version "35") [
(fetchpatch {
name = "Avoid-build-rust-PartitionAlloc-dep-when-not-build_with_chromium.patch";
url = "https://github.com/chromium/chromium/commit/ee94f376a0dd642a93fbf4a5fa8e7aa8fb2a69b5.patch";
hash = "sha256-qGjy9VZ4d3T5AuqOrBKEajBswwBU/7j0n80rpvHZLmM=";
})
(fetchpatch {
name = "Suppress-unsafe_libc_call-warning-for-rust-remap_alloc-cc.patch";
url = "https://github.com/chromium/chromium/commit/d5d79d881e74c6c8630f7d2f3affd4f656fdeb4e.patch";
hash = "sha256-1oy5WRvNzKuUTJkt8kULUqE4JU+EKEV1PB9QN8HF4SE=";
})
]
# Fix building with Rust 1.87+
# https://issues.chromium.org/issues/407024458
++ lib.optionals (lib.versionOlder info.version "37") [
# https://chromium-review.googlesource.com/c/chromium/src/+/6432410
# Not using fetchpatch here because it ignores file renames: https://github.com/nixos/nixpkgs/issues/32084
./Reland-Use-global_allocator-to-provide-Rust-allocator-implementation.patch
# https://chromium-review.googlesource.com/c/chromium/src/+/6434355
(fetchpatch {
name = "Call-Rust-default-allocator-directly-from-Rust.patch";
url = "https://github.com/chromium/chromium/commit/73eef8797a8138f5c26f52a1372644b20613f5ee.patch";
hash = "sha256-IcSjPv21xT+l9BwJuzeW2AfwBdKI0dQb3nskk6yeKHU=";
})
# https://chromium-review.googlesource.com/c/chromium/src/+/6439711
(fetchpatch {
name = "Roll-rust.patch";
url = "https://github.com/chromium/chromium/commit/a6c30520486be844735dc646cd5b9b434afa0c6b.patch";
includes = [ "build/rust/allocator/*" ];
hash = "sha256-MFdR75oSAdFW6telEZt/s0qdUvq/BiYFEHW0vk+RgDk=";
})
# https://chromium-review.googlesource.com/c/chromium/src/+/6456604
(fetchpatch {
name = "Drop-remap_alloc-dep.patch";
url = "https://github.com/chromium/chromium/commit/87d5ad2f621e0d5c81849dde24f3a5347efcb167.patch";
hash = "sha256-bEoR6jxEyw6Fzm4Zv4US54Cxa0li/0UTZTU2WUf0Rgo=";
})
# https://chromium-review.googlesource.com/c/chromium/src/+/6454872
(fetchpatch {
name = "rust-Clean-up-build-rust-allocator-after-a-Rust-tool.patch";
url = "https://github.com/chromium/chromium/commit/5c74fcf6fd14491f33dd820022a9ca045f492f68.patch";
hash = "sha256-vcD0Zfo4Io/FVpupWOdgurFEqwFCv+oDOtSmHbm+ons=";
})
]
# Fix building with gperf 3.2+
# https://issues.chromium.org/issues/40209959
++ lib.optionals (lib.versionOlder info.version "37") [
# https://chromium-review.googlesource.com/c/chromium/src/+/6445471
(fetchpatch {
name = "Dont-apply-FALLTHROUGH-edit-to-gperf-3-2-output.patch";
url = "https://github.com/chromium/chromium/commit/f8f21fb4aa01f75acbb12abf5ea8c263c6817141.patch";
hash = "sha256-z/aQ1oQjFZnkUeRnrD6P/WDZiYAI1ncGhOUM+HmjMZA=";
})
];
npmRoot = "third_party/node";
+2 -2
View File
@@ -8,13 +8,13 @@
postgresqlBuildExtension (finalAttrs: {
pname = "pg_net";
version = "0.14.0";
version = "0.15.1";
src = fetchFromGitHub {
owner = "supabase";
repo = "pg_net";
tag = "v${finalAttrs.version}";
hash = "sha256-c1pxhTyrE5j6dY+M5eKAboQNofIORS+Dccz+7HKEKQI=";
hash = "sha256-BhLZdoMeK6QkmEEn3/+G6+TElFea2uifaQBW5aftqpM=";
};
buildInputs = [ curl ];
+1
View File
@@ -786,6 +786,7 @@ mapAliases {
glfw-wayland-minecraft = glfw3-minecraft; # Added 2024-05-08
glxinfo = mesa-demos; # Added 2024-07-04
gmailieer = throw "'gmailieer' has been renamed to/replaced by 'lieer'"; # Converted to throw 2024-10-17
gmnisrv = throw "'gmnisrv' has been removed due to lack of maintenance upstream"; # Added 2025-06-07
gmp4 = throw "'gmp4' is end-of-life, consider using 'gmp' instead"; # Added 2024-12-24
gnatboot11 = gnat-bootstrap11;
gnatboot12 = gnat-bootstrap12;
+1
View File
@@ -11267,6 +11267,7 @@ with pkgs;
inherit lib config;
fetchurl = import ../build-support/fetchurl/boot.nix {
inherit (stdenv.buildPlatform) system;
inherit (config) rewriteURL;
};
checkMeta = callPackage ../stdenv/generic/check-meta.nix { inherit (stdenv) hostPlatform; };
}