aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/WasmObjectFile.cpp
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2017-06-16 23:59:10 +0000
committerSam Clegg <sbc@chromium.org>2017-06-16 23:59:10 +0000
commit9d24fb7ff318d7a88f0fa3e63eb0df4acafd9805 (patch)
tree831fda1fcb2d777624a62553479acb958f043e43 /llvm/lib/Object/WasmObjectFile.cpp
parent4f1fca270acd736cbde43773d1fd83b3b3d2164f (diff)
downloadllvm-9d24fb7ff318d7a88f0fa3e63eb0df4acafd9805.zip
llvm-9d24fb7ff318d7a88f0fa3e63eb0df4acafd9805.tar.gz
llvm-9d24fb7ff318d7a88f0fa3e63eb0df4acafd9805.tar.bz2
[WebAssembly] Use __stack_pointer global when writing wasm binary
This ensures that symbolic relocations are generated for stack pointer manipulations. These relocations are of type R_WEBASSEMBLY_GLOBAL_INDEX_LEB. This change also adds support for reading relocations of this type in WasmObjectFile.cpp. Since its a globally imported symbol this does mean that the get_global/set_global instruction won't be valid until the objects are linked that global used in no longer an imported global. Differential Revision: https://reviews.llvm.org/D34172 llvm-svn: 305616
Diffstat (limited to 'llvm/lib/Object/WasmObjectFile.cpp')
-rw-r--r--llvm/lib/Object/WasmObjectFile.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp
index 2304098..5e0affb 100644
--- a/llvm/lib/Object/WasmObjectFile.cpp
+++ b/llvm/lib/Object/WasmObjectFile.cpp
@@ -325,6 +325,7 @@ Error WasmObjectFile::parseRelocSection(StringRef Name, const uint8_t *Ptr,
case wasm::R_WEBASSEMBLY_TABLE_INDEX_SLEB:
case wasm::R_WEBASSEMBLY_TABLE_INDEX_I32:
case wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB:
+ case wasm::R_WEBASSEMBLY_GLOBAL_INDEX_LEB:
break;
case wasm::R_WEBASSEMBLY_GLOBAL_ADDR_LEB:
case wasm::R_WEBASSEMBLY_GLOBAL_ADDR_SLEB:
@@ -332,7 +333,8 @@ Error WasmObjectFile::parseRelocSection(StringRef Name, const uint8_t *Ptr,
Reloc.Addend = readVarint32(Ptr);
break;
default:
- return make_error<GenericBinaryError>("Bad relocation type",
+ return make_error<GenericBinaryError>("Bad relocation type: " +
+ Twine(Reloc.Type),
object_error::parse_failed);
}
Section->Relocations.push_back(Reloc);