Bug 550371 mozalloc failed to build on Solaris r=bsmedberg
authorGinn Chen <ginn.chen@sun.com>
Wed, 07 Apr 2010 14:16:32 +0800
changeset 40533 43241b879901ae490a2951d20e946949ba93a417
parent 40532 0c8ce4ebd370740a79f18f495ecfef354d7fff89
child 40534 1c5149e87e744c5d61305467d92a38e85f689508
push id12652
push userginn.chen@sun.com
push dateWed, 07 Apr 2010 06:21:52 +0000
treeherdermozilla-central@1c5149e87e74 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs550371
milestone1.9.3a4pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
Bug 550371 mozalloc failed to build on Solaris r=bsmedberg
config/rules.mk
configure.in
js/src/config/rules.mk
js/src/configure.in
memory/mozalloc/mozalloc.h
toolkit/components/ctypes/tests/Makefile.in
xpcom/build/Makefile.in
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -343,25 +343,17 @@ endif
 
 ifdef MAPFILE
 OS_LDFLAGS += -MAP:$(MAPFILE)
 endif
 
 endif # !GNU_CC
 
 ifdef ENABLE_CXX_EXCEPTIONS
-ifdef GNU_CC
-CXXFLAGS		+= -fexceptions
-else
-ifeq (,$(filter-out 1200 1300 1310,$(_MSC_VER)))
-CXXFLAGS		+= -GX
-else
-CXXFLAGS		+= -EHsc
-endif # _MSC_VER
-endif # GNU_CC
+CXXFLAGS += $(MOZ_EXCEPTIONS_FLAGS_ON) -DMOZ_CPP_EXCEPTIONS=1
 endif # ENABLE_CXX_EXCEPTIONS
 endif # WINNT
 
 ifeq ($(SOLARIS_SUNPRO_CXX),1)
 CXXFLAGS += -features=extensions -D__FUNCTION__=__func__
 ifeq (86,$(findstring 86,$(OS_TEST)))
 OS_LDFLAGS += -M $(topsrcdir)/config/solaris_ia32.map
 endif # x86
--- a/configure.in
+++ b/configure.in
@@ -2641,16 +2641,18 @@ alpha*-*-osf*)
     MOZ_MEMORY=1
     if test "$SOLARIS_SUNPRO_CC"; then
        LIBS="-lCrun -lCstd $LIBS"
        NS_USE_NATIVE=1
        MOZ_FIX_LINK_PATHS=
        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic -norunpath"
+       _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
+       _MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
            _SAVE_LDFLAGS=$LDFLAGS
            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
            AC_TRY_LINK([#include <stdio.h>],
                        [printf("Hello World\n");],
                        ,
                        [LDFLAGS=$_SAVE_LDFLAGS])
@@ -7517,26 +7519,27 @@ if test "$_MOZ_USE_RTTI"; then
    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
 else
    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
 fi
 
 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
 
 dnl ========================================================
-dnl C++ exceptions (g++/egcs only - for now)
+dnl C++ exceptions (g++/VC/irix6/Sun only - for now)
 dnl Should be smarter and check that the compiler does indeed have exceptions
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
 [  --enable-cpp-exceptions Enable C++ exceptions ],
 [ _MOZ_CPP_EXCEPTIONS=1 ],
 [ _MOZ_CPP_EXCEPTIONS= ])
 
 if test "$_MOZ_CPP_EXCEPTIONS"; then
     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
+    AC_DEFINE(MOZ_CPP_EXCEPTIONS)
 else
     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
 fi
 
 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
 
 # Irix & OSF native compilers do not like exception declarations 
 # when exceptions are disabled
--- a/js/src/config/rules.mk
+++ b/js/src/config/rules.mk
@@ -343,25 +343,17 @@ endif
 
 ifdef MAPFILE
 OS_LDFLAGS += -MAP:$(MAPFILE)
 endif
 
 endif # !GNU_CC
 
 ifdef ENABLE_CXX_EXCEPTIONS
-ifdef GNU_CC
-CXXFLAGS		+= -fexceptions
-else
-ifeq (,$(filter-out 1200 1300 1310,$(_MSC_VER)))
-CXXFLAGS		+= -GX
-else
-CXXFLAGS		+= -EHsc
-endif # _MSC_VER
-endif # GNU_CC
+CXXFLAGS += $(MOZ_EXCEPTIONS_FLAGS_ON) -DMOZ_CPP_EXCEPTIONS=1
 endif # ENABLE_CXX_EXCEPTIONS
 endif # WINNT
 
 ifeq ($(SOLARIS_SUNPRO_CXX),1)
 CXXFLAGS += -features=extensions -D__FUNCTION__=__func__
 ifeq (86,$(findstring 86,$(OS_TEST)))
 OS_LDFLAGS += -M $(topsrcdir)/config/solaris_ia32.map
 endif # x86
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -2393,16 +2393,18 @@ alpha*-*-osf*)
     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
     if test "$SOLARIS_SUNPRO_CC"; then
        LIBS="-lCrun -lCstd $LIBS"
        NS_USE_NATIVE=1
        MOZ_FIX_LINK_PATHS=
        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
        CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
        CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic -norunpath"
+       _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
+       _MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
            _SAVE_LDFLAGS=$LDFLAGS
            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
            AC_TRY_LINK([#include <stdio.h>],
                        [printf("Hello World\n");],
                        ,
                        [LDFLAGS=$_SAVE_LDFLAGS])
@@ -4775,26 +4777,27 @@ if test "$_MOZ_USE_RTTI"; then
    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
 else
    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
 fi
 
 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
 
 dnl ========================================================
-dnl C++ exceptions (g++/egcs only - for now)
+dnl C++ exceptions (g++/VC/irix6/Sun only - for now)
 dnl Should be smarter and check that the compiler does indeed have exceptions
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
 [  --enable-cpp-exceptions Enable C++ exceptions ],
 [ _MOZ_CPP_EXCEPTIONS=1 ],
 [ _MOZ_CPP_EXCEPTIONS= ])
 
 if test "$_MOZ_CPP_EXCEPTIONS"; then
     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
+    AC_DEFINE(MOZ_CPP_EXCEPTIONS)
 else
     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
 fi
 
 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
 
 # Irix & OSF native compilers do not like exception declarations 
 # when exceptions are disabled
--- a/memory/mozalloc/mozalloc.h
+++ b/memory/mozalloc/mozalloc.h
@@ -68,16 +68,23 @@
 #if defined(NS_ALWAYS_INLINE)
 #  define MOZALLOC_INLINE NS_ALWAYS_INLINE inline
 #elif defined(HAVE_FORCEINLINE)
 #  define MOZALLOC_INLINE __forceinline
 #else
 #  define MOZALLOC_INLINE inline
 #endif
 
+/* Workaround build problem with Sun Studio 12 */
+#if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+#  undef NS_WARN_UNUSED_RESULT
+#  define NS_WARN_UNUSED_RESULT
+#  undef NS_ATTR_MALLOC
+#  define NS_ATTR_MALLOC
+#endif
 
 #if defined(__cplusplus)
 extern "C" {
 #endif /* ifdef __cplusplus */
 
 
 /* 
  * If we don't have these system functions, but do have jemalloc
@@ -205,17 +212,17 @@ MOZALLOC_EXPORT void* moz_valloc(size_t 
  * visibility on OS X/gcc. These symbols are force-inline and not
  * exported. */
 #if defined(XP_MACOSX)
 #  define MOZALLOC_EXPORT_NEW MOZALLOC_EXPORT
 #else
 #  define MOZALLOC_EXPORT_NEW
 #endif
 
-#ifdef __MINGW32__
+#ifdef MOZ_CPP_EXCEPTIONS
 #define MOZALLOC_THROW_BAD_ALLOC throw(std::bad_alloc)
 #else
 #define MOZALLOC_THROW_BAD_ALLOC throw()
 #endif
 
 MOZALLOC_EXPORT_NEW MOZALLOC_INLINE
 void* operator new(size_t size) MOZALLOC_THROW_BAD_ALLOC
 {
--- a/toolkit/components/ctypes/tests/Makefile.in
+++ b/toolkit/components/ctypes/tests/Makefile.in
@@ -52,17 +52,17 @@ NO_DIST_INSTALL = 1
 CPPSRCS = jsctypes-test.cpp
 
 LOCAL_INCLUDES = \
     -I$(topsrcdir)/js/src/ctypes \
     $(NULL)
 
 EXTRA_DSO_LDOPTS += \
     $(XPCOM_STANDALONE_GLUE_LDOPTS) \
-    $(MOZALLOC_LIB) \
+    -L$(LIBXUL_DIST)/lib $(MOZALLOC_LIB) \
     $(NSPR_LIBS) \
     $(NULL)
 
 XPCSHELL_TESTS = unit
 
 include $(topsrcdir)/config/rules.mk
 
 xpctestdir = $(testxpcobjdir)/$(MODULE)/unit
--- a/xpcom/build/Makefile.in
+++ b/xpcom/build/Makefile.in
@@ -145,17 +145,17 @@ include $(topsrcdir)/config/rules.mk
 
 DEFINES		+= \
 		-D_IMPL_NS_COM \
 		-D_IMPL_NS_STRINGAPI \
 		-DEXPORT_XPT_API \
 		-DEXPORT_XPTC_API
 
 EXTRA_DSO_LDOPTS +=				\
-	$(MOZALLOC_LIB)				\
+	-L$(LIBXUL_DIST)/lib $(MOZALLOC_LIB)    \
 	$(NSPR_LIBS)				\
 	$(NULL)
 
 ifdef TARGET_XPCOM_ABI
 DEFINES += -DTARGET_XPCOM_ABI=\"$(TARGET_XPCOM_ABI)\"
 endif
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))