aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorngld <ngld@tproxy.de>2013-11-26 23:12:09 +0100
committerngld <ngld@tproxy.de>2013-11-26 23:12:09 +0100
commitaefb4b1d6b8a5e5bdc8afba5f43eceebbaa39280 (patch)
tree3c394f16328602de94c23647f81c67086fa9400d /src
parent29906a675d9da025fc428d1cb95ed1a0f7bfb691 (diff)
Implemented #1573. All functions marked as "used" will be automatically added to EXPORTED_FUNCTIONS.
Diffstat (limited to 'src')
-rw-r--r--src/intertyper.js21
-rw-r--r--src/modules.js1
2 files changed, 22 insertions, 0 deletions
diff --git a/src/intertyper.js b/src/intertyper.js
index 940c677f..6d0aa751 100644
--- a/src/intertyper.js
+++ b/src/intertyper.js
@@ -524,6 +524,26 @@ function intertyper(lines, sidePass, baseLineNums) {
}
});
}
+ } else if (ident == '_llvm_used') {
+ var chunk = item.tokens[1].tokens;
+ var funcs = [];
+ var part = [];
+
+ for (var i = 0; i < chunk.length; i++) {
+ if (chunk[i].text == ',') {
+ var call = parseLLVMFunctionCall(part);
+ EXPORTED_FUNCTIONS[call.ident] = 0;
+ part = [];
+ } else {
+ part.push(chunk[i]);
+ }
+ }
+ if (part.length > 0) {
+ var call = parseLLVMFunctionCall(part);
+ EXPORTED_FUNCTIONS[call.ident] = 0;
+ }
+
+ ret.value = { intertype: 'value', ident: '0', value: '0', type: ret.type };
} else if (!external) {
if (item.tokens[1] && item.tokens[1].text != ';') {
if (item.tokens[1].text == 'c') {
@@ -538,6 +558,7 @@ function intertyper(lines, sidePass, baseLineNums) {
ret.value = { intertype: 'value', ident: '0', value: '0', type: ret.type };
}
}
+
return ret;
}
}
diff --git a/src/modules.js b/src/modules.js
index 79f494c0..29fca664 100644
--- a/src/modules.js
+++ b/src/modules.js
@@ -500,6 +500,7 @@ var PassManager = {
for (var i in data.Functions) {
Functions[i] = data.Functions[i];
}
+ EXPORTED_FUNCTIONS = data.EXPORTED_FUNCTIONS;
/*
print('\n//LOADED_DATA:' + phase + ':' + JSON.stringify({
Types: Types,