Bug 892355 - Force enable elfhack with --enable-elf-hack. r=ted

This commit is contained in:
Mike Hommey 2013-07-12 09:15:10 +09:00
parent 7e0a97a015
commit c050bd0356
6 changed files with 27 additions and 6 deletions

View File

@ -3,6 +3,7 @@
ac_add_options --enable-codesighs
ac_add_options --enable-signmar
ac_add_options --enable-profiling
ac_add_options --disable-elf-hack # --enable-elf-hack conflicts with --enable-profiling
# Nightlies only since this has a cost in performance
ac_add_options --enable-js-diagnostics

View File

@ -3,6 +3,7 @@
ac_add_options --enable-codesighs
ac_add_options --enable-signmar
ac_add_options --enable-profiling
ac_add_options --disable-elf-hack # --enable-elf-hack conflicts with --enable-profiling
# Nightlies only since this has a cost in performance
ac_add_options --enable-js-diagnostics

View File

@ -2,3 +2,5 @@
CC="/tools/gcc-4.7.2-0moz1/bin/gcc"
CXX="/tools/gcc-4.7.2-0moz1/bin/g++"
ac_add_options --enable-elf-hack

View File

@ -7566,13 +7566,16 @@ dnl ========================================================
USE_ELF_HACK=1
MOZ_ARG_DISABLE_BOOL(elf-hack,
[ --disable-elf-hack Disable elf hacks],
USE_ELF_HACK=,
USE_ELF_HACK=1)
[USE_ELF_HACK=],
[USE_ELF_HACK=F # Force enable elf-hack])
# Disable elf hack for profiling because the built in profiler
# doesn't read the segments properly with elf hack. This is
# temporary and should be fixed soon in the profiler.
if test "$MOZ_PROFILING" = 1; then
if test "$USE_ELF_HACK" = F; then
AC_ERROR([--enable-elf-hack is not compatible with --enable-profiling])
fi
USE_ELF_HACK=
fi
@ -7595,7 +7598,7 @@ if test "$USE_ELF_HACK" = 1; then
esac
fi
if test "$USE_ELF_HACK" = 1; then
if test -n "$USE_ELF_HACK"; then
dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
dnl memory addresses it maps to. The result is that by the time elfhack
dnl kicks in, it is not possible to apply relocations because of that,
@ -7603,7 +7606,8 @@ if test "$USE_ELF_HACK" = 1; then
dnl segment. It makes elfhack mostly useless, so considering the problems
dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
dnl the linker creates PT_GNU_RELRO segments.
dnl the linker creates PT_GNU_RELRO segments. However, when we do want
dnl elfhack enabled, disable PT_GNU_RELRO instead.
AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
LINK_WITH_PT_GNU_RELRO,
[echo "int main() {return 0;}" > conftest.${ac_ext}
@ -7620,8 +7624,18 @@ if test "$USE_ELF_HACK" = 1; then
fi
rm -rf conftest*])
if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
AC_MSG_WARN([Disabling elfhack])
USE_ELF_HACK=
if test "$USE_ELF_HACK" = F; then
AC_MSG_CHECKING([for -z norelro option to ld])
_SAVE_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-z,norelro"
AC_TRY_LINK(,,AC_MSG_RESULT([yes])
[NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"],
AC_ERROR([--enable-elf-hack is not compatible with a linker creating a PT_GNU_RELRO segment and that doesn't support the "-z norelro" option.]))
USE_ELF_HACK=1
else
AC_MSG_WARN([Disabling elfhack])
USE_ELF_HACK=
fi
fi
fi

View File

@ -19,6 +19,7 @@ ac_add_options --with-android-version=9
ac_add_options --with-system-zlib
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-profiling
ac_add_options --disable-elf-hack # --enable-elf-hack conflicts with --enable-profiling
export JAVA_HOME=/tools/jdk6
export MOZILLA_OFFICIAL=1

View File

@ -10,3 +10,5 @@
# much slower and we didn't want to slow down developers builds.
# Has no effect when MOZ_ENABLE_SZIP is not set in mobile/android/confvars.sh.
MOZ_SZIP_FLAGS="-D auto -f auto"
ac_add_options --enable-elf-hack