diff options
author | Daniel Wirtz <dcode@dcode.io> | 2019-10-12 00:41:32 +0200 |
---|---|---|
committer | Alon Zakai <azakai@google.com> | 2019-10-11 15:41:32 -0700 |
commit | 66cb7b3f80f6ce32f426c3cb52eaf19430289ac2 (patch) | |
tree | c93ad30df8f2e0959d914afe42470ceeb3996e7d /src/js/binaryen.js-post.js | |
parent | 4e80fde446764102fe5685496f351f0539377ff6 (diff) | |
download | binaryen-66cb7b3f80f6ce32f426c3cb52eaf19430289ac2.tar.gz binaryen-66cb7b3f80f6ce32f426c3cb52eaf19430289ac2.tar.bz2 binaryen-66cb7b3f80f6ce32f426c3cb52eaf19430289ac2.zip |
Add BinaryenAddCustomSection API (#2381)
This adds a new BinaryenAddCustomSection API so a generator can add arbitrary
custom sections to a module.
Diffstat (limited to 'src/js/binaryen.js-post.js')
-rw-r--r-- | src/js/binaryen.js-post.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js index 03e57d3d5..7c99ded15 100644 --- a/src/js/binaryen.js-post.js +++ b/src/js/binaryen.js-post.js @@ -2105,6 +2105,11 @@ function wrapModule(module, self) { self['setFeatures'] = function(features) { Module['_BinaryenModuleSetFeatures'](module, features); }; + self['addCustomSection'] = function(name, contents) { + return preserveStack(function() { + return Module['_BinaryenAddCustomSection'](module, strToStack(name), i8sToStack(contents), contents.length); + }); + }; self['emitText'] = function() { var old = out; var ret = ''; |