зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1467337 - Don't allow --enable-stdcxx-compat when the linker is gold. r=nalexander
Differential Revision: https://phabricator.services.mozilla.com/D197352
This commit is contained in:
Родитель
c69d570cbb
Коммит
0398dcfb24
|
@ -1641,6 +1641,31 @@ def cxx_is_icecream(info, ccache_prefix):
|
|||
set_config("CXX_IS_ICECREAM", cxx_is_icecream)
|
||||
|
||||
|
||||
# Libstdc++ compatibility hacks
|
||||
# ==============================================================
|
||||
#
|
||||
@depends(target, host)
|
||||
def target_or_host_is_linux(target, host):
|
||||
return any(t.os == "GNU" and t.kernel == "Linux" for t in (target, host))
|
||||
|
||||
|
||||
option(
|
||||
"--enable-stdcxx-compat",
|
||||
env="MOZ_STDCXX_COMPAT",
|
||||
help="Enable compatibility with older libstdc++",
|
||||
when=target_or_host_is_linux,
|
||||
)
|
||||
|
||||
|
||||
@depends("--enable-stdcxx-compat", when=target_or_host_is_linux)
|
||||
def stdcxx_compat(value):
|
||||
if value:
|
||||
return True
|
||||
|
||||
|
||||
set_config("MOZ_STDCXX_COMPAT", True, when=stdcxx_compat)
|
||||
|
||||
|
||||
# Linker detection
|
||||
# ==============================================================
|
||||
# The policy is as follows:
|
||||
|
@ -1703,6 +1728,7 @@ def select_linker_tmpl(host_or_target):
|
|||
developer_options,
|
||||
extra_toolchain_flags,
|
||||
target,
|
||||
stdcxx_compat,
|
||||
when=is_linker_option_enabled,
|
||||
)
|
||||
host_or_target_str = "target"
|
||||
|
@ -1713,6 +1739,7 @@ def select_linker_tmpl(host_or_target):
|
|||
developer_options,
|
||||
dependable(None),
|
||||
host,
|
||||
stdcxx_compat,
|
||||
when=is_not_winnt_or_sunos(host_or_target),
|
||||
)
|
||||
host_or_target_str = "host"
|
||||
|
@ -1721,7 +1748,9 @@ def select_linker_tmpl(host_or_target):
|
|||
@checking(f"for {host_or_target_str} linker", lambda x: x.KIND)
|
||||
@imports("os")
|
||||
@imports("shutil")
|
||||
def select_linker(linker, c_compiler, developer_options, toolchain_flags, target):
|
||||
def select_linker(
|
||||
linker, c_compiler, developer_options, toolchain_flags, target, stdcxx_compat
|
||||
):
|
||||
if linker:
|
||||
linker = linker[0]
|
||||
else:
|
||||
|
@ -1827,7 +1856,7 @@ def select_linker_tmpl(host_or_target):
|
|||
):
|
||||
result = try_linker("lld")
|
||||
|
||||
if result is None and developer_options:
|
||||
if result is None and developer_options and not stdcxx_compat:
|
||||
result = try_linker("gold")
|
||||
|
||||
if result is None:
|
||||
|
@ -1836,6 +1865,9 @@ def select_linker_tmpl(host_or_target):
|
|||
if result is None:
|
||||
die("Failed to find an adequate linker")
|
||||
|
||||
if stdcxx_compat and result.KIND == "gold":
|
||||
die("--enable-stdcxx-compat is not compatible with the gold linker")
|
||||
|
||||
# If an explicit linker was given, error out if what we found is different.
|
||||
if linker and not linker.startswith(result.KIND):
|
||||
die("Could not use {} as linker".format(linker))
|
||||
|
@ -2797,30 +2829,8 @@ add_old_configure_assignment(
|
|||
"ENABLE_MOZSEARCH_PLUGIN", depends_if("--enable-mozsearch-plugin")(lambda _: True)
|
||||
)
|
||||
|
||||
|
||||
# Libstdc++ compatibility hacks
|
||||
# Use the old libstdc++ ABI
|
||||
# ==============================================================
|
||||
#
|
||||
@depends(target, host)
|
||||
def target_or_host_is_linux(target, host):
|
||||
return any(t.os == "GNU" and t.kernel == "Linux" for t in (target, host))
|
||||
|
||||
|
||||
option(
|
||||
"--enable-stdcxx-compat",
|
||||
env="MOZ_STDCXX_COMPAT",
|
||||
help="Enable compatibility with older libstdc++",
|
||||
when=target_or_host_is_linux,
|
||||
)
|
||||
|
||||
|
||||
@depends("--enable-stdcxx-compat", when=target_or_host_is_linux)
|
||||
def stdcxx_compat(value):
|
||||
if value:
|
||||
return True
|
||||
|
||||
|
||||
set_config("MOZ_STDCXX_COMPAT", True, when=stdcxx_compat)
|
||||
add_flag(
|
||||
"-D_GLIBCXX_USE_CXX11_ABI=0",
|
||||
cxx_compiler,
|
||||
|
|
Загрузка…
Ссылка в новой задаче