Fix the build on ARM [1]

Add DTRACE option (default off) [2]

PR:		197058 [1]
PR:		192614 [2]
Submitted by:	sbruno@ [1], jbeich@ [2]
This commit is contained in:
Koop Mast 2015-01-30 09:58:04 +00:00
parent 23d4801b50
commit 8ba21f0052
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=378144
8 changed files with 194 additions and 2 deletions

View File

@ -29,13 +29,15 @@ CONFIGURE_ARGS= --with-pthreads \
--with-system-nspr
OPTIONS_DEFINE= DEBUG GCZEAL JEMALLOC METHODJIT OPTIMIZE READLINE \
THREADSAFE TRACEJIT UTF8 \
THREADSAFE TRACEJIT UTF8 DTRACE
OPTIONS_DEFAULT= METHODJIT OPTIMIZE READLINE THREADSAFE TRACEJIT
OPTIONS_SUB= yes
DEBUG_DESC= Enable Debug build
DEBUG_CONFIGURE_ENABLE= debug debug-symbols
DEBUG_CONFIGURE_DISABLE=debug
DTRACE_CONFIGURE_ENABLE=dtrace profiling
DTRACE_LIBS= -lelf
GCZEAL_DESC= Enable Zealous garbage collecting
GCZEAL_CONFIGURE_ENABLE=gczeal
JEMALLOC_DESC= Use jemalloc as memory allocator
@ -59,6 +61,10 @@ UTF8_CFLAGS= -DJS_C_STRINGS_ARE_UTF8
CONFIGURE_TARGET= x86_64-portbld-freebsd${OSREL}
.endif
.if ${PORT_OPTIONS:MDTRACE} && ${OSVERSION} < 1000510
BROKEN= dtrace -G crashes with C++ object files
.endif
regression-test: build
@${ECHO_MSG} -n "===> Running jstests.py: "
@cd ${WRKSRC} && ${SETENV} TZ=PST8PDT ${PYTHON_CMD} tests/jstests.py \
@ -71,7 +77,9 @@ regression-test: build
post-install:
${LN} -s libmozjs-24.so ${STAGEDIR}${PREFIX}/lib/libmozjs-24.so.1
.if ! ${PORT_OPTIONS:MDTRACE}
@${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/js24
@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libmozjs-24.*
.endif
.include <bsd.port.post.mk>

View File

@ -0,0 +1,14 @@
--- assembler/jit/ExecutableAllocator.h.orig 2013-10-29 20:40:26 UTC
+++ assembler/jit/ExecutableAllocator.h
@@ -477,6 +477,11 @@ public:
{
sync_instruction_memory((caddr_t)code, size);
}
+#elif CPU(ARM_TRADITIONAL) && OS(FREEBSD) && COMPILER(CLANG)
+ static void cacheFlush(void* code, size_t size)
+ {
+ __clear_cache(code, reinterpret_cast<char*>(code) + size);
+ }
#endif
private:

View File

@ -0,0 +1,35 @@
diff --git js/src/config/rules.mk js/src/config/rules.mk
index 4d67eda..783942f 100644
--- config/rules.mk
+++ config/rules.mk
@@ -858,7 +858,7 @@ ifdef DTRACE_PROBE_OBJ
ifndef DTRACE_LIB_DEPENDENT
NON_DTRACE_OBJS := $(filter-out $(DTRACE_PROBE_OBJ),$(OBJS))
$(DTRACE_PROBE_OBJ): $(NON_DTRACE_OBJS)
- dtrace -G -C -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(NON_DTRACE_OBJS)
+ dtrace -x nolibs -G -C -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(NON_DTRACE_OBJS)
endif
endif
endif
@@ -876,7 +876,7 @@ ifndef INCREMENTAL_LINKER
endif
ifdef DTRACE_LIB_DEPENDENT
ifndef XP_MACOSX
- dtrace -G -C -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(shell $(EXPAND_LIBS) $(MOZILLA_PROBE_LIBS))
+ dtrace -x nolibs -G -C -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(shell $(EXPAND_LIBS) $(MOZILLA_PROBE_LIBS))
endif
$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(MOZILLA_PROBE_LIBS) $(RESFILE) $(LDFLAGS) $(WRAP_LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE) $(if $(LIB_IS_C_ONLY),,$(STLPORT_LIBS))
@$(RM) $(DTRACE_PROBE_OBJ)
diff --git js/src/Makefile.in js/src/Makefile.in
index 28ca5e8..96793d7 100644
--- Makefile.in
+++ Makefile.in
@@ -342,7 +342,7 @@ endif
ifdef HAVE_DTRACE
$(CURDIR)/javascript-trace.h: $(srcdir)/devtools/javascript-trace.d
- dtrace -h -s $(srcdir)/devtools/javascript-trace.d -o javascript-trace.h.in
+ dtrace -x nolibs -h -s $(srcdir)/devtools/javascript-trace.d -o javascript-trace.h.in
sed -e 's/if _DTRACE_VERSION/ifdef INCLUDE_MOZILLA_DTRACE/' \
-e '/const/!s/char \*/const char */g' \
javascript-trace.h.in > javascript-trace.h

View File

@ -0,0 +1,32 @@
diff --git js/src/configure js/src/configure
index 59d69c7..779a50f 100644
--- configure
+++ configure
@@ -10260,7 +10260,13 @@ cross_compiling=$ac_cv_prog_cc_cross
# Check whether --enable-dtrace or --disable-dtrace was given.
if test "${enable_dtrace+set}" = set; then
enableval="$enable_dtrace"
- enable_dtrace="yes"
+ if test "$enableval" = "yes"; then
+ enable_dtrace="yes"
+ elif test "$enableval" = "no"; then
+ :
+ else
+ { echo "configure: error: Option, dtrace, does not take an argument ($enableval)." 1>&2; exit 1; }
+ fi
fi
if test "x$enable_dtrace" = "xyes"; then
diff --git js/src/configure.in js/src/configure.in
index 59d69c7..779a50f 100644
--- configure.in
+++ configure.in
@@ -2153,7 +2153,7 @@ dnl Quota support
MOZ_CHECK_HEADERS(sys/quota.h)
MOZ_CHECK_HEADERS(linux/quota.h)
-AC_ARG_ENABLE(dtrace,
+MOZ_ARG_ENABLE_BOOL(dtrace,
[ --enable-dtrace build with dtrace support if available (default=no)],
[enable_dtrace="yes"],)
if test "x$enable_dtrace" = "xyes"; then

View File

@ -0,0 +1,23 @@
diff --git js/src/Makefile.in js/src/Makefile.in
index e28160a..28ca5e8 100644
--- Makefile.in
+++ Makefile.in
@@ -35,7 +35,6 @@ ifdef JS_SHARED_LIBRARY
FORCE_SHARED_LIB = 1
endif
FORCE_STATIC_LIB = 1
-DIST_INSTALL = 1
###############################################
# BEGIN include sources for low-level code shared with mfbt
@@ -584,8 +584,8 @@ install:: $(EXPORTS_mozilla)
install:: $(SCRIPTS)
$(SYSINSTALL) $^ $(DESTDIR)$(bindir)
-install:: $(REAL_LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY)
-ifneq (,$(REAL_LIBRARY))
+install:: $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY)
+ifdef DIST_INSTALL
$(SYSINSTALL) $(REAL_LIBRARY) $(DESTDIR)$(libdir)
mv -f $(DESTDIR)$(libdir)/$(REAL_LIBRARY) $(subst $(STATIC_LIBRARY_NAME),$(LIBRARY_NAME),$(DESTDIR)$(libdir)/$(REAL_LIBRARY))
endif

View File

@ -0,0 +1,67 @@
https://hg.mozilla.org/mozilla-central/rev/07ce4364fbec
--- jit/AsmJSSignalHandlers.cpp.orig 2013-10-29 21:40:19.000000000 +0100
+++ jit/AsmJSSignalHandlers.cpp 2015-01-25 11:23:43.104097667 +0100
@@ -64,7 +64,6 @@
# endif
# define EIP_sig(p) ((p)->uc_mcontext.gregs[REG_EIP])
# define RIP_sig(p) ((p)->uc_mcontext.gregs[REG_RIP])
-# define PC_sig(p) ((p)->uc_mcontext.arm_pc)
# define RAX_sig(p) ((p)->uc_mcontext.gregs[REG_RAX])
# define RCX_sig(p) ((p)->uc_mcontext.gregs[REG_RCX])
# define RDX_sig(p) ((p)->uc_mcontext.gregs[REG_RDX])
@@ -80,7 +79,11 @@
# define R12_sig(p) ((p)->uc_mcontext.gregs[REG_R12])
# define R13_sig(p) ((p)->uc_mcontext.gregs[REG_R13])
# define R14_sig(p) ((p)->uc_mcontext.gregs[REG_R14])
-# define R15_sig(p) ((p)->uc_mcontext.gregs[REG_R15])
+# if defined(__linux__) && defined(__arm__)
+# define R15_sig(p) ((p)->uc_mcontext.arm_pc)
+# else
+# define R15_sig(p) ((p)->uc_mcontext.gregs[REG_R15])
+# endif
#elif defined(__NetBSD__)
# define XMM_sig(p,i) (((struct fxsave64 *)(p)->uc_mcontext.__fpregs)->fx_xmm[i])
# define EIP_sig(p) ((p)->uc_mcontext.__gregs[_REG_EIP])
@@ -124,7 +127,11 @@
# define R12_sig(p) ((p)->uc_mcontext.mc_r12)
# define R13_sig(p) ((p)->uc_mcontext.mc_r13)
# define R14_sig(p) ((p)->uc_mcontext.mc_r14)
-# define R15_sig(p) ((p)->uc_mcontext.mc_r15)
+# if defined(__FreeBSD__) && defined(__arm__)
+# define R15_sig(p) ((p)->uc_mcontext.__gregs[_REG_R15])
+# else
+# define R15_sig(p) ((p)->uc_mcontext.mc_r15)
+# endif
#elif defined(XP_MACOSX)
// Mach requires special treatment.
#else
@@ -325,20 +332,20 @@
# define CONTEXT ucontext_t
# endif
+#if defined(JS_CPU_X64)
+# define PC_sig(p) RIP_sig(p)
+#elif defined(JS_CPU_X86)
+# define PC_sig(p) EIP_sig(p)
+#elif defined(JS_CPU_ARM)
+# define PC_sig(p) R15_sig(p)
+#endif
+
# if !defined(XP_MACOSX)
static uint8_t **
ContextToPC(CONTEXT *context)
{
-# if defined(JS_CPU_X64)
- JS_STATIC_ASSERT(sizeof(RIP_sig(context)) == sizeof(void*));
- return reinterpret_cast<uint8_t**>(&RIP_sig(context));
-# elif defined(JS_CPU_X86)
- JS_STATIC_ASSERT(sizeof(EIP_sig(context)) == sizeof(void*));
- return reinterpret_cast<uint8_t**>(&EIP_sig(context));
-# elif defined(JS_CPU_ARM)
JS_STATIC_ASSERT(sizeof(PC_sig(context)) == sizeof(void*));
return reinterpret_cast<uint8_t**>(&PC_sig(context));
-# endif
}
# if defined(JS_CPU_X64)

View File

@ -0,0 +1,11 @@
--- jit/arm/Architecture-arm.cpp.orig 2013-10-29 20:40:20 UTC
+++ jit/arm/Architecture-arm.cpp
@@ -15,7 +15,7 @@
// lame check for kernel version
// see bug 586550
-#if !(defined(ANDROID) || defined(MOZ_B2G))
+#if !(defined(ANDROID) || defined(MOZ_B2G) || defined(__FreeBSD__))
#include <asm/hwcap.h>
#else
#define HWCAP_VFP (1<<0)

View File

@ -1,5 +1,6 @@
bin/js24
bin/js24-config
%%DTRACE%%include/mozjs-24/javascript-trace.h
include/mozjs-24/js-config.h
include/mozjs-24/js.msg
include/mozjs-24/js/Anchor.h
@ -73,6 +74,7 @@ include/mozjs-24/mozilla/TypedEnum.h
include/mozjs-24/mozilla/Types.h
include/mozjs-24/mozilla/Util.h
include/mozjs-24/mozilla/WeakPtr.h
@comment lib/libmozjs-24.a
lib/libmozjs-24.so
lib/libmozjs-24.so.1
libdata/pkgconfig/mozjs-24.pc