Files
sdk/build/config/gcc/BUILD.gn
Ryan Macnak feab749acb [build] Make the build more reproducible.
On Mac and Linux, the makes the output of non-RBE, RBE local and RBE remote builds identical, and also independent of the build directories path.  On Windows, non-RBE and RBE builds still disagree because paths are rewritten from \ to / to run on the Linux workers.

Bug: b/316893839
Change-Id: I5935785489c73445e4c6ca275020e6cf7464433d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506281
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-05-26 15:35:21 -07:00

79 lines
2.7 KiB
Plaintext

# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/toolchain/rbe.gni")
# This config causes functions not to be automatically exported from shared
# libraries. By default, all symbols are exported but this means there are
# lots of exports that slow everything down. In general we explicitly mark
# which function we want to export from components.
#
# Some third_party code assumes all functions are exported so this is separated
# into its own config so such libraries can remove this config to make symbols
# public again.
#
# See http://gcc.gnu.org/wiki/Visibility
config("symbol_visibility_hidden") {
# Note that -fvisibility-inlines-hidden is set globally in the compiler
# config since that can almost always be applied.
cflags = [ "-fvisibility=hidden" ]
}
# Settings for executables and shared libraries.
config("executable_ldconfig") {
if (is_android) {
ldflags = [
"-Bdynamic",
"-Wl,-z,nocopyreloc",
]
} else {
# Android doesn't support rpath.
ldflags = [
# Want to pass "\$". GN will re-escape as required for ninja.
"-Wl,-rpath=\$ORIGIN/",
"-Wl,-rpath-link=",
"-Wl,-z,origin",
# Newer binutils don't set DT_RPATH unless you disable "new" dtags
# and the new DT_RUNPATH doesn't work without --no-as-needed flag.
"-Wl,--disable-new-dtags",
]
}
}
config("no_exceptions") {
no_exceptions_flags = [ "-fno-exceptions" ]
cflags_cc = no_exceptions_flags
cflags_objcc = no_exceptions_flags
}
config("relative_paths") {
cflags = [
# This makes sure that include directories in the toolchain are
# represented as relative to the build directory (because that's how
# we invoke the compiler), rather than absolute. This can affect
# __FILE__ expansions (e.g. assertions in system headers). We
# normally run a compiler that's someplace within the source tree
# (//buildtools/...), so its absolute installation path will have a
# prefix matching absolute_path and hence be mapped to relative_path
# in the debugging information, so this should actually be
# superfluous for purposes of the debugging information.
"-no-canonical-prefixes",
]
ldflags = [ "-no-canonical-prefixes" ]
# Remove absolute paths from the debug information.
if (is_clang) {
cflags += [ "-ffile-compilation-dir=." ]
asmflags = [ "-Wa,-fdebug-compilation-dir,." ]
} else {
absolute_path = rebase_path("//")
relative_path = rebase_path("//", root_build_dir)
cflags += [ "-fdebug-prefix-map=$absolute_path=$relative_path" ]
}
if (is_mac) {
ldflags += [ "-Wl,-oso_prefix,." ]
}
}