aboutsummaryrefslogtreecommitdiffstats
path: root/devel/electron34/files/patch-build_rust_std_BUILD.gn
blob: a832cbab6e35690e8bd904129e54c62bc484cec1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
--- build/rust/std/BUILD.gn.orig	2025-02-24 19:59:26 UTC
+++ build/rust/std/BUILD.gn
@@ -22,29 +22,6 @@ if (toolchain_has_rust) {
 import("//build/config/sanitizers/sanitizers.gni")
 
 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 = [ "//base/allocator/partition_allocator:buildflags" ]
-    if (use_partition_alloc_as_malloc) {
-      public_deps += [ "//base/allocator/partition_allocator:partition_alloc" ]
-    }
-    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
@@ -66,7 +43,6 @@ if (toolchain_has_rust) {
     "rustc_demangle",
     "std_detect",
     "test",
-    "unicode_width",
     "unwind",
   ]
 
@@ -74,13 +50,20 @@ if (toolchain_has_rust) {
     # These are no longer present in the Windows toolchain.
     stdlib_files += [
       "addr2line",
-      "adler",
       "gimli",
       "libc",
       "memchr",
       "miniz_oxide",
       "object",
     ]
+
+    rust_revision_pieces = string_split(rustc_revision, " ")
+    rust_version_pieces = string_split(rust_revision_pieces[1], ".")
+    if (rust_version_pieces[1] == "85") {
+      stdlib_files += [ "adler" ]
+    } else {
+      stdlib_files += [ "adler2" ]
+    }
   }
 
   if (toolchain_for_rust_host_build_tools) {
@@ -100,7 +83,6 @@ if (toolchain_has_rust) {
   # don't need to pass to the C++ linker because they're used for specialized
   # purposes.
   skip_stdlib_files = [
-    "profiler_builtins",
     "rustc_std_workspace_alloc",
     "rustc_std_workspace_core",
     "rustc_std_workspace_std",
@@ -254,8 +236,6 @@ if (toolchain_has_rust) {
       foreach(libname, stdlib_files + skip_stdlib_files) {
         deps += [ "rules:$libname" ]
       }
-
-      public_deps = [ ":remap_alloc" ]
     }
   } else {
     action("find_stdlib") {
@@ -381,12 +361,6 @@ if (toolchain_has_rust) {
         ":stdlib_public_dependent_libs",
       ]
       deps = [ ":prebuilt_rustc_copy_to_sysroot" ]
-
-      # The host builds tools toolchain supports Rust only and does not use
-      # the allocator remapping to point it to PartitionAlloc.
-      if (!toolchain_for_rust_host_build_tools) {
-        deps += [ ":remap_alloc" ]
-      }
     }
   }
 }