diff options
-rw-r--r-- | src/analyzer.js | 8 | ||||
-rw-r--r-- | src/settings.js | 5 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/analyzer.js b/src/analyzer.js index 33238e8a..3cc07f22 100644 --- a/src/analyzer.js +++ b/src/analyzer.js @@ -1127,7 +1127,13 @@ function analyzer(data) { var ret = substrate.solve(); // Add additional necessary items - ['memset', 'malloc', 'free'].forEach(function(ident) { + if (INCLUDE_FULL_LIBRARY) { + assert(!BUILD_AS_SHARED_LIB, 'Cannot have both INCLUDE_FULL_LIBRARY and BUILD_AS_SHARED_LIB set.') + var libFuncsToInclude = Object.keys(Library); + } else { + var libFuncsToInclude = ['memset', 'malloc', 'free']; + } + libFuncsToInclude.forEach(function(ident) { ret.functionStubs.push({ intertype: 'functionStub', ident: '_' + ident diff --git a/src/settings.js b/src/settings.js index 614a29ac..437d61b5 100644 --- a/src/settings.js +++ b/src/settings.js @@ -105,6 +105,11 @@ EXPORTED_GLOBALS = []; // Global non-function variables that are explicitly // exported, so they are guaranteed to be // accessible outside of the generated code. +INCLUDE_FULL_LIBRARY = 0; // Whether to include the whole library rather than just the + // functions used by the generated code. This is needed when + // dynamically loading modules that make use of runtime + // library functions that are not used in the main module. + SHOW_LABELS = 0; // Show labels in the generated code BUILD_AS_SHARED_LIB = 0; // Whether to build the code as a shared library, which |