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__.
--- 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,