summaryrefslogtreecommitdiff
path: root/src/js/binaryen.js-post.js
diff options
context:
space:
mode:
authorDaniel Wirtz <dcode@dcode.io>2019-10-12 00:41:32 +0200
committerAlon Zakai <azakai@google.com>2019-10-11 15:41:32 -0700
commit66cb7b3f80f6ce32f426c3cb52eaf19430289ac2 (patch)
treec93ad30df8f2e0959d914afe42470ceeb3996e7d /src/js/binaryen.js-post.js
parent4e80fde446764102fe5685496f351f0539377ff6 (diff)
downloadbinaryen-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.js5
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 = '';