diff options
-rwxr-xr-x | emcc | 8 | ||||
-rw-r--r-- | src/jsifier.js | 2 | ||||
-rw-r--r-- | src/library_sdl.js | 3 | ||||
-rw-r--r-- | src/relooper/Relooper.cpp | 2 | ||||
-rw-r--r-- | system/include/libc/sys/dirent.h | 16 | ||||
-rwxr-xr-x | tests/runner.py | 18 | ||||
-rw-r--r-- | tools/shared.py | 13 |
7 files changed, 51 insertions, 11 deletions
@@ -53,8 +53,6 @@ from tools import shared from tools.shared import Compression, execute, suffix, unsuffixed, unsuffixed_basename from tools.response_file import read_response_file -logging = logging.getLogger('emcc') - # Mapping of emcc opt levels to llvm opt levels. We use llvm opt level 3 in emcc opt # levels 2 and 3 (emcc 3 is unsafe opts, so unsuitable for the only level to get # llvm opt level 3, and speed-wise emcc level 2 is already the slowest/most optimizing @@ -819,8 +817,12 @@ try: newargs[i] = '' elif newargs[i] == '-v': shared.COMPILER_OPTS += ['-v'] - DEBUG = 1 os.environ['EMCC_DEBUG'] = '1' # send to child processes too + if DEBUG != 1: + # swap in debug logging + DEBUG = 1 + shared.set_logging() + logging.debug('invocation: ' + ' '.join(sys.argv)) newargs[i] = '' elif newargs[i].startswith('--shell-file'): check_bad_eq(newargs[i]) diff --git a/src/jsifier.js b/src/jsifier.js index 156fd65d..faef88d5 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -328,7 +328,7 @@ function JSify(data, functionsOnly, givenFunctions) { var js = (index !== null ? '' : item.ident + '=') + constant; if (js) js += ';'; - if (!ASM_JS && (EXPORT_ALL || (item.ident in EXPORTED_GLOBALS))) { + if (!ASM_JS && NAMED_GLOBALS && (EXPORT_ALL || (item.ident in EXPORTED_GLOBALS))) { js += '\nModule["' + item.ident + '"] = ' + item.ident + ';'; } if (BUILD_AS_SHARED_LIB == 2 && !item.private_) { diff --git a/src/library_sdl.js b/src/library_sdl.js index 6adfc1e2..5aaddb3b 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -1817,7 +1817,7 @@ var LibrarySDL = { SDL_AddTimer: function(interval, callback, param) { return window.setTimeout(function() { - Runtime.dynCall('ii', callback, [interval, param]); + Runtime.dynCall('iii', callback, [interval, param]); }, interval); }, SDL_RemoveTimer: function(id) { @@ -1846,6 +1846,7 @@ var LibrarySDL = { Mix_Linked_Version: function() { throw 'Mix_Linked_Version: TODO' }, SDL_SaveBMP_RW: function() { throw 'SDL_SaveBMP_RW: TODO' }, + SDL_WM_SetIcon: function() { /* This function would set the application window icon surface, which doesn't apply for web canvases, so a no-op. */ }, SDL_HasRDTSC: function() { return 0; }, SDL_HasMMX: function() { return 0; }, SDL_HasMMXExt: function() { return 0; }, diff --git a/src/relooper/Relooper.cpp b/src/relooper/Relooper.cpp index 8a6e18b8..7ceeb2f8 100644 --- a/src/relooper/Relooper.cpp +++ b/src/relooper/Relooper.cpp @@ -897,6 +897,7 @@ void Relooper::Calculate(Block *Entry) { BlockSet Entries; Entries.insert(Entry); Root = Analyzer(this).Process(AllBlocks, Entries, NULL); + assert(Root); // Post optimizations @@ -1091,6 +1092,7 @@ void Relooper::Calculate(Block *Entry) { void Relooper::Render() { OutputBuffer = OutputBufferRoot; + assert(Root); Root->Render(false); } diff --git a/system/include/libc/sys/dirent.h b/system/include/libc/sys/dirent.h index 9dcf34d1..0d8b02b5 100644 --- a/system/include/libc/sys/dirent.h +++ b/system/include/libc/sys/dirent.h @@ -34,8 +34,22 @@ int scandir(const char *dirp, enum { DT_UNKNOWN = 0, #define DT_UNKNOWN DT_UNKNOWN - DT_DIR = 4 + DT_FIFO = 1, +#define DT_FIFO DT_FIFO + DT_CHR = 2, +#define DT_CHR DT_CHR + DT_DIR = 4, #define DT_DIR DT_DIR + DT_BLK = 6, +#define DT_BLK DT_BLK + DT_REG = 8, +#define DT_REG DT_REG + DT_LNK = 10, +#define DT_LNK DT_LNK + DT_SOCK = 12, +#define DT_SOCK DT_SOCK + DT_WHT = 14 +#define DT_WHT DT_WHT }; #ifdef __cplusplus diff --git a/tests/runner.py b/tests/runner.py index 5e101024..73dbab13 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -10496,6 +10496,24 @@ f.close() self.assertContained('result: 1', run_js(os.path.join(self.get_dir(), 'a.out.js'))) + def test_export_all(self): + lib = r''' + #include <stdio.h> + void libf1() { printf("libf1\n"); } + void libf2() { printf("libf2\n"); } + ''' + lib_name = os.path.join(self.get_dir(), 'lib.c') + open(lib_name, 'w').write(lib) + + open('main.js', 'w').write(''' + _libf1(); + _libf2(); + ''') + + Building.emcc(lib_name, ['-s', 'EXPORT_ALL=1', '--post-js', 'main.js'], output_filename='a.out.js') + + self.assertContained('libf1\nlibf2\n', run_js(os.path.join(self.get_dir(), 'a.out.js'))) + def test_abspaths(self): # Includes with absolute paths are generally dangerous, things like -I/usr/.. will get to system local headers, not our portable ones. diff --git a/tools/shared.py b/tools/shared.py index 8a172d9c..b212a9cc 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -295,7 +295,7 @@ def check_node_version(): # we re-check sanity when the settings are changed) # We also re-check sanity and clear the cache when the version changes -EMSCRIPTEN_VERSION = '1.4.9' +EMSCRIPTEN_VERSION = '1.5.0' def generate_sanity(): return EMSCRIPTEN_VERSION + '|' + get_llvm_target() @@ -454,9 +454,12 @@ EMSCRIPTEN_TEMP_DIR = configuration.EMSCRIPTEN_TEMP_DIR DEBUG_CACHE = configuration.DEBUG_CACHE CANONICAL_TEMP_DIR = configuration.CANONICAL_TEMP_DIR -level = logging.DEBUG if os.environ.get('EMCC_DEBUG') else logging.INFO -logging.basicConfig(level=level, format='%(levelname)-8s %(name)s: %(message)s') - +logging.basicConfig(format='%(levelname)-8s %(name)s: %(message)s') +def set_logging(): + logger = logging.getLogger() + logger.setLevel(logging.DEBUG if os.environ.get('EMCC_DEBUG') else logging.INFO) +set_logging() + if not EMSCRIPTEN_TEMP_DIR: EMSCRIPTEN_TEMP_DIR = tempfile.mkdtemp(prefix='emscripten_temp_', dir=configuration.TEMP_DIR) def clean_temp(): @@ -1091,7 +1094,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e @staticmethod def can_build_standalone(): - return not Settings.BUILD_AS_SHARED_LIB and not Settings.LINKABLE + return not Settings.BUILD_AS_SHARED_LIB and not Settings.LINKABLE and not Settings.EXPORT_ALL @staticmethod def can_use_unsafe_opts(): |