Skip to content
File

Blob: patches/v8/0004-Disable-bazel-whole-archive-build.patch

1.1 KB
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Felix Hanau <felix@cloudflare.com>
3Date: Tue, 11 Apr 2023 14:41:31 -0400
4Subject: Disable bazel whole-archive build
5 
6V8's bazel configuration system adds the alwayslink parameter (equivalent
7to --Wl,-whole-archive on Linux) to all V8 libraries, causing all V8
8object files to be included even if they are not referenced. This is more
9aggressive than what's done in the GN build system and not needed for
10workerd - disabling alwayslink improves the binary size by ~ 1MB as it
11allows the linker to eliminate unused symbols.
12 
13Signed-off-by: James M Snell <jsnell@cloudflare.com>
14 
15diff --git a/bazel/BUILD.icu b/bazel/BUILD.icu
16index 5fda2f468492a7a69266dba40c0862b0e31fa7a1..5127ceb7b783b11d5750c01977d7e34606c39667 100644
17--- a/bazel/BUILD.icu
18+++ b/bazel/BUILD.icu
19@@ -54,7 +54,7 @@ cc_library(
20 "U_ICUDATAENTRY_IN_COMMON",
21 ],
22 tags = ["requires-rtti"],
23- alwayslink = 1,
24+ alwayslink = 0,
25 )
26
27 cc_library(
28@@ -78,7 +78,7 @@ cc_library(
29 "U_I18N_IMPLEMENTATION",
30 ],
31 deps = [":icuuc"],
32- alwayslink = 1,
33+ alwayslink = 0,
34 )
35
36 cc_library(