forked from mirrors/gecko-dev
Bug 1802228 - Select a host linker in the same manner we do for the target linker. r=firefox-build-system-reviewers,ahochheiden
Differential Revision: https://phabricator.services.mozilla.com/D162912
This commit is contained in:
parent
29ab6a0f40
commit
b2cc8ec2c0
3 changed files with 215 additions and 171 deletions
|
|
@ -1545,7 +1545,10 @@ def enable_linker(linker):
|
|||
return linker
|
||||
|
||||
|
||||
@depends(
|
||||
@template
|
||||
def select_linker_tmpl(host_or_target):
|
||||
if host_or_target is target:
|
||||
deps = depends(
|
||||
"--enable-linker",
|
||||
c_compiler,
|
||||
developer_options,
|
||||
|
|
@ -1553,7 +1556,19 @@ def enable_linker(linker):
|
|||
target,
|
||||
when=is_linker_option_enabled,
|
||||
)
|
||||
@checking("for linker", lambda x: x.KIND)
|
||||
host_or_target_str = "target"
|
||||
else:
|
||||
deps = depends(
|
||||
dependable(None),
|
||||
host_c_compiler,
|
||||
developer_options,
|
||||
dependable(None),
|
||||
host,
|
||||
)
|
||||
host_or_target_str = "host"
|
||||
|
||||
@deps
|
||||
@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):
|
||||
|
|
@ -1673,11 +1688,17 @@ def select_linker(linker, c_compiler, developer_options, toolchain_flags, target
|
|||
|
||||
return result
|
||||
|
||||
return select_linker
|
||||
|
||||
|
||||
select_linker = select_linker_tmpl(target)
|
||||
set_config("LINKER_KIND", select_linker.KIND)
|
||||
|
||||
|
||||
@depends_if(
|
||||
@template
|
||||
def linker_ldflags_tmpl(host_or_target):
|
||||
if host_or_target is target:
|
||||
deps = depends_if(
|
||||
select_linker,
|
||||
target,
|
||||
target_sysroot,
|
||||
|
|
@ -1686,6 +1707,18 @@ set_config("LINKER_KIND", select_linker.KIND)
|
|||
c_compiler,
|
||||
developer_options,
|
||||
)
|
||||
else:
|
||||
deps = depends_if(
|
||||
select_linker_tmpl(host),
|
||||
host,
|
||||
host_sysroot,
|
||||
host_multiarch_dir,
|
||||
dependable(None),
|
||||
host_c_compiler,
|
||||
developer_options,
|
||||
)
|
||||
|
||||
@deps
|
||||
@imports("os")
|
||||
def linker_ldflags(
|
||||
linker,
|
||||
|
|
@ -1708,7 +1741,11 @@ def linker_ldflags(
|
|||
# GCC also needs -L.
|
||||
if c_compiler.type == "gcc":
|
||||
flags.append("-L%s" % multiarch_lib_dir)
|
||||
if c_compiler.type == "gcc" and sysroot.bootstrapped and sysroot.stdcxx_version:
|
||||
if (
|
||||
c_compiler.type == "gcc"
|
||||
and sysroot.bootstrapped
|
||||
and sysroot.stdcxx_version
|
||||
):
|
||||
flags.append(
|
||||
"-L{}/usr/lib/gcc/{}/{}".format(
|
||||
sysroot.path, multiarch_dir, sysroot.stdcxx_version
|
||||
|
|
@ -1728,9 +1765,14 @@ def linker_ldflags(
|
|||
flags.append("-Wl,-O0")
|
||||
return flags
|
||||
|
||||
return linker_ldflags
|
||||
|
||||
|
||||
linker_ldflags = linker_ldflags_tmpl(target)
|
||||
add_old_configure_assignment("LINKER_LDFLAGS", linker_ldflags)
|
||||
|
||||
add_old_configure_assignment("HOST_LINKER_LDFLAGS", linker_ldflags_tmpl(host))
|
||||
|
||||
|
||||
# There's a wrinkle with MinGW: linker configuration is not enabled, so
|
||||
# `select_linker` is never invoked. Hard-code around it.
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ USE_PTHREADS=
|
|||
_PTHREAD_LDFLAGS=""
|
||||
|
||||
LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
|
||||
HOST_LDFLAGS="$HOST_LDFLAGS $HOST_LINKER_LDFLAGS"
|
||||
|
||||
if test -z "$JS_STANDALONE"; then
|
||||
autoconfmk=autoconf-js.mk
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ MOZ_USE_PTHREADS=
|
|||
_PTHREAD_LDFLAGS=""
|
||||
|
||||
LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
|
||||
HOST_LDFLAGS="$HOST_LDFLAGS $HOST_LINKER_LDFLAGS"
|
||||
|
||||
if test "$COMPILE_ENVIRONMENT"; then
|
||||
MOZ_ANDROID_NDK
|
||||
|
|
|
|||
Loading…
Reference in a new issue