diff options
author | Nicholas Wilson <nicholas@nicholaswilson.me.uk> | 2018-03-09 16:30:44 +0000 |
---|---|---|
committer | Nicholas Wilson <nicholas@nicholaswilson.me.uk> | 2018-03-09 16:30:44 +0000 |
commit | 15f349f76f076202a8569ffdf15db153168bf4a2 (patch) | |
tree | b7861b14e64ee98d74c8a5d50d7438f48a8ae39b /llvm/lib/Object | |
parent | 69df838b5298eb33b7f94c826e714f91abeafa53 (diff) | |
download | bcm5719-llvm-15f349f76f076202a8569ffdf15db153168bf4a2.tar.gz bcm5719-llvm-15f349f76f076202a8569ffdf15db153168bf4a2.zip |
[WebAssembly] Disallow weak undefined globals in the object format
This implements https://github.com/WebAssembly/tool-conventions/pull/47
Differential Revision: https://reviews.llvm.org/D44201
llvm-svn: 327146
Diffstat (limited to 'llvm/lib/Object')
-rw-r--r-- | llvm/lib/Object/WasmObjectFile.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp index 3b18e194d02..65ae0639d4f 100644 --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -422,6 +422,11 @@ Error WasmObjectFile::parseLinkingSectionSymtab(const uint8_t *&Ptr, IsDefined != isDefinedGlobalIndex(Info.ElementIndex)) return make_error<GenericBinaryError>("invalid global symbol index", object_error::parse_failed); + if (!IsDefined && + (Info.Flags & wasm::WASM_SYMBOL_BINDING_MASK) == + wasm::WASM_SYMBOL_BINDING_WEAK) + return make_error<GenericBinaryError>("undefined weak global symbol", + object_error::parse_failed); if (IsDefined) { Info.Name = readString(Ptr); unsigned GlobalIndex = Info.ElementIndex - NumImportedGlobals; |