mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Bug 1880103 - Move dead_strip linker check to moz.configure r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D201724
This commit is contained in:
parent
c05e0c4124
commit
1142b832db
@ -436,6 +436,24 @@ def check_and_add_linker_flag(flag, compiler=None, when=None, check=True):
|
||||
)
|
||||
|
||||
|
||||
# Like the compilation checks above, but for linker optimization flags.
|
||||
@dependable
|
||||
def linker_optimize_flags():
|
||||
return namespace(ldflags=[])
|
||||
|
||||
|
||||
@template
|
||||
def check_and_add_linker_optimize_flag(flag, compiler=None, when=None, check=True):
|
||||
return check_and_add_flags(
|
||||
flag,
|
||||
linker_optimize_flags,
|
||||
[flag],
|
||||
when=when,
|
||||
check=check,
|
||||
mode="link",
|
||||
)
|
||||
|
||||
|
||||
# Add the given flag to the list of linker flags for the build.
|
||||
# - `flag` is the flag (e.g. -fno-sized-deallocation)
|
||||
# - `when` (optional) is a @depends function or option name conditioning
|
||||
|
@ -177,6 +177,8 @@ check_and_add_linker_flag("-Wl,-z,relro", when=is_gnu_cc)
|
||||
check_and_add_linker_flag("-Wl,-z,now", when=is_gnu_cc)
|
||||
check_and_add_linker_flag("-Wl,-z,nocopyreloc", when=is_gnu_cc)
|
||||
|
||||
check_and_add_linker_optimize_flag("-Wl,-dead_strip", when=target_is_darwin & ~dtrace)
|
||||
|
||||
|
||||
@depends("--enable-address-sanitizer", is_gnu_cc)
|
||||
def check_Bsymbolic(enable_asan, is_gnu_cc):
|
||||
@ -195,4 +197,7 @@ check_and_add_linker_flag("-Wl,-Bsymbolic", when=check_Bsymbolic)
|
||||
add_old_configure_assignment("_COMPILATION_ASFLAGS", asm_flags.asflags)
|
||||
add_old_configure_assignment("_COMPILATION_HOST_ASFLAGS", asm_flags.host_asflags)
|
||||
add_old_configure_assignment("_COMPILATION_LDFLAGS", linker_flags.ldflags)
|
||||
add_old_configure_assignment(
|
||||
"_COMPILATION_OPTIMIZE_LDFLAGS", linker_optimize_flags.ldflags
|
||||
)
|
||||
add_old_configure_assignment("_COMPILATION_HOST_LDFLAGS", linker_flags.host_ldflags)
|
||||
|
@ -3279,3 +3279,16 @@ set_config(
|
||||
flags=["-mavx512vnni", "-mavx512bw", "-mavx512f", "-mavx512dq", "-mavx512cd"],
|
||||
),
|
||||
)
|
||||
|
||||
# dtrace support
|
||||
##
|
||||
option("--enable-dtrace", help="Build with dtrace support")
|
||||
|
||||
dtrace = check_header(
|
||||
"sys/sdt.h",
|
||||
when="--enable-dtrace",
|
||||
onerror=lambda: die("dtrace enabled but sys/sdt.h not found"),
|
||||
)
|
||||
|
||||
set_config("HAVE_DTRACE", True, when=dtrace)
|
||||
set_define("INCLUDE_MOZILLA_DTRACE", True, when=dtrace)
|
||||
|
@ -250,30 +250,12 @@ dnl ========================================================
|
||||
dnl System overrides of the defaults for target
|
||||
dnl ========================================================
|
||||
|
||||
MOZ_OPTIMIZE_LDFLAGS="${_COMPILATION_OPTIMIZE_LDFLAGS} ${MOZ_OPTIMIZE_FLAGS}"
|
||||
|
||||
case "$target" in
|
||||
*-darwin*)
|
||||
MOZ_OPTIMIZE_FLAGS="-O3"
|
||||
DSO_LDOPTS=''
|
||||
|
||||
dnl DTrace and -dead_strip don't interact well. See bug 403132.
|
||||
dnl ===================================================================
|
||||
if test "x$enable_dtrace" = "xyes"; then
|
||||
echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
|
||||
else
|
||||
dnl check for the presence of the -dead_strip linker flag
|
||||
AC_MSG_CHECKING([for -dead_strip option to ld])
|
||||
_SAVE_LDFLAGS=$LDFLAGS
|
||||
LDFLAGS="$LDFLAGS -Wl,-dead_strip"
|
||||
AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
|
||||
if test -n "$_HAVE_DEAD_STRIP" ; then
|
||||
AC_MSG_RESULT([yes])
|
||||
MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
LDFLAGS=$_SAVE_LDFLAGS
|
||||
fi
|
||||
MOZ_FIX_LINK_PATHS=
|
||||
;;
|
||||
|
||||
|
@ -786,19 +786,6 @@ check_prog(
|
||||
paths=clang_search_path,
|
||||
)
|
||||
|
||||
option("--enable-dtrace", help="Build with dtrace support")
|
||||
|
||||
dtrace = check_header(
|
||||
"sys/sdt.h",
|
||||
when="--enable-dtrace",
|
||||
onerror=lambda: die("dtrace enabled but sys/sdt.h not found"),
|
||||
)
|
||||
|
||||
set_config("HAVE_DTRACE", True, when=dtrace)
|
||||
set_define("INCLUDE_MOZILLA_DTRACE", True, when=dtrace)
|
||||
add_old_configure_assignment("enable_dtrace", "yes", when=dtrace)
|
||||
|
||||
|
||||
option("--disable-icf", help="Disable Identical Code Folding")
|
||||
|
||||
add_old_configure_assignment(
|
||||
|
@ -277,31 +277,12 @@ dnl ========================================================
|
||||
dnl System overrides of the defaults for target
|
||||
dnl ========================================================
|
||||
|
||||
MOZ_OPTIMIZE_LDFLAGS="${_COMPILATION_OPTIMIZE_LDFLAGS} ${MOZ_OPTIMIZE_FLAGS}"
|
||||
|
||||
case "$target" in
|
||||
*-darwin*)
|
||||
MOZ_OPTIMIZE_FLAGS="-O3"
|
||||
DSO_LDOPTS=''
|
||||
|
||||
dnl DTrace and -dead_strip don't interact well. See bug 403132.
|
||||
dnl ===================================================================
|
||||
if test "x$enable_dtrace" = "xyes"; then
|
||||
echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
|
||||
else
|
||||
dnl check for the presence of the -dead_strip linker flag
|
||||
AC_MSG_CHECKING([for -dead_strip option to ld])
|
||||
_SAVE_LDFLAGS=$LDFLAGS
|
||||
LDFLAGS="$LDFLAGS -Wl,-dead_strip"
|
||||
AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
|
||||
if test -n "$_HAVE_DEAD_STRIP" ; then
|
||||
AC_MSG_RESULT([yes])
|
||||
MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
LDFLAGS=$_SAVE_LDFLAGS
|
||||
fi
|
||||
|
||||
MOZ_FIX_LINK_PATHS=
|
||||
;;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user