aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-04-21 08:36:33 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-04-29 13:01:58 -0700
commit17248eb417685f37a94bc8857d3d6e513364cc9d (patch)
tree9413876b64f25ecd7c3eec2a4362e7411b24de66
parent0fedeaa62d955ce57e6751a57e263122420671c1 (diff)
add target settings
-rwxr-xr-xemcc3
-rw-r--r--src/runtime.js2
-rw-r--r--src/settings.js3
3 files changed, 8 insertions, 0 deletions
diff --git a/emcc b/emcc
index 079f6edc..ed6e916f 100755
--- a/emcc
+++ b/emcc
@@ -1032,6 +1032,9 @@ try:
if minify_whitespace is None:
minify_whitespace = opt_level >= 2 and not keep_js_debug
+ if shared.Settings.TARGET_X86: assert 'i386-pc-linux-gnu' in shared.COMPILER_OPTS
+ if shared.Settings.TARGET_LE32: assert 'le32-unknown-nacl' in shared.COMPILER_OPTS
+
## Compile source code to bitcode
if DEBUG: print >> sys.stderr, 'emcc: compiling to bitcode'
diff --git a/src/runtime.js b/src/runtime.js
index ec39636f..b184b275 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -178,7 +178,9 @@ var Runtime = {
// type can be a native type or a struct (or null, for structs we only look at size here)
getAlignSize: function(type, size) {
// we align i64s and doubles on 64-bit boundaries, unlike x86
+#if TARGET_LE32
if (type == 'i64' || type == 'double') return 8;
+#endif
return Math.min(size, Runtime.QUANTUM_SIZE);
},
diff --git a/src/settings.js b/src/settings.js
index 48b0347e..82cb411b 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -17,6 +17,9 @@ var QUANTUM_SIZE = 4; // This is the size of an individual field in a structure.
//
// Changing this from the default of 4 is deprecated.
+var TARGET_X86 = 0; // For le32-unknown-nacl
+var TARGET_LE32 = 1; // For i386-pc-linux-gnu
+
var CORRECT_SIGNS = 1; // Whether we make sure to convert unsigned values to signed values.
// Decreases performance with additional runtime checks. Might not be
// needed in some kinds of code.