diff options
| author | Alon Zakai <alonzakai@gmail.com> | 2013-07-01 18:45:02 -0700 | 
|---|---|---|
| committer | Alon Zakai <alonzakai@gmail.com> | 2013-07-03 15:31:05 -0700 | 
| commit | 8b68c8ada6845886bebe698a35bea27858d07db0 (patch) | |
| tree | 63e95d611f6a4f4b0edb3b8088f7c5725d5de41d | |
| parent | 218696cdd2af0f6a96b7bb506c60c845ab36852f (diff) | |
fix relocation of global linkable variables, enable iostream module linking test
| -rwxr-xr-x | emscripten.py | 7 | ||||
| -rw-r--r-- | src/jsifier.js | 1 | ||||
| -rwxr-xr-x | tests/runner.py | 2 | 
3 files changed, 5 insertions, 5 deletions
diff --git a/emscripten.py b/emscripten.py index 7d9dd1a2..eeee26e4 100755 --- a/emscripten.py +++ b/emscripten.py @@ -481,11 +481,12 @@ def emscript(infile, settings, outfile, libraries=[], compiler_engine=None,                        ''.join(['  var ' + g + '=+env.' + g + ';\n' for g in basic_float_vars])      # In linkable modules, we need to add some explicit globals for global variables that can be linked and used across modules      if settings.get('MAIN_MODULE') or settings.get('SIDE_MODULE'): +      assert settings.get('TARGET_LE32'), 'TODO: support x86 target when linking modules (needs offset of 4 and not 8 here)'        for key, value in forwarded_json['Variables']['globals'].iteritems():          if value.get('linkable'): -          init = str(forwarded_json['Variables']['indexedGlobals'][key]) -          if settings.get('SIDE_MODULE'): init = '(H_BASE+' + init + ')|0' -          asm_global_vars += '  var %s=%s;\n' % (key, init) +          init = forwarded_json['Variables']['indexedGlobals'][key] + 8 # 8 is Runtime.GLOBAL_BASE / STATIC_BASE +          if settings.get('SIDE_MODULE'): init = '(H_BASE+' + str(init) + ')|0' +          asm_global_vars += '  var %s=%s;\n' % (key, str(init))      # sent data      the_global = '{ ' + ', '.join(['"' + math_fix(s) + '": ' + s for s in fundamentals]) + ' }' diff --git a/src/jsifier.js b/src/jsifier.js index acf0f2ac..7072c9c8 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -1605,6 +1605,7 @@ function JSify(data, functionsOnly, givenFunctions) {        if (phase == 'pre' && !Variables.generatedGlobalBase) {          Variables.generatedGlobalBase = true;          // Globals are done, here is the rest of static memory +        assert((TARGET_LE32 && Runtime.GLOBAL_BASE == 8) || (TARGET_X86 && Runtime.GLOBAL_BASE == 4)); // this is assumed in e.g. relocations for linkable modules          print('STATIC_BASE = ' + Runtime.GLOBAL_BASE + ';\n');          print('STATICTOP = STATIC_BASE + ' + Runtime.alignMemory(Variables.nextIndexedOffset) + ';\n');        } diff --git a/tests/runner.py b/tests/runner.py index 5737a298..1a6bc9e6 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -10764,8 +10764,6 @@ f.close()        finally:          del os.environ['EMCC_FORCE_STDLIBS'] -      return # TODO -        # iostream usage in one and std::string in both        test('iostream', r'''          #include <iostream>  | 
