summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2018-04-26 16:41:51 +0000
committerSam Clegg <sbc@chromium.org>2018-04-26 16:41:51 +0000
commitf676cdd515d664e93ecbf8506af9610250195827 (patch)
tree947f2ec56255d54fcbb34e764954a10ed0b24a35 /llvm/lib
parentf760b2c0875d8194f8bacda425789e278a0d705d (diff)
downloadbcm5719-llvm-f676cdd515d664e93ecbf8506af9610250195827.tar.gz
bcm5719-llvm-f676cdd515d664e93ecbf8506af9610250195827.zip
[WebAssembly] Implement getRelocationValueString()
And use it in llvm-objdump. Differential Revision: https://reviews.llvm.org/D46092 llvm-svn: 330957
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Object/WasmObjectFile.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp
index 3e8f73dbd81..e6b7dded4e4 100644
--- a/llvm/lib/Object/WasmObjectFile.cpp
+++ b/llvm/lib/Object/WasmObjectFile.cpp
@@ -1139,10 +1139,14 @@ uint64_t WasmObjectFile::getRelocationOffset(DataRefImpl Ref) const {
return Rel.Offset;
}
-symbol_iterator WasmObjectFile::getRelocationSymbol(DataRefImpl Rel) const {
- llvm_unreachable("not yet implemented");
- SymbolRef Ref;
- return symbol_iterator(Ref);
+symbol_iterator WasmObjectFile::getRelocationSymbol(DataRefImpl Ref) const {
+ const wasm::WasmRelocation &Rel = getWasmRelocation(Ref);
+ if (Rel.Type == wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB)
+ return symbol_end();
+ DataRefImpl Sym;
+ Sym.d.a = Rel.Index;
+ Sym.d.b = 0;
+ return symbol_iterator(SymbolRef(Sym, this));
}
uint64_t WasmObjectFile::getRelocationType(DataRefImpl Ref) const {
OpenPOWER on IntegriCloud