2017-09-12 13:21:18 -04:00
|
|
|
diff --git build/config/compiler/BUILD.gn build/config/compiler/BUILD.gn
|
2024-12-09 12:58:46 -05:00
|
|
|
index 9c9f616b2a4e1..448cc18a076ac 100644
|
2017-09-12 13:21:18 -04:00
|
|
|
--- build/config/compiler/BUILD.gn
|
|
|
|
+++ build/config/compiler/BUILD.gn
|
2024-12-09 12:58:46 -05:00
|
|
|
@@ -132,6 +132,9 @@ declare_args() {
|
2024-03-27 14:39:07 -04:00
|
|
|
# The cache can lead to non-determinism: https://crbug.com/1486045
|
|
|
|
thin_lto_enable_cache = true
|
|
|
|
|
|
|
|
+ # Whether to use thin archives in combination with lld.
|
|
|
|
+ use_thin_archives = use_lld
|
|
|
|
+
|
|
|
|
# Initialize all local variables with a pattern. This flag will fill
|
|
|
|
# uninitialized floating-point types (and 32-bit pointers) with 0xFF and the
|
|
|
|
# rest with 0xAA. This makes behavior of uninitialized memory bugs consistent,
|
2024-12-09 12:58:46 -05:00
|
|
|
@@ -2303,6 +2306,7 @@ config("export_dynamic") {
|
2024-11-14 17:07:03 -05:00
|
|
|
# 2. Remove the thin_archive config, so that the .a file actually contains all
|
|
|
|
# .o files, instead of just references to .o files in the build directoy
|
2024-03-27 14:39:07 -04:00
|
|
|
config("thin_archive") {
|
|
|
|
+ if (use_thin_archives) {
|
2024-11-14 17:07:03 -05:00
|
|
|
if ((is_apple && use_lld) || (is_linux && !is_clang)) {
|
|
|
|
# The macOS and iOS linker ld64.ldd doesn't support thin archive without
|
|
|
|
# symbol table, gcc on linux also throws the error `archive has no index`.
|
2024-12-09 12:58:46 -05:00
|
|
|
@@ -2320,6 +2324,7 @@ config("thin_archive") {
|
2024-03-27 14:39:07 -04:00
|
|
|
} else if (is_win && use_lld) {
|
|
|
|
arflags = [ "/llvmlibthin" ]
|
2019-01-17 10:56:52 +01:00
|
|
|
}
|
2024-03-27 14:39:07 -04:00
|
|
|
+ }
|
2019-01-17 10:56:52 +01:00
|
|
|
}
|
|
|
|
|
2024-03-27 14:39:07 -04:00
|
|
|
# exceptions -------------------------------------------------------------------
|