From a27454a03beb5073f26287299c61f3759ba3531d Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Sat, 5 Jun 2010 13:15:50 -0400 Subject: [PATCH] update nspr to NSPR_HEAD_20100604 r=ted --- nsprpub/config/autoconf.mk.in | 7 + nsprpub/config/config.mk | 11 + nsprpub/configure | 352 +++++++++++++++------- nsprpub/configure.in | 129 +++++++- nsprpub/lib/libc/include/plgetopt.h | 5 +- nsprpub/lib/libc/src/plgetopt.c | 46 ++- nsprpub/pr/include/md/_openbsd.h | 2 +- nsprpub/pr/include/md/_pth.h | 6 + nsprpub/pr/include/md/_winnt.h | 6 +- nsprpub/pr/include/pratom.h | 10 +- nsprpub/pr/src/md/unix/os_Darwin_ppc.s | 4 + nsprpub/pr/src/md/unix/os_Darwin_x86.s | 4 + nsprpub/pr/src/md/unix/os_Darwin_x86_64.s | 4 + nsprpub/pr/src/md/unix/os_HPUX.s | 7 +- nsprpub/pr/src/md/unix/os_Linux_x86_64.s | 8 + nsprpub/pr/src/md/unix/uxrng.c | 4 + nsprpub/pr/src/misc/prinit.c | 4 +- nsprpub/pr/src/misc/prsystem.c | 14 + nsprpub/pr/src/pthreads/ptsynch.c | 8 +- nsprpub/pr/src/pthreads/ptthread.c | 4 +- nsprpub/pr/src/threads/combined/pruthr.c | 4 +- nsprpub/pr/src/threads/prtpd.c | 2 +- nsprpub/pr/tests/nbconn.c | 4 +- 23 files changed, 493 insertions(+), 152 deletions(-) diff --git a/nsprpub/config/autoconf.mk.in b/nsprpub/config/autoconf.mk.in index 36b131403de..6fede1ae244 100644 --- a/nsprpub/config/autoconf.mk.in +++ b/nsprpub/config/autoconf.mk.in @@ -83,7 +83,14 @@ DLLFLAGS = @DLLFLAGS@ EXEFLAGS = @EXEFLAGS@ OPTIMIZER = @OPTIMIZER@ +PROFILE_GEN_CFLAGS = @PROFILE_GEN_CFLAGS@ +PROFILE_GEN_LDFLAGS = @PROFILE_GEN_LDFLAGS@ +PROFILE_USE_CFLAGS = @PROFILE_USE_CFLAGS@ +PROFILE_USE_LDFLAGS = @PROFILE_USE_LDFLAGS@ + MKSHLIB = @MKSHLIB@ +WRAP_MALLOC_LIB = @WRAP_MALLOC_LIB@ +WRAP_MALLOC_CFLAGS = @WRAP_MALLOC_CFLAGS@ DSO_CFLAGS = @DSO_CFLAGS@ DSO_LDOPTS = @DSO_LDOPTS@ diff --git a/nsprpub/config/config.mk b/nsprpub/config/config.mk index 10ebfdab139..b91fcc95007 100644 --- a/nsprpub/config/config.mk +++ b/nsprpub/config/config.mk @@ -74,6 +74,17 @@ NOMD_CCFLAGS = $(CCC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\ LDFLAGS = $(OS_LDFLAGS) +# Enable profile-guided optimization +ifdef MOZ_PROFILE_GENERATE +CFLAGS += $(PROFILE_GEN_CFLAGS) +LDFLAGS += $(PROFILE_GEN_LDFLAGS) +endif # MOZ_PROFILE_GENERATE + +ifdef MOZ_PROFILE_USE +CFLAGS += $(PROFILE_USE_CFLAGS) +LDFLAGS += $(PROFILE_USE_LDFLAGS) +endif # MOZ_PROFILE_USE + define MAKE_OBJDIR if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi endef diff --git a/nsprpub/configure b/nsprpub/configure index 11713df8e04..06fb88b3c75 100755 --- a/nsprpub/configure +++ b/nsprpub/configure @@ -66,6 +66,8 @@ ac_help="$ac_help [10.2 for ppc, 10.4 for x86]" ac_help="$ac_help --disable-os2-high-mem Disable high-memory support on OS/2" +ac_help="$ac_help + --enable-thumb2 Enable Thumb2 instruction set" ac_help="$ac_help --with-symbian-sdk=SYMBIAN_SDK_DIR The path to the Symbian SDK" @@ -84,6 +86,10 @@ ac_help="$ac_help --enable-ipv6 Compile ipv6 support" ac_help="$ac_help --enable-boehm Enable the Boehm Garbage Collector" +ac_help="$ac_help + --enable-wrap-malloc Wrap malloc calls (gnu linker only)" +ac_help="$ac_help + --with-wrap-malloc=SHAREDLIB Location of malloc wrapper library" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -642,7 +648,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:646: checking host system type" >&5 +echo "configure:652: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -663,7 +669,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:667: checking target system type" >&5 +echo "configure:673: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -681,7 +687,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:685: checking build system type" >&5 +echo "configure:691: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -734,6 +740,11 @@ MACOS_SDK_DIR= NEXT_ROOT= MT= MOZ_OS2_HIGH_MEMORY=1 +MOZ_THUMB2= +PROFILE_GEN_CFLAGS= +PROFILE_GEN_LDFLAGS= +PROFILE_USE_CFLAGS= +PROFILE_USE_LDFLAGS= RESOLVE_LINK_SYMBOLS= @@ -753,7 +764,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:757: checking for $ac_word" >&5 +echo "configure:768: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -853,8 +864,8 @@ if test "$target" = "arm-android-eabi" ; then STRIP="$android_toolchain"/bin/arm-eabi-strip CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS" - CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork $CFLAGS" - CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fpic -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork -mthumb $CXXFLAGS" + CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions $CFLAGS" + CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fpic -fno-short-enums -fno-exceptions $CXXFLAGS" LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform $LDFLAGS" if test -z "$HOST_CPPFLAGS" ; then @@ -1166,7 +1177,7 @@ if test -z "$SKIP_PATH_CHECKS"; then # Extract the first word of "$WHOAMI whoami", so it can be a program name with args. set dummy $WHOAMI whoami; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1170: checking for $ac_word" >&5 +echo "configure:1181: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_WHOAMI'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1237,13 +1248,13 @@ if test "$target" != "$host"; then _SAVE_LDFLAGS="$LDFLAGS" echo $ac_n "checking for $host compiler""... $ac_c" 1>&6 -echo "configure:1241: checking for $host compiler" >&5 +echo "configure:1252: checking for $host compiler" >&5 for ac_prog in $HOST_CC gcc cc /usr/ucb/cc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1247: checking for $ac_word" >&5 +echo "configure:1258: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_HOST_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1289,16 +1300,16 @@ test -n "$HOST_CC" || HOST_CC="""" LDFLAGS="$HOST_LDFLAGS" echo $ac_n "checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1293: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5 +echo "configure:1304: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1313: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_prog_host_cc_works=1 echo "$ac_t""yes" 1>&6 else @@ -1327,7 +1338,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1331: checking for $ac_word" >&5 +echo "configure:1342: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1361,7 +1372,7 @@ test -n "$CC" || CC="echo" # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1365: checking for $ac_word" >&5 +echo "configure:1376: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1391,7 +1402,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1395: checking for $ac_word" >&5 +echo "configure:1406: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1442,7 +1453,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1446: checking for $ac_word" >&5 +echo "configure:1457: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1474,7 +1485,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1478: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1489: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1485,12 +1496,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1489 "configure" +#line 1500 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1494: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1505: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1516,12 +1527,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1520: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1531: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1525: checking whether we are using GNU C" >&5 +echo "configure:1536: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1530,7 +1541,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1534: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1545: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1549,7 +1560,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1553: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1564: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1586,7 +1597,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1590: checking for $ac_word" >&5 +echo "configure:1601: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1622,7 +1633,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1626: checking for $ac_word" >&5 +echo "configure:1637: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1654,7 +1665,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1658: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:1669: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1665,12 +1676,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 1669 "configure" +#line 1680 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:1674: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1685: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cxx_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1696,12 +1707,12 @@ if test $ac_cv_prog_cxx_works = no; then { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1700: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1711: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:1705: checking whether we are using GNU C++" >&5 +echo "configure:1716: checking whether we are using GNU C++" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1710,7 +1721,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1714: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1725: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -1729,7 +1740,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}" ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:1733: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:1744: checking whether ${CXX-g++} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1774,7 +1785,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1778: checking for $ac_word" >&5 +echo "configure:1789: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1809,7 +1820,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1813: checking for $ac_word" >&5 +echo "configure:1824: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1844,7 +1855,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1848: checking for $ac_word" >&5 +echo "configure:1859: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1879,7 +1890,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1883: checking for $ac_word" >&5 +echo "configure:1894: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1914,7 +1925,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1918: checking for $ac_word" >&5 +echo "configure:1929: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1949,7 +1960,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1953: checking for $ac_word" >&5 +echo "configure:1964: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1984,7 +1995,7 @@ else # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1988: checking for $ac_word" >&5 +echo "configure:1999: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2014,7 +2025,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2018: checking for $ac_word" >&5 +echo "configure:2029: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2065,7 +2076,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2069: checking for $ac_word" >&5 +echo "configure:2080: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2097,7 +2108,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2101: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2112: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2108,12 +2119,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2112 "configure" +#line 2123 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2139,12 +2150,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2143: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2154: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2148: checking whether we are using GNU C" >&5 +echo "configure:2159: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2153,7 +2164,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2157: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2168: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2172,7 +2183,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2176: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2187: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2212,7 +2223,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2216: checking for $ac_word" >&5 +echo "configure:2227: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2244,7 +2255,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2248: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:2259: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2255,12 +2266,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 2259 "configure" +#line 2270 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:2264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2275: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cxx_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2286,12 +2297,12 @@ if test $ac_cv_prog_cxx_works = no; then { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2290: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2301: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:2295: checking whether we are using GNU C++" >&5 +echo "configure:2306: checking whether we are using GNU C++" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2300,7 +2311,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:2304: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:2315: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -2319,7 +2330,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}" ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:2323: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:2334: checking whether ${CXX-g++} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2353,7 +2364,7 @@ fi fi fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2357: checking how to run the C preprocessor" >&5 +echo "configure:2368: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2368,13 +2379,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2378: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2389: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2385,13 +2396,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2395: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2406: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2402,13 +2413,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2412: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2423: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2435,7 +2446,7 @@ echo "$ac_t""$CPP" 1>&6 # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2439: checking for $ac_word" >&5 +echo "configure:2450: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2467,7 +2478,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2471: checking for $ac_word" >&5 +echo "configure:2482: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2508,7 +2519,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2512: checking for $ac_word" >&5 +echo "configure:2523: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2549,7 +2560,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2553: checking for $ac_word" >&5 +echo "configure:2564: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2590,7 +2601,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2594: checking for $ac_word" >&5 +echo "configure:2605: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2631,7 +2642,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2635: checking for $ac_word" >&5 +echo "configure:2646: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2699,7 +2710,7 @@ else fi echo $ac_n "checking for gcc -pipe support""... $ac_c" 1>&6 -echo "configure:2703: checking for gcc -pipe support" >&5 +echo "configure:2714: checking for gcc -pipe support" >&5 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then echo '#include ' > dummy-hello.c echo 'int main() { printf("Hello World\n"); return 0; }' >> dummy-hello.c @@ -2714,14 +2725,14 @@ if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then _SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -pipe" cat > conftest.$ac_ext < int main() { printf("Hello World\n"); ; return 0; } EOF -if { (eval echo configure:2725: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2736: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* _res_gcc_pipe="yes" else @@ -2746,9 +2757,44 @@ else echo "$ac_t""no" 1>&6 fi + +_SAVE_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction" + +echo $ac_n "checking whether C compiler supports -fprofile-generate""... $ac_c" 1>&6 +echo "configure:2766: checking whether C compiler supports -fprofile-generate" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + PROFILE_GEN_CFLAGS="-fprofile-generate" + result="yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + result="no" +fi +rm -f conftest* +echo "$ac_t""$result" 1>&6 + +if test $result = "yes"; then + PROFILE_GEN_LDFLAGS="-fprofile-generate" + PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch -freoder-blocks-and-partition" + PROFILE_USE_LDFLAGS="-fprofile-use" +fi + +CFLAGS="$_SAVE_CFLAGS" + if test "$GNU_CC"; then echo $ac_n "checking for visibility(hidden) attribute""... $ac_c" 1>&6 -echo "configure:2752: checking for visibility(hidden) attribute" >&5 +echo "configure:2798: checking for visibility(hidden) attribute" >&5 if eval "test \"`echo '$''{'ac_cv_visibility_hidden'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2772,7 +2818,7 @@ echo "$ac_t""$ac_cv_visibility_hidden" 1>&6 EOF echo $ac_n "checking for visibility pragma support""... $ac_c" 1>&6 -echo "configure:2776: checking for visibility pragma support" >&5 +echo "configure:2822: checking for visibility pragma support" >&5 if eval "test \"`echo '$''{'ac_cv_visibility_pragma'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2825,7 +2871,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2829: checking for $ac_word" >&5 +echo "configure:2875: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3037,6 +3083,32 @@ if test "${enable_os2_high_mem+set}" = set; then fi +# Check whether --enable-thumb2 or --disable-thumb2 was given. +if test "${enable_thumb2+set}" = set; then + enableval="$enable_thumb2" + if test "$enableval" = "yes"; then + MOZ_THUMB2=1, + fi +fi + + +if test -n "$MOZ_THUMB2"; then + case "$target_cpu" in + arm*) + if test "$GNU_CC"; then + CFLAGS="$CFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb" + CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb" + ASFLAGS="$ASFLAGS -march=armv7-a -mthumb" + else + { echo "configure: error: --enable-thumb2 is not supported for non-GNU toolchains" 1>&2; exit 1; } + fi + ;; + *) + { echo "configure: error: --enable-thumb2 is not supported for non-ARM CPU architectures" 1>&2; exit 1; } + ;; + esac +fi + case "$host" in *-mingw*) NSINSTALL=nsinstall @@ -3075,17 +3147,17 @@ EOF DSO_LDOPTS='-brtl -bnortllib -bM:SRE -bnoentry -bexpall -blibpath:/usr/lib:/lib' ac_safe=`echo "sys/atomic_op.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/atomic_op.h""... $ac_c" 1>&6 -echo "configure:3079: checking for sys/atomic_op.h" >&5 +echo "configure:3151: checking for sys/atomic_op.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3089: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3161: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3242,7 +3314,7 @@ EOF _DEBUG_FLAGS='-gdwarf-2 -O0' MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@' echo $ac_n "checking for gethostbyaddr in -lbind""... $ac_c" 1>&6 -echo "configure:3246: checking for gethostbyaddr in -lbind" >&5 +echo "configure:3318: checking for gethostbyaddr in -lbind" >&5 ac_lib_var=`echo bind'_'gethostbyaddr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3250,7 +3322,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lbind $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3337: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3994,7 +4066,7 @@ EOF CXXFLAGS="$CXXFLAGS -Wall" MDCPUCFG_H=_linux.cfg PR_MD_CSRCS=linux.c - MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@' + MKSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_LIB) -o $@' DSO_CFLAGS=-fPIC DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)' _OPTIMIZE_FLAGS=-O2 @@ -4037,7 +4109,7 @@ EOF CXXFLAGS="$CXXFLAGS -Wall" MDCPUCFG_H=_linux.cfg PR_MD_CSRCS=linux.c - MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@' + MKSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_LIB) -o $@' DSO_CFLAGS=-fPIC DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)' _OPTIMIZE_FLAGS=-O2 @@ -4141,11 +4213,31 @@ EOF DLL_SUFFIX=dll # Determine compiler version - CC_VERSION=`"${CC}" -v 2>&1 | grep Version | sed -e 's|.* Version ||' -e 's| .*||'` - _CC_MAJOR_VERSION=`echo $CC_VERSION | awk -F\. '{ print $1 }'` - _CC_MINOR_VERSION=`echo $CC_VERSION | awk -F\. '{ print $2 }'` + + _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p' + + + CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"` + _CC_MAJOR_VERSION=`echo ${CC_VERSION} | awk -F\. '{ print $1 }'` + _CC_MINOR_VERSION=`echo ${CC_VERSION} | awk -F\. '{ print $2 }'` + _CC_RELEASE=`echo ${CC_VERSION} | awk -F\. '{ print $3 }'` + _CC_BUILD=`echo ${CC_VERSION} | awk -F\. '{ print $4 }'` MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION} + if test "$_CC_MAJOR_VERSION" = "14"; then + if test $_CC_RELEASE -gt 50727; then + _USE_DYNAMICBASE=1 + elif test $_CC_BUILD -ge 762; then + _USE_DYNAMICBASE=1 + fi + elif test $_CC_MAJOR_VERSION -gt 15; then + _USE_DYNAMICBASE=1 + fi + + if test -n "$_USE_DYNAMICBASE"; then + DLLFLAGS="$DLLFLAGS -DYNAMICBASE" + fi + # Ensure that mt is Microsoft (R) Manifest Tool and not magnetic # tape manipulation utility (or something else) if test "$MSC_VER" -ge "1400"; then @@ -4170,6 +4262,12 @@ EOF DLLFLAGS="$DLLFLAGS -OUT:\"\$@\"" _DEBUG_FLAGS=-Zi _OPTIMIZE_FLAGS=-O2 + + PROFILE_GEN_CFLAGS="-GL" + PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT" + PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952" + PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE" + if test -z "$MOZ_OPTIMIZE"; then CFLAGS="$CFLAGS -Od" fi @@ -4611,17 +4709,17 @@ EOF _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000" ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for machine/builtins.h""... $ac_c" 1>&6 -echo "configure:4615: checking for machine/builtins.h" >&5 +echo "configure:4713: checking for machine/builtins.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4625: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4723: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5270,7 +5368,7 @@ case $target in ;; *) echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:5274: checking for dlopen in -ldl" >&5 +echo "configure:5372: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5278,7 +5376,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5306,17 +5404,17 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6 -echo "configure:5310: checking for dlfcn.h" >&5 +echo "configure:5408: checking for dlfcn.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5320: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5418: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5349,13 +5447,13 @@ esac if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:5353: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:5451: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext < Autoconf TIOCGETP @@ -5373,7 +5471,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext < Autoconf TCGETA @@ -5397,12 +5495,12 @@ fi for ac_func in lchown strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5401: checking for $ac_func" >&5 +echo "configure:5499: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5527: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5466,7 +5564,7 @@ hpux*) if test -z "$GNU_CC"; then echo $ac_n "checking for +Olit support""... $ac_c" 1>&6 -echo "configure:5470: checking for +Olit support" >&5 +echo "configure:5568: checking for +Olit support" >&5 if eval "test \"`echo '$''{'ac_cv_hpux_usable_olit_option'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5508,7 +5606,7 @@ wince*) *) echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6 -echo "configure:5512: checking for pthread_create in -lpthreads" >&5 +echo "configure:5610: checking for pthread_create in -lpthreads" >&5 echo " #include void *foo(void *v) { return v; } @@ -5530,7 +5628,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:5534: checking for pthread_create in -lpthread" >&5 +echo "configure:5632: checking for pthread_create in -lpthread" >&5 echo " #include void *foo(void *v) { return v; } @@ -5552,7 +5650,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6 -echo "configure:5556: checking for pthread_create in -lc_r" >&5 +echo "configure:5654: checking for pthread_create in -lc_r" >&5 echo " #include void *foo(void *v) { return v; } @@ -5574,7 +5672,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6 -echo "configure:5578: checking for pthread_create in -lc" >&5 +echo "configure:5676: checking for pthread_create in -lc" >&5 echo " #include void *foo(void *v) { return v; } @@ -5706,7 +5804,7 @@ if test -n "$USE_PTHREADS"; then rm -f conftest* ac_cv_have_dash_pthread=no echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6 -echo "configure:5710: checking whether ${CC-cc} accepts -pthread" >&5 +echo "configure:5808: checking whether ${CC-cc} accepts -pthread" >&5 echo 'int main() { return 0; }' | cat > conftest.c ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1 if test $? -eq 0; then @@ -5729,7 +5827,7 @@ echo "configure:5710: checking whether ${CC-cc} accepts -pthread" >&5 ac_cv_have_dash_pthreads=no if test "$ac_cv_have_dash_pthread" = "no"; then echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6 -echo "configure:5733: checking whether ${CC-cc} accepts -pthreads" >&5 +echo "configure:5831: checking whether ${CC-cc} accepts -pthreads" >&5 echo 'int main() { return 0; }' | cat > conftest.c ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1 if test $? -eq 0; then @@ -6042,6 +6140,38 @@ cygwin*|msvc*|mks*) ;; esac +# Check whether --enable-wrap-malloc or --disable-wrap-malloc was given. +if test "${enable_wrap_malloc+set}" = set; then + enableval="$enable_wrap_malloc" + if test "$enableval" = "yes"; then + _WRAP_MALLOC=1 + fi +fi + + +if test -n "$_WRAP_MALLOC"; then + if test "$GNU_CC"; then + WRAP_MALLOC_CFLAGS="${LDFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,calloc -Wl,--wrap -Wl,valloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -Wl,--wrap -Wl,memalign -Wl,--wrap -Wl,__builtin_new -Wl,--wrap -Wl,__builtin_vec_new -Wl,--wrap -Wl,__builtin_delete -Wl,--wrap -Wl,__builtin_vec_delete -Wl,--wrap -Wl,PR_Free -Wl,--wrap -Wl,PR_Malloc -Wl,--wrap -Wl,PR_Calloc -Wl,--wrap -Wl,PR_Realloc -Wl,--wrap -Wl,strdup -Wl,--wrap -Wl,strndup -Wl,--wrap -Wl,posix_memalign" + DSO_LDOPTS="$DSO_LDOPTS $WRAP_MALLOC_CFLAGS" + else + { echo "configure: error: --enable-wrap-malloc is not supported for non-GNU toolchains" 1>&2; exit 1; } + fi +fi + +# Check whether --with-wrap-malloc or --without-wrap-malloc was given. +if test "${with_wrap_malloc+set}" = set; then + withval="$with_wrap_malloc" + WRAP_MALLOC_LIB=$withval +fi + + + + + + + + + @@ -6404,6 +6534,8 @@ s%@OBJ_SUFFIX@%$OBJ_SUFFIX%g s%@LIB_SUFFIX@%$LIB_SUFFIX%g s%@DLL_SUFFIX@%$DLL_SUFFIX%g s%@ASM_SUFFIX@%$ASM_SUFFIX%g +s%@WRAP_MALLOC_CFLAGS@%$WRAP_MALLOC_CFLAGS%g +s%@WRAP_MALLOC_LIB@%$WRAP_MALLOC_LIB%g s%@MKSHLIB@%$MKSHLIB%g s%@DSO_CFLAGS@%$DSO_CFLAGS%g s%@DSO_LDOPTS@%$DSO_LDOPTS%g @@ -6417,6 +6549,10 @@ s%@AR_FLAGS@%$AR_FLAGS%g s%@ASFLAGS@%$ASFLAGS%g s%@FILTER@%$FILTER%g s%@IMPLIB@%$IMPLIB%g +s%@PROFILE_GEN_CFLAGS@%$PROFILE_GEN_CFLAGS%g +s%@PROFILE_GEN_LDFLAGS@%$PROFILE_GEN_LDFLAGS%g +s%@PROFILE_USE_CFLAGS@%$PROFILE_USE_CFLAGS%g +s%@PROFILE_USE_LDFLAGS@%$PROFILE_USE_LDFLAGS%g s%@OS_LIBS@%$OS_LIBS%g s%@RESOLVE_LINK_SYMBOLS@%$RESOLVE_LINK_SYMBOLS%g s%@AIX_LINK_OPTS@%$AIX_LINK_OPTS%g diff --git a/nsprpub/configure.in b/nsprpub/configure.in index e7603374e53..5adfcc5fa83 100644 --- a/nsprpub/configure.in +++ b/nsprpub/configure.in @@ -78,6 +78,11 @@ MACOS_SDK_DIR= NEXT_ROOT= MT= MOZ_OS2_HIGH_MEMORY=1 +MOZ_THUMB2= +PROFILE_GEN_CFLAGS= +PROFILE_GEN_LDFLAGS= +PROFILE_USE_CFLAGS= +PROFILE_USE_LDFLAGS= dnl Link in libraries necessary to resolve all symbols for shared libs RESOLVE_LINK_SYMBOLS= @@ -171,8 +176,8 @@ if test "$target" = "arm-android-eabi" ; then STRIP="$android_toolchain"/bin/arm-eabi-strip CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS" - CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork $CFLAGS" - CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fpic -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork -mthumb $CXXFLAGS" + CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions $CFLAGS" + CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fpic -fno-short-enums -fno-exceptions $CXXFLAGS" LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform $LDFLAGS" dnl prevent cross compile section from using these flags as host flags @@ -637,6 +642,29 @@ else AC_MSG_RESULT([no]) fi +dnl ======================================================== +dnl Profile guided optimization +dnl ======================================================== +dnl Test for profiling options +dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use + +_SAVE_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction" + +AC_MSG_CHECKING([whether C compiler supports -fprofile-generate]) +AC_TRY_COMPILE([], [return 0;], + [ PROFILE_GEN_CFLAGS="-fprofile-generate" + result="yes" ], result="no") +AC_MSG_RESULT([$result]) + +if test $result = "yes"; then + PROFILE_GEN_LDFLAGS="-fprofile-generate" + PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch -freoder-blocks-and-partition" + PROFILE_USE_LDFLAGS="-fprofile-use" +fi + +CFLAGS="$_SAVE_CFLAGS" + dnl =============================================================== dnl Check for .hidden assembler directive and visibility attribute. dnl Borrowed from glibc configure.in @@ -880,6 +908,32 @@ AC_ARG_ENABLE(os2-high-mem, MOZ_OS2_HIGH_MEMORY=1 fi ]) +dnl ======================================================== +dnl = Enable building the Thumb2 instruction set +dnl ======================================================== +AC_ARG_ENABLE(thumb2, + [ --enable-thumb2 Enable Thumb2 instruction set], + [ if test "$enableval" = "yes"; then + MOZ_THUMB2=1, + fi ]) + +if test -n "$MOZ_THUMB2"; then + case "$target_cpu" in + arm*) + if test "$GNU_CC"; then + CFLAGS="$CFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb" + CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb" + ASFLAGS="$ASFLAGS -march=armv7-a -mthumb" + else + AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains]) + fi + ;; + *) + AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures]) + ;; + esac +fi + dnl ======================================================== dnl Override of system specific host options dnl ======================================================== @@ -1506,7 +1560,7 @@ arm-android-eabi) CXXFLAGS="$CXXFLAGS -Wall" MDCPUCFG_H=_linux.cfg PR_MD_CSRCS=linux.c - MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@' + MKSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_LIB) -o $@' DSO_CFLAGS=-fPIC DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)' _OPTIMIZE_FLAGS=-O2 @@ -1537,7 +1591,7 @@ arm-android-eabi) CXXFLAGS="$CXXFLAGS -Wall" MDCPUCFG_H=_linux.cfg PR_MD_CSRCS=linux.c - MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@' + MKSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_LIB) -o $@' DSO_CFLAGS=-fPIC DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)' _OPTIMIZE_FLAGS=-O2 @@ -1623,11 +1677,34 @@ arm-android-eabi) DLL_SUFFIX=dll # Determine compiler version - CC_VERSION=`"${CC}" -v 2>&1 | grep Version | sed -e 's|.* Version ||' -e 's| .*||'` - _CC_MAJOR_VERSION=`echo $CC_VERSION | awk -F\. '{ print $1 }'` - _CC_MINOR_VERSION=`echo $CC_VERSION | awk -F\. '{ print $2 }'` + changequote(,) + _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p' + changequote([,]) + + CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"` + _CC_MAJOR_VERSION=`echo ${CC_VERSION} | awk -F\. '{ print $1 }'` + _CC_MINOR_VERSION=`echo ${CC_VERSION} | awk -F\. '{ print $2 }'` + _CC_RELEASE=`echo ${CC_VERSION} | awk -F\. '{ print $3 }'` + _CC_BUILD=`echo ${CC_VERSION} | awk -F\. '{ print $4 }'` MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION} + if test "$_CC_MAJOR_VERSION" = "14"; then + dnl -DYNAMICBASE is only supported on VC8SP1 or newer, + dnl so be very specific here! + dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762 + if test $_CC_RELEASE -gt 50727; then + _USE_DYNAMICBASE=1 + elif test $_CC_BUILD -ge 762; then + _USE_DYNAMICBASE=1 + fi + elif test $_CC_MAJOR_VERSION -gt 15; then + _USE_DYNAMICBASE=1 + fi + + if test -n "$_USE_DYNAMICBASE"; then + DLLFLAGS="$DLLFLAGS -DYNAMICBASE" + fi + # Ensure that mt is Microsoft (R) Manifest Tool and not magnetic # tape manipulation utility (or something else) if test "$MSC_VER" -ge "1400"; then @@ -1652,6 +1729,12 @@ arm-android-eabi) DLLFLAGS="$DLLFLAGS -OUT:\"\$@\"" _DEBUG_FLAGS=-Zi _OPTIMIZE_FLAGS=-O2 + + PROFILE_GEN_CFLAGS="-GL" + PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT" + PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952" + PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE" + if test -z "$MOZ_OPTIMIZE"; then CFLAGS="$CFLAGS -Od" fi @@ -2859,6 +2942,31 @@ cygwin*|msvc*|mks*) ;; esac +dnl ======================================================== +dnl = Use malloc wrapper lib +dnl ======================================================== +AC_ARG_ENABLE(wrap-malloc, +[ --enable-wrap-malloc Wrap malloc calls (gnu linker only)], +[ if test "$enableval" = "yes"; then + _WRAP_MALLOC=1 + fi ]) + +if test -n "$_WRAP_MALLOC"; then + if test "$GNU_CC"; then + WRAP_MALLOC_CFLAGS="${LDFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,calloc -Wl,--wrap -Wl,valloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -Wl,--wrap -Wl,memalign -Wl,--wrap -Wl,__builtin_new -Wl,--wrap -Wl,__builtin_vec_new -Wl,--wrap -Wl,__builtin_delete -Wl,--wrap -Wl,__builtin_vec_delete -Wl,--wrap -Wl,PR_Free -Wl,--wrap -Wl,PR_Malloc -Wl,--wrap -Wl,PR_Calloc -Wl,--wrap -Wl,PR_Realloc -Wl,--wrap -Wl,strdup -Wl,--wrap -Wl,strndup -Wl,--wrap -Wl,posix_memalign" + DSO_LDOPTS="$DSO_LDOPTS $WRAP_MALLOC_CFLAGS" + else + AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains]) + fi +fi + +dnl ======================================================== +dnl = Location of malloc wrapper lib +dnl ======================================================== +AC_ARG_WITH(wrap-malloc, +[ --with-wrap-malloc=SHAREDLIB Location of malloc wrapper library], + WRAP_MALLOC_LIB=$withval) + dnl ======================================================== dnl Substitution of found variables. dnl ======================================================== @@ -2913,6 +3021,8 @@ AC_SUBST(OBJ_SUFFIX) AC_SUBST(LIB_SUFFIX) AC_SUBST(DLL_SUFFIX) AC_SUBST(ASM_SUFFIX) +AC_SUBST(WRAP_MALLOC_CFLAGS) +AC_SUBST(WRAP_MALLOC_LIB) AC_SUBST(MKSHLIB) AC_SUBST(DSO_CFLAGS) AC_SUBST(DSO_LDOPTS) @@ -2936,6 +3046,11 @@ AC_SUBST(STRIP) AC_SUBST(FILTER) AC_SUBST(IMPLIB) +AC_SUBST(PROFILE_GEN_CFLAGS) +AC_SUBST(PROFILE_GEN_LDFLAGS) +AC_SUBST(PROFILE_USE_CFLAGS) +AC_SUBST(PROFILE_USE_LDFLAGS) + AC_SUBST(OS_LIBS) AC_SUBST(RESOLVE_LINK_SYMBOLS) AC_SUBST(AIX_LINK_OPTS) diff --git a/nsprpub/lib/libc/include/plgetopt.h b/nsprpub/lib/libc/include/plgetopt.h index fcdf23b6fc7..c59fabdf6f9 100644 --- a/nsprpub/lib/libc/include/plgetopt.h +++ b/nsprpub/lib/libc/include/plgetopt.h @@ -122,13 +122,14 @@ PR_EXTERN(void) PL_DestroyOptState(PLOptState *opt); * For a long option name, * - opt->longOptIndex will contain the non-negative index of the * PLLongOpt structure in the caller's array of PLLongOpt structures - 8 corresponding to the long option name, and + * corresponding to the long option name, and * For a single-character or long option, * - opt->longOption will contain the value of the single-character option * name, or the value of the longOption from the PLLongOpt structure * for that long option. See notes below. * - opt->value will point to the argument option string, or will - * be NULL if no argument option string was given. + * be NULL if option does not require argument. If option requires + * argument but it is not provided, PL_OPT_BAD is returned. * When opt->option is non-zero, * - opt->longOptIndex will be -1 * When this function returns PL_OPT_EOL, or PL_OPT_BAD, the contents of diff --git a/nsprpub/lib/libc/src/plgetopt.c b/nsprpub/lib/libc/src/plgetopt.c index 0fe4fafe5ba..2cd4896dad2 100644 --- a/nsprpub/lib/libc/src/plgetopt.c +++ b/nsprpub/lib/libc/src/plgetopt.c @@ -177,13 +177,13 @@ PR_IMPLEMENT(PLOptStatus) PL_GetNextOpt(PLOptState *opt) ** option. See if we can find a match in the list of possible ** options supplied. */ - if (internal->minus == 2) { char * foundEqual = strchr(internal->xargv,'='); PRIntn optNameLen = foundEqual ? (foundEqual - internal->xargv) : strlen(internal->xargv); const PLLongOpt *longOpt = internal->longOpts; + PLOptStatus result = PL_OPT_BAD; opt->option = 0; opt->value = NULL; @@ -197,19 +197,31 @@ PR_IMPLEMENT(PLOptStatus) PL_GetNextOpt(PLOptState *opt) /* option name match */ opt->longOptIndex = longOpt - internal->longOpts; opt->longOption = longOpt->longOption; + /* value is part of the current argv[] element if = was found */ + /* note: this sets value even for long options that do not + * require option if specified as --long=value */ if (foundEqual) { - opt->value = foundEqual[1] ? foundEqual + 1 : NULL; + opt->value = foundEqual + 1; } else if (longOpt->valueRequired) { - opt->value = internal->argv[++(internal->xargc)]; + /* value is the next argv[] element, if any */ + if (internal->xargc + 1 < internal->argc) + { + opt->value = internal->argv[++(internal->xargc)]; + } + /* missing value */ + else + { + break; /* return PL_OPT_BAD */ + } } - internal->xargv = &static_Nul; /* consume this */ - return PL_OPT_OK; + result = PL_OPT_OK; + break; } internal->xargv = &static_Nul; /* consume this */ - return PL_OPT_BAD; + return result; } if (internal->minus) { @@ -223,14 +235,27 @@ PR_IMPLEMENT(PLOptStatus) PL_GetNextOpt(PLOptState *opt) opt->longOption = opt->option & 0xff; /* ** if options indicates that there's an associated - ** value, this argv is finished and the next is the - ** option's value. + ** value, it must be provided, either as part of this + ** argv[] element or as the next one */ if (':' == internal->options[cop + 1]) { - if (0 != *internal->xargv) + /* value is part of the current argv[] element */ + if (0 != *internal->xargv) + { + opt->value = internal->xargv; + } + /* value is the next argv[] element, if any */ + else if (internal->xargc + 1 < internal->argc) + { + opt->value = internal->argv[++(internal->xargc)]; + } + /* missing value */ + else + { return PL_OPT_BAD; - opt->value = internal->argv[++(internal->xargc)]; + } + internal->xargv = &static_Nul; internal->minus = 0; } @@ -242,6 +267,7 @@ PR_IMPLEMENT(PLOptStatus) PL_GetNextOpt(PLOptState *opt) internal->xargv += 1; /* consume that option */ return PL_OPT_BAD; } + /* ** No '-', so it must be a standalone value. The option is nul. */ diff --git a/nsprpub/pr/include/md/_openbsd.h b/nsprpub/pr/include/md/_openbsd.h index 8719fe7802b..8dd44099f7d 100644 --- a/nsprpub/pr/include/md/_openbsd.h +++ b/nsprpub/pr/include/md/_openbsd.h @@ -69,7 +69,7 @@ #define HAVE_DLL #define USE_DLFCN #define _PR_HAVE_SOCKADDR_LEN -#define _PR_NO_LARGE_FILES +#define _PR_HAVE_LARGE_OFF_T #define _PR_STAT_HAS_ST_ATIMESPEC #define _PR_POLL_AVAILABLE #define _PR_USE_POLL diff --git a/nsprpub/pr/include/md/_pth.h b/nsprpub/pr/include/md/_pth.h index c4cb30abdf2..66a4c07e755 100644 --- a/nsprpub/pr/include/md/_pth.h +++ b/nsprpub/pr/include/md/_pth.h @@ -98,8 +98,14 @@ #else #define _PT_PTHREAD_MUTEX_IS_LOCKED(m) (EBUSY == pthread_mutex_trylock(&(m))) #endif +#if defined(ANDROID) +/* Conditional attribute init and destroy aren't implemented in bionic. */ +#define _PT_PTHREAD_CONDATTR_INIT(x) 0 +#define _PT_PTHREAD_CONDATTR_DESTROY(x) /* */ +#else #define _PT_PTHREAD_CONDATTR_INIT pthread_condattr_init #define _PT_PTHREAD_CONDATTR_DESTROY pthread_condattr_destroy +#endif #define _PT_PTHREAD_COND_INIT(m, a) pthread_cond_init(&(m), &(a)) #endif diff --git a/nsprpub/pr/include/md/_winnt.h b/nsprpub/pr/include/md/_winnt.h index c76b278e7ec..628fe959cb4 100644 --- a/nsprpub/pr/include/md/_winnt.h +++ b/nsprpub/pr/include/md/_winnt.h @@ -42,10 +42,10 @@ ** setting _WIN32_WINNT to NT 4.0 for winsock.h, winbase.h, winnt.h. */ #ifndef _WIN32_WINNT - #define _WIN32_WINNT 0x0403 -#elif (_WIN32_WINNT < 0x0403) + #define _WIN32_WINNT 0x0400 +#elif (_WIN32_WINNT < 0x0400) #undef _WIN32_WINNT - #define _WIN32_WINNT 0x0403 + #define _WIN32_WINNT 0x0400 #endif /* _WIN32_WINNT */ #include diff --git a/nsprpub/pr/include/pratom.h b/nsprpub/pr/include/pratom.h index 1c18a9f1e3f..9e90ad48fb7 100644 --- a/nsprpub/pr/include/pratom.h +++ b/nsprpub/pr/include/pratom.h @@ -125,10 +125,12 @@ long __cdecl _InterlockedExchange(long volatile *Target, long Value); long __cdecl _InterlockedExchangeAdd(long volatile *Addend, long Value); #pragma intrinsic(_InterlockedExchangeAdd) -#define PR_ATOMIC_INCREMENT(val) _InterlockedIncrement(val) -#define PR_ATOMIC_DECREMENT(val) _InterlockedDecrement(val) -#define PR_ATOMIC_SET(val, newval) _InterlockedExchange(val, newval) -#define PR_ATOMIC_ADD(ptr, val) (_InterlockedExchangeAdd(ptr, val) + (val)) +#define PR_ATOMIC_INCREMENT(val) _InterlockedIncrement((long volatile *)val) +#define PR_ATOMIC_DECREMENT(val) _InterlockedDecrement((long volatile *)val) +#define PR_ATOMIC_SET(val, newval) \ + _InterlockedExchange((long volatile *)val, (long)newval) +#define PR_ATOMIC_ADD(ptr, val) \ + (_InterlockedExchangeAdd((long volatile *)ptr, (long)val) + (val)) #elif ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && \ ((defined(DARWIN) && \ diff --git a/nsprpub/pr/src/md/unix/os_Darwin_ppc.s b/nsprpub/pr/src/md/unix/os_Darwin_ppc.s index 4b61fb4f3bb..905ba9fbde5 100644 --- a/nsprpub/pr/src/md/unix/os_Darwin_ppc.s +++ b/nsprpub/pr/src/md/unix/os_Darwin_ppc.s @@ -49,6 +49,7 @@ # .align 2 .globl __PR_DarwinPPC_AtomicIncrement + .private_extern __PR_DarwinPPC_AtomicIncrement __PR_DarwinPPC_AtomicIncrement: lwarx r4,0,r3 addi r0,r4,1 @@ -62,6 +63,7 @@ __PR_DarwinPPC_AtomicIncrement: # .align 2 .globl __PR_DarwinPPC_AtomicDecrement + .private_extern __PR_DarwinPPC_AtomicDecrement __PR_DarwinPPC_AtomicDecrement: lwarx r4,0,r3 addi r0,r4,-1 @@ -75,6 +77,7 @@ __PR_DarwinPPC_AtomicDecrement: # .align 2 .globl __PR_DarwinPPC_AtomicSet + .private_extern __PR_DarwinPPC_AtomicSet __PR_DarwinPPC_AtomicSet: lwarx r5,0,r3 stwcx. r4,0,r3 @@ -87,6 +90,7 @@ __PR_DarwinPPC_AtomicSet: # .align 2 .globl __PR_DarwinPPC_AtomicAdd + .private_extern __PR_DarwinPPC_AtomicAdd __PR_DarwinPPC_AtomicAdd: lwarx r5,0,r3 add r0,r4,r5 diff --git a/nsprpub/pr/src/md/unix/os_Darwin_x86.s b/nsprpub/pr/src/md/unix/os_Darwin_x86.s index 276b16e032a..1c7ef8c1cc1 100644 --- a/nsprpub/pr/src/md/unix/os_Darwin_x86.s +++ b/nsprpub/pr/src/md/unix/os_Darwin_x86.s @@ -49,6 +49,7 @@ # .text .globl __PR_Darwin_x86_AtomicIncrement + .private_extern __PR_Darwin_x86_AtomicIncrement .align 4 __PR_Darwin_x86_AtomicIncrement: movl 4(%esp), %ecx @@ -66,6 +67,7 @@ __PR_Darwin_x86_AtomicIncrement: # .text .globl __PR_Darwin_x86_AtomicDecrement + .private_extern __PR_Darwin_x86_AtomicDecrement .align 4 __PR_Darwin_x86_AtomicDecrement: movl 4(%esp), %ecx @@ -83,6 +85,7 @@ __PR_Darwin_x86_AtomicDecrement: # .text .globl __PR_Darwin_x86_AtomicSet + .private_extern __PR_Darwin_x86_AtomicSet .align 4 __PR_Darwin_x86_AtomicSet: movl 4(%esp), %ecx @@ -98,6 +101,7 @@ __PR_Darwin_x86_AtomicSet: # .text .globl __PR_Darwin_x86_AtomicAdd + .private_extern __PR_Darwin_x86_AtomicAdd .align 4 __PR_Darwin_x86_AtomicAdd: movl 4(%esp), %ecx diff --git a/nsprpub/pr/src/md/unix/os_Darwin_x86_64.s b/nsprpub/pr/src/md/unix/os_Darwin_x86_64.s index 031186f5258..ce415435bd9 100644 --- a/nsprpub/pr/src/md/unix/os_Darwin_x86_64.s +++ b/nsprpub/pr/src/md/unix/os_Darwin_x86_64.s @@ -43,6 +43,7 @@ # .text .globl __PR_Darwin_x86_64_AtomicIncrement + .private_extern __PR_Darwin_x86_64_AtomicIncrement .align 4 __PR_Darwin_x86_64_AtomicIncrement: movl $1, %eax @@ -58,6 +59,7 @@ __PR_Darwin_x86_64_AtomicIncrement: # .text .globl __PR_Darwin_x86_64_AtomicDecrement + .private_extern __PR_Darwin_x86_64_AtomicDecrement .align 4 __PR_Darwin_x86_64_AtomicDecrement: movl $-1, %eax @@ -73,6 +75,7 @@ __PR_Darwin_x86_64_AtomicDecrement: # .text .globl __PR_Darwin_x86_64_AtomicSet + .private_extern __PR_Darwin_x86_64_AtomicSet .align 4 __PR_Darwin_x86_64_AtomicSet: movl %esi, %eax @@ -86,6 +89,7 @@ __PR_Darwin_x86_64_AtomicSet: # .text .globl __PR_Darwin_x86_64_AtomicAdd + .private_extern __PR_Darwin_x86_64_AtomicAdd .align 4 __PR_Darwin_x86_64_AtomicAdd: movl %esi, %eax diff --git a/nsprpub/pr/src/md/unix/os_HPUX.s b/nsprpub/pr/src/md/unix/os_HPUX.s index ef07db03252..a3bac2577c7 100644 --- a/nsprpub/pr/src/md/unix/os_HPUX.s +++ b/nsprpub/pr/src/md/unix/os_HPUX.s @@ -49,10 +49,9 @@ ret_cr16 .PROC .CALLINFO FRAME=0, NO_CALLS .EXPORT ret_cr16,ENTRY - .ENTER -; BV %r0(%rp) - BV 0(%rp) + .ENTRY + BV %r0(%rp) + .EXIT MFCTL %cr16,%ret0 - .LEAVE .PROCEND .END diff --git a/nsprpub/pr/src/md/unix/os_Linux_x86_64.s b/nsprpub/pr/src/md/unix/os_Linux_x86_64.s index 1a7b24a8005..8de045742a0 100644 --- a/nsprpub/pr/src/md/unix/os_Linux_x86_64.s +++ b/nsprpub/pr/src/md/unix/os_Linux_x86_64.s @@ -43,6 +43,7 @@ / .text .globl _PR_x86_64_AtomicIncrement + .type _PR_x86_64_AtomicIncrement, @function .align 4 _PR_x86_64_AtomicIncrement: movl $1, %eax @@ -50,6 +51,7 @@ _PR_x86_64_AtomicIncrement: xaddl %eax, (%rdi) incl %eax ret + .size _PR_x86_64_AtomicIncrement, .-_PR_x86_64_AtomicIncrement / PRInt32 _PR_x86_64_AtomicDecrement(PRInt32 *val) / @@ -58,6 +60,7 @@ _PR_x86_64_AtomicIncrement: / .text .globl _PR_x86_64_AtomicDecrement + .type _PR_x86_64_AtomicDecrement, @function .align 4 _PR_x86_64_AtomicDecrement: movl $-1, %eax @@ -65,6 +68,7 @@ _PR_x86_64_AtomicDecrement: xaddl %eax, (%rdi) decl %eax ret + .size _PR_x86_64_AtomicDecrement, .-_PR_x86_64_AtomicDecrement / PRInt32 _PR_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval) / @@ -73,11 +77,13 @@ _PR_x86_64_AtomicDecrement: / .text .globl _PR_x86_64_AtomicSet + .type _PR_x86_64_AtomicSet, @function .align 4 _PR_x86_64_AtomicSet: movl %esi, %eax xchgl %eax, (%rdi) ret + .size _PR_x86_64_AtomicSet, .-_PR_x86_64_AtomicSet / PRInt32 _PR_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val) / @@ -86,6 +92,7 @@ _PR_x86_64_AtomicSet: / .text .globl _PR_x86_64_AtomicAdd + .type _PR_x86_64_AtomicAdd, @function .align 4 _PR_x86_64_AtomicAdd: movl %esi, %eax @@ -93,6 +100,7 @@ _PR_x86_64_AtomicAdd: xaddl %eax, (%rdi) addl %esi, %eax ret + .size _PR_x86_64_AtomicAdd, .-_PR_x86_64_AtomicAdd / Magic indicating no need for an executable stack .section .note.GNU-stack, "", @progbits ; .previous diff --git a/nsprpub/pr/src/md/unix/uxrng.c b/nsprpub/pr/src/md/unix/uxrng.c index cafd928a3b5..d46f4475e22 100644 --- a/nsprpub/pr/src/md/unix/uxrng.c +++ b/nsprpub/pr/src/md/unix/uxrng.c @@ -75,7 +75,11 @@ GetHighResClock(void *buf, size_t maxbytes) { PRUint64 t; +#ifdef __GNUC__ + __asm__ __volatile__("mov %0 = ar.itc" : "=r" (t)); +#else t = _Asm_mov_from_ar(_AREG44); +#endif return _pr_CopyLowBits(buf, maxbytes, &t, sizeof(t)); } #else diff --git a/nsprpub/pr/src/misc/prinit.c b/nsprpub/pr/src/misc/prinit.c index 7071e0a04ad..e419e8916c0 100644 --- a/nsprpub/pr/src/misc/prinit.c +++ b/nsprpub/pr/src/misc/prinit.c @@ -803,7 +803,7 @@ PR_IMPLEMENT(PRStatus) PR_CallOnce( if (!_pr_initialized) _PR_ImplicitInitialization(); if (!once->initialized) { - if (PR_AtomicSet(&once->inProgress, 1) == 0) { + if (PR_ATOMIC_SET(&once->inProgress, 1) == 0) { once->status = (*func)(); PR_Lock(mod_init.ml); once->initialized = 1; @@ -832,7 +832,7 @@ PR_IMPLEMENT(PRStatus) PR_CallOnceWithArg( if (!_pr_initialized) _PR_ImplicitInitialization(); if (!once->initialized) { - if (PR_AtomicSet(&once->inProgress, 1) == 0) { + if (PR_ATOMIC_SET(&once->inProgress, 1) == 0) { once->status = (*func)(arg); PR_Lock(mod_init.ml); once->initialized = 1; diff --git a/nsprpub/pr/src/misc/prsystem.c b/nsprpub/pr/src/misc/prsystem.c index 1996468f877..098de02f45a 100644 --- a/nsprpub/pr/src/misc/prsystem.c +++ b/nsprpub/pr/src/misc/prsystem.c @@ -284,6 +284,20 @@ PR_IMPLEMENT(PRUint64) PR_GetPhysicalMemorySize(void) long pageCount = sysconf(_SC_PHYS_PAGES); bytes = (PRUint64) pageSize * pageCount; +#elif defined(NETBSD) + + int mib[2]; + int rc; + uint64_t memSize; + size_t len = sizeof(memSize); + + mib[0] = CTL_HW; + mib[1] = HW_PHYSMEM64; + rc = sysctl(mib, 2, &memSize, &len, NULL, 0); + if (-1 != rc) { + bytes = memSize; + } + #elif defined(HPUX) struct pst_static info; diff --git a/nsprpub/pr/src/pthreads/ptsynch.c b/nsprpub/pr/src/pthreads/ptsynch.c index 3f3b2720136..f90917e14b8 100644 --- a/nsprpub/pr/src/pthreads/ptsynch.c +++ b/nsprpub/pr/src/pthreads/ptsynch.c @@ -148,13 +148,13 @@ static void pt_PostNotifies(PRLock *lock, PRBool unlock) } #if defined(DEBUG) pt_debug.cvars_notified += 1; - if (0 > PR_AtomicDecrement(&cv->notify_pending)) + if (0 > PR_ATOMIC_DECREMENT(&cv->notify_pending)) { pt_debug.delayed_cv_deletes += 1; PR_DestroyCondVar(cv); } #else /* defined(DEBUG) */ - if (0 > PR_AtomicDecrement(&cv->notify_pending)) + if (0 > PR_ATOMIC_DECREMENT(&cv->notify_pending)) PR_DestroyCondVar(cv); #endif /* defined(DEBUG) */ } @@ -338,7 +338,7 @@ static void pt_PostNotifyToCvar(PRCondVar *cvar, PRBool broadcast) } /* A brand new entry in the array */ - (void)PR_AtomicIncrement(&cvar->notify_pending); + (void)PR_ATOMIC_INCREMENT(&cvar->notify_pending); notified->cv[index].times = (broadcast) ? -1 : 1; notified->cv[index].cv = cvar; notified->length += 1; @@ -367,7 +367,7 @@ PR_IMPLEMENT(PRCondVar*) PR_NewCondVar(PRLock *lock) PR_IMPLEMENT(void) PR_DestroyCondVar(PRCondVar *cvar) { - if (0 > PR_AtomicDecrement(&cvar->notify_pending)) + if (0 > PR_ATOMIC_DECREMENT(&cvar->notify_pending)) { PRIntn rv = pthread_cond_destroy(&cvar->cv); PR_ASSERT(0 == rv); #if defined(DEBUG) diff --git a/nsprpub/pr/src/pthreads/ptthread.c b/nsprpub/pr/src/pthreads/ptthread.c index 45afdac4f8b..b28dc07f378 100644 --- a/nsprpub/pr/src/pthreads/ptthread.c +++ b/nsprpub/pr/src/pthreads/ptthread.c @@ -752,10 +752,10 @@ PR_IMPLEMENT(PRStatus) PR_Interrupt(PRThread *thred) if ((NULL != cv) && !thred->interrupt_blocked) { PRIntn rv; - (void)PR_AtomicIncrement(&cv->notify_pending); + (void)PR_ATOMIC_INCREMENT(&cv->notify_pending); rv = pthread_cond_broadcast(&cv->cv); PR_ASSERT(0 == rv); - if (0 > PR_AtomicDecrement(&cv->notify_pending)) + if (0 > PR_ATOMIC_DECREMENT(&cv->notify_pending)) PR_DestroyCondVar(cv); } return PR_SUCCESS; diff --git a/nsprpub/pr/src/threads/combined/pruthr.c b/nsprpub/pr/src/threads/combined/pruthr.c index 9609d4d97dc..86c8276ea6f 100644 --- a/nsprpub/pr/src/threads/combined/pruthr.c +++ b/nsprpub/pr/src/threads/combined/pruthr.c @@ -1165,9 +1165,9 @@ PR_IMPLEMENT(PRThread*) _PR_CreateThread(PRThreadType type, if (type == PR_SYSTEM_THREAD) { thread->flags |= _PR_SYSTEM; - PR_AtomicIncrement(&_pr_systemActive); + PR_ATOMIC_INCREMENT(&_pr_systemActive); } - else PR_AtomicIncrement(&_pr_userActive); + else PR_ATOMIC_INCREMENT(&_pr_userActive); if (state == PR_JOINABLE_THREAD) { if (!thread->term) diff --git a/nsprpub/pr/src/threads/prtpd.c b/nsprpub/pr/src/threads/prtpd.c index 168c6601887..5c53313580e 100644 --- a/nsprpub/pr/src/threads/prtpd.c +++ b/nsprpub/pr/src/threads/prtpd.c @@ -137,7 +137,7 @@ PR_IMPLEMENT(PRStatus) PR_NewThreadPrivateIndex( PR_ASSERT(NULL != newIndex); PR_ASSERT(NULL != _pr_tpd_destructors); - index = PR_AtomicIncrement(&_pr_tpd_highwater) - 1; /* allocate index */ + index = PR_ATOMIC_INCREMENT(&_pr_tpd_highwater) - 1; /* allocate index */ if (_PR_TPD_LIMIT <= index) { PR_SetError(PR_TPD_RANGE_ERROR, 0); diff --git a/nsprpub/pr/tests/nbconn.c b/nsprpub/pr/tests/nbconn.c index 3598cba260b..27e0e698c55 100644 --- a/nsprpub/pr/tests/nbconn.c +++ b/nsprpub/pr/tests/nbconn.c @@ -125,7 +125,7 @@ int main(int argc, char **argv) * 1. successful connection: a server thread accepts a connection * from the main thread * 2. unsuccessful connection: the main thread tries to connect to a - * non-existent port and expects to get an error + * nonexistent port and expects to get an error */ rv = connection_success_test(); if (rv == 0) @@ -447,7 +447,7 @@ def_exit: } /* - * test for connection to a non-existent port using a non-blocking socket + * test for connection to a nonexistent port using a non-blocking socket */ static PRIntn connection_failure_test()