diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-12-25 11:10:59 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-12-25 18:41:00 -0500 |
commit | b9dd33226924ac299166169b1b58a00aae20b85a (patch) | |
tree | cc145773f403ff3bcad948b605ea841707d6b5e9 /src | |
parent | 0cdd61e4552509a9f06f729421eb5045114cebac (diff) | |
download | binaryen-b9dd33226924ac299166169b1b58a00aae20b85a.tar.gz binaryen-b9dd33226924ac299166169b1b58a00aae20b85a.tar.bz2 binaryen-b9dd33226924ac299166169b1b58a00aae20b85a.zip |
handle global addressings starting with '_'
Diffstat (limited to 'src')
-rw-r--r-- | src/s2wasm.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/s2wasm.h b/src/s2wasm.h index cb043f21b..dc40ece65 100644 --- a/src/s2wasm.h +++ b/src/s2wasm.h @@ -602,7 +602,7 @@ private: Name assign = getAssign(); char start = *s; cashew::IString str = getStrToSep(); - if (start == '.' || (isalpha(start) && str != NAN__ && str != INFINITY__)) { + if (start == '.' || start == '_' || (isalpha(start) && str != NAN__ && str != INFINITY__)) { // global address int32_t offset = 0; if (match("+")) offset = getInt(); @@ -995,8 +995,10 @@ private: Name name = triple.name; size_t offset = triple.offset; const auto &symbolAddress = staticAddresses.find(name); + if (debug) std::cerr << "fix addressing " << name << '\n'; if (symbolAddress != staticAddresses.end()) { curr->value = Literal(int32_t(symbolAddress->second + offset)); + if (debug) std::cerr << " ==> " << curr->value << '\n'; } else { // must be a function address if (wasm.functionsMap.count(name) == 0) { @@ -1011,9 +1013,11 @@ private: } for (auto& relocation : relocations) { Name name = relocation.value; + if (debug) std::cerr << "fix relocation " << name << '\n'; const auto &symbolAddress = staticAddresses.find(name); if (symbolAddress != staticAddresses.end()) { *(relocation.data) = symbolAddress->second + relocation.offset; + if (debug) std::cerr << " ==> " << *(relocation.data) << '\n'; } else { // must be a function address if (wasm.functionsMap.count(name) == 0) { |