mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-04-22 14:12:25 +02:00
182 lines
6.0 KiB
Diff
182 lines
6.0 KiB
Diff
re: removing safe - hardened is enabled somewhere, and it can't be both.
|
|
--- ./build_overrides/build.gni.orig
|
|
+++ ./build_overrides/build.gni
|
|
@@ -24,7 +24,7 @@
|
|
#
|
|
# Note that setting this to true only has an effect when also building with
|
|
# `use_custom_libcxx = true`.
|
|
-enable_safe_libcxx = true
|
|
+enable_safe_libcxx = false
|
|
|
|
# Features used by //base/trace_event and //services/tracing.
|
|
declare_args() {
|
|
--- ./build/config/compiler/compiler.gni.orig
|
|
+++ ./build/config/compiler/compiler.gni
|
|
@@ -37,6 +37,9 @@
|
|
# The default linker everywhere else.
|
|
use_lld = is_clang && current_os != "zos"
|
|
|
|
+ # enable together with use_lld
|
|
+ use_mold = false
|
|
+
|
|
# If true, optimize for size.
|
|
# Default to favoring speed over size for platforms not listed below.
|
|
optimize_for_size = !is_high_end_android && (is_android || is_castos)
|
|
--- ./build/config/compiler/pgo/BUILD.gn.orig
|
|
+++ ./build/config/compiler/pgo/BUILD.gn
|
|
@@ -139,6 +139,7 @@
|
|
|
|
# Enable basic block layout based on the extended TSP problem. This aims to
|
|
# improve icache utilization and reduce the binary size.
|
|
+ if (!use_mold) {
|
|
if (use_thin_lto) {
|
|
if (is_win) {
|
|
ldflags = [ "-mllvm:-enable-ext-tsp-block-placement=1" ]
|
|
@@ -150,6 +151,7 @@
|
|
"-mllvm",
|
|
"-enable-ext-tsp-block-placement=1",
|
|
]
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
--- ./build/config/compiler/BUILD.gn.orig
|
|
+++ ./build/config/compiler/BUILD.gn
|
|
@@ -390,7 +390,9 @@
|
|
}
|
|
}
|
|
|
|
- if (use_lld) {
|
|
+ if (use_mold) {
|
|
+ ldflags += [ "-fuse-ld=mold" ]
|
|
+ } else if (use_lld) {
|
|
ldflags += [ "-fuse-ld=lld" ]
|
|
if (lld_path != "") {
|
|
ldflags += [ "-B$lld_path" ]
|
|
@@ -608,7 +610,7 @@
|
|
"-mllvm",
|
|
"-instcombine-lower-dbg-declare=0",
|
|
]
|
|
- if (!is_debug && use_thin_lto && is_a_target_toolchain) {
|
|
+ if (!is_debug && use_thin_lto && is_a_target_toolchain && !use_mold) {
|
|
if (is_win) {
|
|
ldflags += [ "-mllvm:-instcombine-lower-dbg-declare=0" ]
|
|
} else {
|
|
@@ -616,24 +618,6 @@
|
|
}
|
|
}
|
|
|
|
- # TODO(crbug.com/1488374): This causes binary size growth and potentially
|
|
- # other problems.
|
|
- # TODO(crbug.com/1491036): This isn't supported by Cronet's mainline llvm version.
|
|
- if (default_toolchain != "//build/toolchain/cros:target" &&
|
|
- !llvm_android_mainline) {
|
|
- cflags += [
|
|
- "-mllvm",
|
|
- "-split-threshold-for-reg-with-hint=0",
|
|
- ]
|
|
- if (use_thin_lto && is_a_target_toolchain) {
|
|
- if (is_win) {
|
|
- ldflags += [ "-mllvm:-split-threshold-for-reg-with-hint=0" ]
|
|
- } else {
|
|
- ldflags += [ "-Wl,-mllvm,-split-threshold-for-reg-with-hint=0" ]
|
|
- }
|
|
- }
|
|
- }
|
|
-
|
|
# TODO(crbug.com/1235145): Investigate why/if this should be needed.
|
|
if (is_win) {
|
|
cflags += [ "/clang:-ffp-contract=off" ]
|
|
@@ -763,6 +747,7 @@
|
|
# TODO(gbiv): We ideally shouldn't need to specify this; ThinLTO
|
|
# should be able to better manage binary size increases on its own.
|
|
import_instr_limit = 30
|
|
+ not_needed([ "import_instr_limit" ])
|
|
|
|
if (is_win) {
|
|
ldflags += [
|
|
@@ -795,12 +780,14 @@
|
|
import_instr_limit = 5
|
|
}
|
|
|
|
+ if (!use_mold) {
|
|
ldflags += [ "-Wl,-mllvm,-import-instr-limit=$import_instr_limit" ]
|
|
+ }
|
|
|
|
if (is_apple) {
|
|
ldflags += [ "-Wcrl,object_path_lto" ]
|
|
}
|
|
- if (!is_chromeos) {
|
|
+ if (!is_chromeos && !use_mold) {
|
|
# TODO(https://crbug.com/972449): turn on for ChromeOS when that
|
|
# toolchain has this flag.
|
|
# We only use one version of LLVM within a build so there's no need to
|
|
@@ -927,7 +914,7 @@
|
|
assert(
|
|
is_android && host_os == "linux",
|
|
"MLGO is currently only supported for targeting Android on a linux host")
|
|
- if (use_thin_lto) {
|
|
+ if (use_thin_lto && !use_mold) {
|
|
ldflags += [ "-Wl,-mllvm,-enable-ml-inliner=release" ]
|
|
}
|
|
}
|
|
@@ -1011,17 +998,6 @@
|
|
# `-nodefaultlibs` from the linker invocation from Rust, which would be used
|
|
# to compile dylibs on Android, such as for constructing unit test APKs.
|
|
"-Cdefault-linker-libraries",
|
|
-
|
|
- # To make Rust .d files compatible with ninja
|
|
- "-Zdep-info-omit-d-target",
|
|
-
|
|
- # If a macro panics during compilation, show which macro and where it is
|
|
- # defined.
|
|
- "-Zmacro-backtrace",
|
|
-
|
|
- # For deterministic builds, keep the local machine's current working
|
|
- # directory from appearing in build outputs.
|
|
- "-Zremap-cwd-prefix=.",
|
|
]
|
|
|
|
if (!is_win || force_rustc_color_output) {
|
|
@@ -1175,8 +1151,8 @@
|
|
} else if (current_cpu == "arm") {
|
|
if (is_clang && !is_android && !is_nacl &&
|
|
!(is_chromeos_lacros && is_chromeos_device)) {
|
|
- cflags += [ "--target=arm-linux-gnueabihf" ]
|
|
- ldflags += [ "--target=arm-linux-gnueabihf" ]
|
|
+ cflags += [ "--target=armv7-alpine-linux-musleabihf" ]
|
|
+ ldflags += [ "--target=armv7-alpine-linux-musleabihf" ]
|
|
}
|
|
if (!is_nacl) {
|
|
cflags += [
|
|
@@ -1190,8 +1166,8 @@
|
|
} else if (current_cpu == "arm64") {
|
|
if (is_clang && !is_android && !is_nacl && !is_fuchsia &&
|
|
!(is_chromeos_lacros && is_chromeos_device)) {
|
|
- cflags += [ "--target=aarch64-linux-gnu" ]
|
|
- ldflags += [ "--target=aarch64-linux-gnu" ]
|
|
+ cflags += [ "--target=aarch64-alpine-linux-musl" ]
|
|
+ ldflags += [ "--target=aarch64-alpine-linux-musl" ]
|
|
}
|
|
} else if (current_cpu == "mipsel" && !is_nacl) {
|
|
ldflags += [ "-Wl,--hash-style=sysv" ]
|
|
@@ -1478,7 +1454,9 @@
|
|
# This can be removed once https://bugs.llvm.org/show_bug.cgi?id=40348
|
|
# has been resolved, and -mno-outline is obeyed by the linker during
|
|
# ThinLTO.
|
|
+ if (!use_mold) {
|
|
ldflags += [ "-Wl,-mllvm,-enable-machine-outliner=never" ]
|
|
+ }
|
|
}
|
|
|
|
asmflags = cflags
|
|
@@ -2391,7 +2369,7 @@
|
|
if (is_clang) {
|
|
cflags = [ "-Oz" ] + common_optimize_on_cflags
|
|
|
|
- if (use_ml_inliner && is_a_target_toolchain) {
|
|
+ if (use_ml_inliner && is_a_target_toolchain && !use_mold) {
|
|
cflags += [
|
|
"-mllvm",
|
|
"-enable-ml-inliner=release",
|