Backed out 2 changesets (bug 1854047, bug 1839739) for causing build bustages. CLOSED TREE

Backed out changeset 3fb508020251 (bug 1854047)
Backed out changeset 056fe66a8b3f (bug 1839739)
This commit is contained in:
Cosmin Sabou 2023-10-04 03:34:26 +03:00
parent 81844e5e9b
commit c8c7e83a77
23 changed files with 113 additions and 61 deletions

View File

@ -10,6 +10,9 @@ export MOZ_PACKAGE_JSSHELL=1
ac_add_options --enable-fuzzing
unset MOZ_STDCXX_COMPAT
# gold or lld is required for libFuzzer to work properly
ac_add_options --enable-linker=lld
# Even in fuzzing builds without sanitizers, the UBSan runtime is pulled
# in as a dependency to allow libFuzzer to have rudimentary stacks.
# Hence we need to disable jemalloc until bug 1435148 is fully resolved.

View File

@ -15,6 +15,9 @@ ac_add_options --enable-valgrind
ac_add_options --enable-fuzzing
unset MOZ_STDCXX_COMPAT
# gold or lld is required for libFuzzer to work properly
ac_add_options --enable-linker=lld
# Piggybacking UBSan for now since only a small subset of checks are enabled.
# A new build can be created when appropriate.
ac_add_options --enable-undefined-sanitizer

View File

@ -19,6 +19,9 @@ export CFLAGS="$CFLAGS --coverage"
export CXXFLAGS="$CXXFLAGS --coverage"
export LDFLAGS="$LDFLAGS --coverage -Wl,--compress-debug-sections=zlib"
# gold or lld is required for libFuzzer to work properly
ac_add_options --enable-linker=lld
ac_add_options --enable-fuzzing
unset MOZ_STDCXX_COMPAT

View File

@ -8,6 +8,8 @@ ac_add_options --enable-valgrind
. $topsrcdir/build/unix/mozconfig.asan
ac_add_options --enable-linker=lld
# Build with fuzzing support, so this build can also be used
# to analyze fuzzing bugs with rr.
ac_add_options --enable-fuzzing

View File

@ -10,6 +10,9 @@ export MOZ_PACKAGE_JSSHELL=1
ac_add_options --enable-fuzzing
unset MOZ_STDCXX_COMPAT
# gold or lld is required for libFuzzer to work properly
ac_add_options --enable-linker=lld
# Even in fuzzing builds without sanitizers, the UBSan runtime is pulled
# in as a dependency to allow libFuzzer to have rudimentary stacks.
# Hence we need to disable jemalloc until bug 1435148 is fully resolved.

View File

@ -8,6 +8,7 @@ export LLVM_SYMBOLIZER="$MOZ_FETCHES_DIR/llvm-symbolizer/bin/llvm-symbolizer"
export MOZ_PACKAGE_JSSHELL=1
ac_add_options --enable-fuzzing
ac_add_options --enable-linker=lld
unset MOZ_STDCXX_COMPAT
# Even in fuzzing builds without sanitizers, the UBSan runtime is pulled

View File

@ -14,3 +14,6 @@ ac_add_options --enable-fuzzing
# on libFuzzer to provide stacks both in the browser fuzzing case as
# well as for libFuzzer targets. See also bug 1649062.
ac_add_options --disable-crashreporter
# gold or lld is required for libFuzzer to work properly
ac_add_options --enable-linker=lld

View File

@ -7,6 +7,8 @@ ac_add_options --enable-valgrind
. $topsrcdir/build/unix/mozconfig.asan
ac_add_options --enable-linker=lld
# Enable ASan for rust code. This is done for specific build tasks rather than
# globally in mozconfig.asan because it requires an unstable -Z flag.
export RUSTFLAGS="$RUSTFLAGS -Zsanitizer=address"

View File

@ -14,6 +14,9 @@ ac_add_options --enable-valgrind
# globally in mozconfig.asan because it requires an unstable -Z flag.
export RUSTFLAGS="$RUSTFLAGS -Zsanitizer=address"
# gold or lld is required for libFuzzer to work properly
ac_add_options --enable-linker=lld
ac_add_options --enable-fuzzing
unset MOZ_STDCXX_COMPAT

View File

@ -14,6 +14,9 @@ ac_add_options --enable-valgrind
# globally in mozconfig.asan because it requires an unstable -Z flag.
export RUSTFLAGS="$RUSTFLAGS -Zsanitizer=address"
# gold or lld is required for libFuzzer to work properly
ac_add_options --enable-linker=lld
ac_add_options --enable-fuzzing
unset MOZ_STDCXX_COMPAT

View File

@ -20,6 +20,9 @@ ac_add_options --enable-valgrind
# globally in mozconfig.asan because it requires an unstable -Z flag.
export RUSTFLAGS="$RUSTFLAGS -Zsanitizer=address"
# gold or lld is required for libFuzzer to work properly
ac_add_options --enable-linker=lld
ac_add_options --enable-snapshot-fuzzing
unset MOZ_STDCXX_COMPAT

View File

@ -1,4 +1,7 @@
. "$topsrcdir/browser/config/mozconfigs/linux64/tsan"
# gold or lld is required for libFuzzer to work properly
ac_add_options --enable-linker=lld
ac_add_options --enable-fuzzing
unset MOZ_STDCXX_COMPAT

View File

@ -2,6 +2,9 @@
ac_add_options --enable-fuzzing
# gold or lld is required for libFuzzer to work properly
ac_add_options --enable-linker=lld
# Need this to prevent name conflicts with the normal nightly build packages
export MOZ_PKG_SPECIAL=fuzzing

View File

@ -2,6 +2,9 @@
ac_add_options --enable-fuzzing
# gold or lld is required for libFuzzer to work properly
ac_add_options --enable-linker=lld
# Piggybacking UBSan for now since only a small subset of checks are enabled.
# A new build can be created when appropriate.
ac_add_options --enable-undefined-sanitizer

View File

@ -1643,10 +1643,15 @@ set_config("CXX_IS_ICECREAM", cxx_is_icecream)
# - otherwise the linker is ld64, either from XCode on macOS, or from cctools-ports when
# cross-compiling.
# For other OSes:
# - on local developer builds: lld if present and the compiler is clang. Otherwise gold
# is used if present otherwise, whatever the compiler uses by default.
# - on release/official builds: whatever the compiler uses by default, except when the
# compiler is clang, in which case lld is preferred when it's new enough.
# - on local developer builds: lld is used if present and the compiler is clang. Otherwise
# gold is used if present, otherwise, BFD ld is used.
# - on release/official builds: whatever the compiler uses by default, except on Android
# (see enable_linker_default below). Usually what the compiler uses by default is BFD
# ld, except with the Android NDK compiler, where the default varies depending on the
# NDK version. The default also varies by platform and clang version.
# lld is not used by default on Linux and Android because it introduces layout changes
# that prevent elfhack from working. See e.g.
# https://bugzilla.mozilla.org/show_bug.cgi?id=1563654#c2.
@template
def is_not_winnt_or_sunos(host_or_target):
@depends(host_or_target)
@ -1668,10 +1673,26 @@ def enable_gold(value):
die("--disable-gold is deprecated, use --enable-linker=something_else instead")
@depends(target, developer_options)
def enable_linker_default(target, developer_options):
# Recent versions of clang default to lld when targetting Android, but we don't
# want that as the default for non developer builds (see above).
# So we want to force the default to whatever it was with older versions of clang,
# but with caveats/workarounds:
# - x86-64 gold has bugs in how it lays out .note.* sections. See bug 1573820.
# - x86-32 gold has a bug when assembly files are built. See bug 1651699.
# That leaves us with aarch64 and armv7, which respectively defaulted to
# bfd and gold.
# On developer builds, select_linker will pick lld if it's not the default.
if target.os == "Android" and not developer_options:
return "bfd" if target.cpu in ("x86", "x86_64", "aarch64") else "gold"
option(
"--enable-linker",
nargs=1,
help="Select the linker {bfd, gold, ld64, lld, lld-*, mold}",
help="Select the linker {bfd, gold, ld64, lld, lld-*, mold}{|}",
default=enable_linker_default,
when=is_linker_option_enabled,
)
@ -1799,11 +1820,7 @@ def select_linker_tmpl(host_or_target):
and (
(
target.kernel != "Darwin"
and (
developer_options
or host_or_target_str == "host"
or c_compiler.version >= "15.0"
)
and (developer_options or host_or_target_str == "host")
)
or (
target.kernel == "Darwin"

View File

@ -13,3 +13,9 @@ x11)
esac
export MOZ_NO_PIE_COMPAT=1
if [ -z "$USE_ARTIFACT" -a -z "$TASKCLUSTER_PGO_PROFILE_USE" -a -z "$FORCE_GCC" ]; then
# Use LLD on most builds, for faster builds, but not on shippable ones because we
# want to keep elfhack there, which is incompatible.
ac_add_options --enable-linker=lld
fi

View File

@ -10,4 +10,7 @@ export MOZILLA_OFFICIAL=1
ac_add_options --with-branding=mobile/android/branding/nightly
# Workaround gold bug (see bug 1807993)
ac_add_options --enable-linker=lld
. "$topsrcdir/mobile/android/config/mozconfigs/common.override"

View File

@ -10,6 +10,9 @@ export MOZILLA_OFFICIAL=1
ac_add_options --with-branding=mobile/android/branding/nightly
# Workaround gold bug (see bug 1807993)
ac_add_options --enable-linker=lld
ac_add_options --enable-mozsearch-plugin
. "$topsrcdir/mobile/android/config/mozconfigs/common.override"

View File

@ -11,7 +11,6 @@ from test_toolchain_helpers import CompilerResult
from common import BaseConfigureTest
from mozbuild.configure.options import InvalidOptionError
from mozbuild.configure.util import Version
class TestToolkitMozConfigure(BaseConfigureTest):
@ -154,11 +153,7 @@ class TestToolkitMozConfigure(BaseConfigureTest):
# Trick the sandbox into not running too much
dep = sandbox._depends[sandbox["c_compiler"]]
value_for_depends[(dep,)] = CompilerResult(
compiler="/usr/bin/mockcc",
language="C",
type="clang",
version=Version("16.0"),
flags=[],
compiler="/usr/bin/mockcc", language="C", type="clang", flags=[]
)
dep = sandbox._depends[sandbox["readelf"]]
value_for_depends[(dep,)] = "/usr/bin/readelf"
@ -170,33 +165,11 @@ class TestToolkitMozConfigure(BaseConfigureTest):
)
PACK = ["-Wl,-z,pack-relative-relocs"]
# The typical case with a bootstrap build: linker supports pack-relative-relocs,
# but glibc is old and doesn't.
mockcc = MockCC(True, False)
readelf = ReadElf(True)
self.assertEqual(get_values(mockcc, readelf), ("lld", None, "relr"))
self.assertEqual(
get_values(mockcc, readelf, ["--enable-release"]), ("lld", None, "relr")
)
self.assertEqual(
get_values(mockcc, readelf, ["--enable-elf-hack"]), ("lld", None, "relr")
)
self.assertEqual(
get_values(mockcc, readelf, ["--enable-elf-hack=relr"]),
("lld", None, "relr"),
)
# LLD is picked by default and enabling elfhack fails because of that.
with self.assertRaises(SystemExit):
get_values(mockcc, readelf, ["--enable-elf-hack=legacy"])
# If we force to use BFD ld, it works.
self.assertEqual(
get_values(
mockcc, readelf, ["--enable-elf-hack=legacy", "--enable-linker=bfd"]
),
("bfd", None, "legacy"),
)
for mockcc, readelf in (
# The typical case with a bootstrap build: linker supports pack-relative-relocs,
# but glibc is old and doesn't. We won't use pack-relative-relocs, and will use
# elfhack on release builds, or when explicitly enabled.
(MockCC(True, False), ReadElf(True)),
# Linker doesn't support pack-relative-relocs. Glibc is old.
(MockCC(False, False), ReadElf(False)),
# Linker doesn't support pack-relative-relocs. Glibc is new.
@ -209,15 +182,23 @@ class TestToolkitMozConfigure(BaseConfigureTest):
self.assertEqual(get_values(mockcc, readelf), ("lld", None, None))
self.assertEqual(
get_values(mockcc, readelf, ["--enable-release"]),
("lld", None, None),
("bfd", None, "legacy"),
)
# LLD is picked by default and enabling elfhack fails because of that.
with self.assertRaises(SystemExit):
get_values(mockcc, readelf, ["--enable-elf-hack"])
with self.assertRaises(SystemExit):
get_values(mockcc, readelf, ["--enable-elf-hack=relr"])
# LLD is picked by default and enabling elfhack fails because of that.
with self.assertRaises(SystemExit):
get_values(mockcc, readelf, ["--enable-elf-hack=legacy"])
if readelf.with_relr:
# Explicitly enabling relrhack works because pack-relative-relocs are supported.
self.assertEqual(
get_values(mockcc, readelf, ["--enable-elf-hack=relr"]),
("lld", None, "relr"),
)
else:
# relrhack doesn't work without pack-relative-relocs support.
with self.assertRaises(SystemExit):
get_values(mockcc, readelf, ["--enable-elf-hack=relr"])
# If we force to use BFD ld, it works.
self.assertEqual(
get_values(
@ -238,23 +219,17 @@ class TestToolkitMozConfigure(BaseConfigureTest):
readelf = ReadElf(True)
self.assertEqual(get_values(mockcc, readelf), ("lld", PACK, None))
self.assertEqual(
get_values(mockcc, readelf, ["--enable-release"]), ("lld", PACK, None)
)
self.assertEqual(
get_values(mockcc, readelf, ["--enable-elf-hack"]),
("lld", None, "relr"),
)
self.assertEqual(
get_values(mockcc, readelf, ["--enable-elf-hack=relr"]),
("lld", None, "relr"),
get_values(mockcc, readelf, ["--enable-release"]), ("bfd", PACK, None)
)
# LLD is picked by default and enabling elfhack fails because of that.
with self.assertRaises(SystemExit):
get_values(mockcc, readelf, ["--enable-elf-hack"])
with self.assertRaises(SystemExit):
get_values(mockcc, readelf, ["--enable-elf-hack=legacy"])
# If we force to use BFD ld, it works.
self.assertEqual(
get_values(mockcc, readelf, ["--enable-elf-hack", "--enable-linker=bfd"]),
("bfd", None, "relr"),
("bfd", None, "legacy"),
)
self.assertEqual(
get_values(
@ -262,6 +237,11 @@ class TestToolkitMozConfigure(BaseConfigureTest):
),
("bfd", None, "legacy"),
)
# Explicitly enabling relrhack works because pack-relative-relocs are supported.
self.assertEqual(
get_values(mockcc, readelf, ["--enable-elf-hack=relr"]),
("lld", None, "relr"),
)
if __name__ == "__main__":

View File

@ -115,7 +115,6 @@ linux64-base-toolchains-clang/opt:
tooltool-downloads: public
fetches:
toolchain:
- linux64-binutils-2.31.1
- linux64-clang-base
- linux64-rust-base
- linux64-cbindgen
@ -154,7 +153,6 @@ linux64-base-toolchains-clang/debug:
tooltool-downloads: public
fetches:
toolchain:
- linux64-binutils-2.31.1
- linux64-clang-base
- linux64-rust-base
- linux64-cbindgen

View File

@ -10,6 +10,7 @@ cd $GECKO_PATH
export MOZ_OBJDIR=obj-injector
echo ac_add_options --enable-project=tools/crashreporter/injector > .mozconfig
echo ac_add_options --enable-linker=lld >> .mozconfig
INJECTOR=libbreakpadinjector.so

View File

@ -10,6 +10,7 @@ cd $GECKO_PATH
export MOZ_OBJDIR=obj-mar
echo ac_add_options --enable-project=tools/update-packaging > .mozconfig
echo ac_add_options --enable-linker=lld >> .mozconfig
TOOLCHAINS="clang"

View File

@ -1498,9 +1498,14 @@ with only_when("--enable-compile-environment"):
if enable and enable != ("relr",):
return enable
@depends("--enable-elf-hack", when=has_elfhack)
def may_enable_relrhack(enable):
if enable and enable != ("legacy",):
@depends("--enable-elf-hack", "MOZ_AUTOMATION", when=has_elfhack)
def may_enable_relrhack(enable, automation):
# For now, only enable relrhack when explicitly given with
# --enable-elf-hack=relr. On automation, we automatically
# enable it when possible.
if automation and enable and enable != ("legacy",):
return enable
if enable == ("relr",):
return enable
@depends(