Android cross compile on OS X doesn't set IS_LITTLE_ENDIAN

RESOLVED FIXED in mozilla10

Status

()

Core
JavaScript Engine
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: cdleary, Assigned: ted)

Tracking

unspecified
mozilla10
ARM
Mac OS X
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

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.
(Assignee)

Comment 1

6 years ago
jscpucfg is really stupid and I hate it. Can we just give up and hardcode this stuff with platform-specific #ifdefs yet?

http://mxr.mozilla.org/mozilla-central/source/js/src/Makefile.in#897
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.
(Assignee)

Updated

6 years ago
Assignee: general → ted.mielczarek
Status: NEW → ASSIGNED
(Assignee)

Comment 3

6 years ago
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.
(Assignee)

Comment 4

6 years ago
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.
Attachment #568064 - Flags: review?(jimb)
Duplicate of this bug: 685203

Comment 6

6 years ago
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.
Attachment #568064 - Flags: review?(jimb) → review+
(Assignee)

Comment 7

6 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/7e48b16bb2d4
Fixup for pa-risc:
https://hg.mozilla.org/integration/mozilla-inbound/rev/1595eb996964
(r=ted as per irc)

Updated

6 years ago
Depends on: 696957
https://hg.mozilla.org/mozilla-central/rev/7e48b16bb2d4
https://hg.mozilla.org/mozilla-central/rev/1595eb996964
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla10

Updated

6 years ago
Blocks: 696957
No longer depends on: 696957

Updated

6 years ago
Depends on: 699170
(Assignee)

Updated

5 years ago
Blocks: 523964
(Assignee)

Updated

5 years ago
Blocks: 523162
(Assignee)

Updated

5 years ago
Duplicate of this bug: 467453
You need to log in before you can comment on or make changes to this bug.