Bug 1389281 - Add GETRANDOM_NR definition for powerpc and mips. r?luke draft
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 11 Aug 2017 07:03:05 +0900
changeset 644385 d0781ff8c767921932b3e92086ddd228b178ce25
parent 644015 4751560ba21182f278899264ce832f4dfc609655
child 725599 89244cc936e29fc1397c71d8e2b771e2ef39d383
push id73427
push userbmo:mh+mozilla@glandium.org
push dateThu, 10 Aug 2017 22:27:14 +0000
reviewersluke
bugs1389281
milestone57.0a1
Bug 1389281 - Add GETRANDOM_NR definition for powerpc and mips. r?luke At the same time, simplify the definitions, as: - per python/mozbuild/mozbuild/configure/constants.py, supported compilers all support lowercase forms. - all variants of powerpc, little endian or not, 32-bits or 64-bits, define __powerpc__. - s390x also defines __s390__.
js/src/jsmath.cpp
--- a/js/src/jsmath.cpp
+++ b/js/src/jsmath.cpp
@@ -65,29 +65,29 @@
 # if defined(__x86_64__)
 #  define GETRANDOM_NR 318
 # elif defined(__i386__)
 #  define GETRANDOM_NR 355
 # elif defined(__aarch64__)
 #  define GETRANDOM_NR 278
 # elif defined(__arm__)
 #  define GETRANDOM_NR 384
-// Added other architectures:
-# elif defined(__ppc64le__)
-#  define GETRANDOM_NR 359
-# elif defined(__PPC64LE__)
+# elif defined(__powerpc__)
 #  define GETRANDOM_NR 359
-# elif defined(__ppc64__)
-#  define GETRANDOM_NR 359
-# elif defined(__PPC64__)
-#  define GETRANDOM_NR 359
-# elif defined(__s390x__)
-#  define GETRANDOM_NR 349
 # elif defined(__s390__)
 #  define GETRANDOM_NR 349
+# elif defined(__mips__)
+#  include <sgidefs.h>
+#  if _MIPS_SIM == _MIPS_SIM_ABI32
+#    define GETRANDOM_NR 4353
+#  elif _MIPS_SIM == _MIPS_SIM_ABI64
+#    define GETRANDOM_NR 5313
+#  elif _MIPS_SIM == _MIPS_SIM_NABI32
+#    define GETRANDOM_NR 6317
+#  endif
 # endif
 
 # if defined(SYS_getrandom)
 // We have SYS_getrandom. Use it to check GETRANDOM_NR. Only do this if we set
 // GETRANDOM_NR so tier 3 platforms with recent glibc are not forced to define
 // it for no good reason.
 #  if defined(GETRANDOM_NR)
 static_assert(GETRANDOM_NR == SYS_getrandom,