summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/s2wasm.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/s2wasm.h b/src/s2wasm.h
index a0ecfd710..b99a71159 100644
--- a/src/s2wasm.h
+++ b/src/s2wasm.h
@@ -200,7 +200,7 @@ private:
return false;
} else {
// a global constant, we need to fix it up later
- Name name = getStrToSep();
+ Name name = cleanFunction(getStrToSep());
int offset = 0;
if (*s == '+') {
s++;
@@ -316,6 +316,16 @@ private:
abort_on("getType");
}
+ // The LLVM backend emits function names as name@FUNCTION. We can drop the @ and after it.
+ Name cleanFunction(Name name) {
+ if (!strchr(name.str, '@')) return name;
+ char *temp = strdup(name.str);
+ *strchr(temp, '@') = 0;
+ Name ret = cashew::IString(temp, false);
+ free(temp);
+ return ret;
+ }
+
// processors
void scan() {
@@ -577,7 +587,7 @@ private:
curr = specific;
} else {
assign = getAssign();
- Name target = getCommaSeparated();
+ Name target = cleanFunction(getCommaSeparated());
if (implementedFunctions.count(target) > 0) {
auto specific = allocator.alloc<Call>();
specific->target = target;