Last Comment Bug 694499 - Android cross compile on OS X doesn't set IS_LITTLE_ENDIAN
: Android cross compile on OS X doesn't set IS_LITTLE_ENDIAN
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: ARM Mac OS X
-- normal (vote)
: mozilla10
Assigned To: Ted Mielczarek [:ted.mielczarek]
: Jason Orendorff [:jorendorff]
: 467453 685203 (view as bug list)
Depends on: 699170
Blocks: 523162 523964 696957
  Show dependency treegraph
Reported: 2011-10-13 22:39 PDT by Chris Leary [:cdleary] (not checking bugmail)
Modified: 2012-06-20 07:40 PDT (History)
14 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

get rid of jscpucfg binary (15.19 KB, patch)
2011-10-19 08:23 PDT, Ted Mielczarek [:ted.mielczarek]
jimb: review+
Details | Diff | Splinter Review

Description User image Chris Leary [:cdleary] (not checking bugmail) 2011-10-13 22:39:34 PDT
It looks like the endianness is wrong for jsval_layout on the OS X cross compiles, which is guarded by IS_LITTLE_ENDIAN in jscpucfg.h. This causes it to die almost immediately, since setting a jsval to undefined does not alter the correct (tag) bits.

I'll take a quick crack at this tomorrow, but I'm a build system idiot, so I may turn it over to somebody else very quickly.
Comment 1 User image Ted Mielczarek [:ted.mielczarek] 2011-10-14 07:58:36 PDT
jscpucfg is really stupid and I hate it. Can we just give up and hardcode this stuff with platform-specific #ifdefs yet?
Comment 2 User image (away until Feb21) Kartikaya Gupta ( 2011-10-14 08:29:00 PDT
Awesome! I confirm that rebuilding with this patch:

diff -r d9e824e28209 js/src/jscpucfg.cpp
--- a/js/src/jscpucfg.cpp	Thu Oct 13 21:13:01 2011 -0700
+++ b/js/src/jscpucfg.cpp	Fri Oct 14 11:27:16 2011 -0400
@@ -64,13 +64,13 @@
      * processors, and determines which processor to configure for based
      * on compiler predefined macros.  We do the same thing here.
-    printf("#ifdef __LITTLE_ENDIAN__\n");
+    //printf("#ifdef __LITTLE_ENDIAN__\n");
     printf("#define IS_LITTLE_ENDIAN 1\n");
     printf("#undef  IS_BIG_ENDIAN\n");
-    printf("#else\n");
-    printf("#undef  IS_LITTLE_ENDIAN\n");
-    printf("#define IS_BIG_ENDIAN 1\n");
-    printf("#endif\n\n");
+    //printf("#else\n");
+    //printf("#undef  IS_LITTLE_ENDIAN\n");
+    //printf("#define IS_BIG_ENDIAN 1\n");
+    //printf("#endif\n\n");
 #elif defined(IS_LITTLE_ENDIAN) || defined(FORCE_LITTLE_ENDIAN)
     printf("#define IS_LITTLE_ENDIAN 1\n");
     printf("#undef  IS_BIG_ENDIAN\n\n");

makes a working android build cross-compiled from mac. Apparently FORCE_LITTLE_ENDIAN is the missing define, since on mac jscpucfg.cpp gets compiled into a binary and then run to generate jsautocfg.h, which is the actual include used by the js code. Or something like that.
Comment 3 User image Ted Mielczarek [:ted.mielczarek] 2011-10-19 08:23:18 PDT
Created attachment 568064 [details] [diff] [review]
get rid of jscpucfg binary

So I ripped out the jscpucfg binary, since all it does is set this endianness define, but in a completely stupid way. I've got hardcoded definitions in the header file for (the existing) Win32/64, OS X, and anything with endian.h. I'm pretty sure this makes all of our Tier 1 platforms work, and should fix the issue this bug was reported for. It might break some other less-well-supported platforms, but it shouldn't be much effort to add support for those to jscpucfg.h.
Comment 4 User image Ted Mielczarek [:ted.mielczarek] 2011-10-19 14:04:38 PDT
Comment on attachment 568064 [details] [diff] [review]
get rid of jscpucfg binary

This is looking pretty reasonable on Try, although not all platforms have reported yet.

I think this is the best way to go. Trying to detect endianness by running a binary is a losing proposition. We should just hardcode the answer (or use what the compiler/system headers give us). There's bound to be a little pain here for oddball platforms, (I'm sure I broke Solaris and BSD here), but this improves our cross-compilation story.
Comment 5 User image Brad Lassey [:blassey] (use needinfo?) 2011-10-20 20:28:32 PDT
*** Bug 685203 has been marked as a duplicate of this bug. ***
Comment 6 User image Jim Blandy :jimb 2011-10-21 17:10:31 PDT
Comment on attachment 568064 [details] [diff] [review]
get rid of jscpucfg binary

Review of attachment 568064 [details] [diff] [review]:

Yeah, I think the autoconf dynamic test religion is not serving us well, here.
Comment 7 User image Ted Mielczarek [:ted.mielczarek] 2011-10-24 08:41:44 PDT
Comment 8 User image Mike Hommey [:glandium] 2011-10-24 09:18:59 PDT
Fixup for pa-risc:
(r=ted as per irc)
Comment 10 User image Ted Mielczarek [:ted.mielczarek] 2012-06-20 07:40:31 PDT
*** Bug 467453 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.