Bug 1796518 - Tweak lld flags for faster linkage on developer builds. r=firefox-build-system-reviewers,nalexander

Differential Revision: https://phabricator.services.mozilla.com/D159832
This commit is contained in:
Mike Hommey 2022-10-25 22:58:25 +00:00
parent 76d708ae32
commit 402fce07b9
3 changed files with 26 additions and 13 deletions

View file

@ -1673,10 +1673,17 @@ set_config("LINKER_KIND", select_linker.KIND)
target_multiarch_dir,
android_platform,
c_compiler,
developer_options,
)
@imports("os")
def linker_ldflags(
linker, target, sysroot, multiarch_dir, android_platform, c_compiler
linker,
target,
sysroot,
multiarch_dir,
android_platform,
c_compiler,
developer_options,
):
flags = list((linker and linker.LINKER_FLAG) or [])
# rpath-link is irrelevant to wasm, see for more info https://github.com/emscripten-core/emscripten/issues/11076.
@ -1701,6 +1708,8 @@ def linker_ldflags(
flags.append("-Wl,--rpath-link={}/usr/lib".format(android_platform))
flags.append("--sysroot")
flags.append(android_platform)
if developer_options and linker.KIND == "lld" and target.kernel != "WINNT":
flags.append("-Wl,-O0")
return flags

View file

@ -255,12 +255,14 @@ if test "$GNU_CC"; then
AC_MSG_RESULT([no])
LDFLAGS=$_SAVE_LDFLAGS)
AC_MSG_CHECKING([for --build-id=sha1 option to ld])
_SAVE_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no])
LDFLAGS=$_SAVE_LDFLAGS)
if test -z "$DEVELOPER_OPTIONS" -o "$OS_TARGET" = "Android"; then
AC_MSG_CHECKING([for --build-id=sha1 option to ld])
_SAVE_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no])
LDFLAGS=$_SAVE_LDFLAGS)
fi
_DEFINES_CFLAGS="-include $jsconfdefs -DMOZILLA_CLIENT"
fi

View file

@ -269,12 +269,14 @@ if test "$GNU_CC"; then
AC_MSG_RESULT([no])
LDFLAGS=$_SAVE_LDFLAGS)
AC_MSG_CHECKING([for --build-id=sha1 option to ld])
_SAVE_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no])
LDFLAGS=$_SAVE_LDFLAGS)
if test -z "$DEVELOPER_OPTIONS" -o "$OS_TARGET" = "Android"; then
AC_MSG_CHECKING([for --build-id=sha1 option to ld])
_SAVE_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no])
LDFLAGS=$_SAVE_LDFLAGS)
fi
AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=