summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2017-09-20 21:17:04 +0000
committerSam Clegg <sbc@chromium.org>2017-09-20 21:17:04 +0000
commit31a2c8093593a8e17a05022915eb505dcb7020e3 (patch)
tree7f21c266b4295bdb7d2000d6ef60d87fb733ad78 /llvm/include
parent1e72f65077f9f87cccaa490131803431958d90e2 (diff)
downloadbcm5719-llvm-31a2c8093593a8e17a05022915eb505dcb7020e3.tar.gz
bcm5719-llvm-31a2c8093593a8e17a05022915eb505dcb7020e3.zip
[WebAssembly] Add support for local symbol bindings
Differential Revision: https://reviews.llvm.org/D38096 llvm-svn: 313817
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/BinaryFormat/Wasm.h6
-rw-r--r--llvm/include/llvm/Object/Wasm.h15
2 files changed, 19 insertions, 2 deletions
diff --git a/llvm/include/llvm/BinaryFormat/Wasm.h b/llvm/include/llvm/BinaryFormat/Wasm.h
index 53a812b2777..ffb453513cc 100644
--- a/llvm/include/llvm/BinaryFormat/Wasm.h
+++ b/llvm/include/llvm/BinaryFormat/Wasm.h
@@ -188,8 +188,12 @@ enum : unsigned {
WASM_SEGMENT_NAMES = 0x5,
};
+const unsigned WASM_SYMBOL_BINDING_MASK = 0x3;
+
enum : unsigned {
- WASM_SYMBOL_FLAG_WEAK = 0x1,
+ WASM_SYMBOL_BINDING_GLOBAL = 0x0,
+ WASM_SYMBOL_BINDING_WEAK = 0x1,
+ WASM_SYMBOL_BINDING_LOCAL = 0x2,
};
#define WASM_RELOC(name, value) name = value,
diff --git a/llvm/include/llvm/Object/Wasm.h b/llvm/include/llvm/Object/Wasm.h
index 2084ff06f80..172b1502156 100644
--- a/llvm/include/llvm/Object/Wasm.h
+++ b/llvm/include/llvm/Object/Wasm.h
@@ -56,7 +56,19 @@ public:
uint32_t ElementIndex;
bool isWeak() const {
- return Flags & wasm::WASM_SYMBOL_FLAG_WEAK;
+ return getBinding() == wasm::WASM_SYMBOL_BINDING_WEAK;
+ }
+
+ bool isGlobal() const {
+ return getBinding() == wasm::WASM_SYMBOL_BINDING_GLOBAL;
+ }
+
+ bool isLocal() const {
+ return getBinding() == wasm::WASM_SYMBOL_BINDING_LOCAL;
+ }
+
+ unsigned getBinding() const {
+ return Flags & wasm::WASM_SYMBOL_BINDING_MASK;
}
void print(raw_ostream &Out) const {
@@ -132,6 +144,7 @@ public:
Expected<StringRef> getSymbolName(DataRefImpl Symb) const override;
Expected<uint64_t> getSymbolAddress(DataRefImpl Symb) const override;
+ uint64_t getWasmSymbolValue(const WasmSymbol& Sym) const;
uint64_t getSymbolValueImpl(DataRefImpl Symb) const override;
uint32_t getSymbolAlignment(DataRefImpl Symb) const override;
uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override;
OpenPOWER on IntegriCloud