Update prebuilt Clang to r416183b from Android.
https://android.googlesource.com/platform/prebuilts/clang/host/
linux-x86/+/06a71ddac05c22edb2d10b590e1769b3f8619bef
clang 12.0.5 (based on r416183b) from build 7284624.
Change-Id: I277a316abcf47307562d8b748b84870f31a72866
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/linux-x64/clang/include/llvm/BinaryFormat/Wasm.h b/linux-x64/clang/include/llvm/BinaryFormat/Wasm.h
index 0ff52cb..bdef959 100644
--- a/linux-x64/clang/include/llvm/BinaryFormat/Wasm.h
+++ b/linux-x64/clang/include/llvm/BinaryFormat/Wasm.h
@@ -15,7 +15,9 @@
#define LLVM_BINARYFORMAT_WASM_H
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
namespace llvm {
namespace wasm {
@@ -39,7 +41,7 @@
uint32_t MemoryAlignment; // P2 alignment of memory
uint32_t TableSize; // Table size in elements
uint32_t TableAlignment; // P2 alignment of table
- std::vector<StringRef> Needed; // Shared library depenedencies
+ std::vector<StringRef> Needed; // Shared library dependencies
};
struct WasmProducerInfo {
@@ -61,13 +63,19 @@
struct WasmLimits {
uint8_t Flags;
- uint32_t Initial;
- uint32_t Maximum;
+ uint64_t Initial;
+ uint64_t Maximum;
+};
+
+struct WasmTableType {
+ uint8_t ElemType;
+ WasmLimits Limits;
};
struct WasmTable {
- uint8_t ElemType;
- WasmLimits Limits;
+ uint32_t Index;
+ WasmTableType Type;
+ StringRef SymbolName; // from the "linking" section
};
struct WasmInitExpr {
@@ -75,8 +83,8 @@
union {
int32_t Int32;
int64_t Int64;
- int32_t Float32;
- int64_t Float64;
+ uint32_t Float32;
+ uint64_t Float64;
uint32_t Global;
} Value;
};
@@ -112,7 +120,7 @@
union {
uint32_t SigIndex;
WasmGlobalType Global;
- WasmTable Table;
+ WasmTableType Table;
WasmLimits Memory;
WasmEventType Event;
};
@@ -130,6 +138,7 @@
uint32_t CodeSectionOffset;
uint32_t Size;
uint32_t CodeOffset; // start of Locals and Body
+ Optional<StringRef> ExportName; // from the "export" section
StringRef SymbolName; // from the "linking" section
StringRef DebugName; // from the "name" section
uint32_t Comdat; // from the "comdat info" section
@@ -156,8 +165,8 @@
// the index of the segment, and the offset and size within the segment.
struct WasmDataReference {
uint32_t Segment;
- uint32_t Offset;
- uint32_t Size;
+ uint64_t Offset;
+ uint64_t Size;
};
struct WasmRelocation {
@@ -176,18 +185,29 @@
StringRef Name;
uint8_t Kind;
uint32_t Flags;
- StringRef ImportModule; // For undefined symbols the module of the import
- StringRef ImportName; // For undefined symbols the name of the import
+ // For undefined symbols the module of the import
+ Optional<StringRef> ImportModule;
+ // For undefined symbols the name of the import
+ Optional<StringRef> ImportName;
+ // For symbols to be exported from the final module
+ Optional<StringRef> ExportName;
union {
- // For function or global symbols, the index in function or global index
- // space.
+ // For function, table, or global symbols, the index in function, table, or
+ // global index space.
uint32_t ElementIndex;
// For a data symbols, the address of the data relative to segment.
WasmDataReference DataRef;
};
};
-struct WasmFunctionName {
+enum class NameType {
+ FUNCTION,
+ GLOBAL,
+ DATA_SEGMENT,
+};
+
+struct WasmDebugName {
+ NameType Type;
uint32_t Index;
StringRef Name;
};
@@ -224,7 +244,7 @@
WASM_TYPE_F64 = 0x7C,
WASM_TYPE_V128 = 0x7B,
WASM_TYPE_FUNCREF = 0x70,
- WASM_TYPE_EXCEPT_REF = 0x68,
+ WASM_TYPE_EXTERNREF = 0x6F,
WASM_TYPE_FUNC = 0x60,
WASM_TYPE_NORESULT = 0x40, // for blocks with no result values
};
@@ -242,21 +262,41 @@
enum : unsigned {
WASM_OPCODE_END = 0x0b,
WASM_OPCODE_CALL = 0x10,
+ WASM_OPCODE_LOCAL_GET = 0x20,
+ WASM_OPCODE_LOCAL_SET = 0x21,
WASM_OPCODE_GLOBAL_GET = 0x23,
+ WASM_OPCODE_GLOBAL_SET = 0x24,
WASM_OPCODE_I32_STORE = 0x36,
+ WASM_OPCODE_I64_STORE = 0x37,
WASM_OPCODE_I32_CONST = 0x41,
WASM_OPCODE_I64_CONST = 0x42,
WASM_OPCODE_F32_CONST = 0x43,
WASM_OPCODE_F64_CONST = 0x44,
WASM_OPCODE_I32_ADD = 0x6a,
+ WASM_OPCODE_I64_ADD = 0x7c,
+ WASM_OPCODE_REF_NULL = 0xd0,
+};
+
+// Opcodes used in synthetic functions.
+enum : unsigned {
+ WASM_OPCODE_IF = 0x04,
+ WASM_OPCODE_ELSE = 0x05,
+ WASM_OPCODE_DROP = 0x1a,
WASM_OPCODE_MISC_PREFIX = 0xfc,
WASM_OPCODE_MEMORY_INIT = 0x08,
WASM_OPCODE_DATA_DROP = 0x09,
+ WASM_OPCODE_ATOMICS_PREFIX = 0xfe,
+ WASM_OPCODE_ATOMIC_NOTIFY = 0x00,
+ WASM_OPCODE_I32_ATOMIC_WAIT = 0x01,
+ WASM_OPCODE_I32_ATOMIC_STORE = 0x17,
+ WASM_OPCODE_I32_RMW_CMPXCHG = 0x48,
};
enum : unsigned {
+ WASM_LIMITS_FLAG_NONE = 0x0,
WASM_LIMITS_FLAG_HAS_MAX = 0x1,
WASM_LIMITS_FLAG_IS_SHARED = 0x2,
+ WASM_LIMITS_FLAG_IS_64 = 0x4,
};
enum : unsigned {
@@ -273,8 +313,10 @@
// Kind codes used in the custom "name" section
enum : unsigned {
- WASM_NAMES_FUNCTION = 0x1,
- WASM_NAMES_LOCAL = 0x2,
+ WASM_NAMES_FUNCTION = 1,
+ WASM_NAMES_LOCAL = 2,
+ WASM_NAMES_GLOBAL = 7,
+ WASM_NAMES_DATA_SEGMENT = 9,
};
// Kind codes used in the custom "linking" section
@@ -289,6 +331,8 @@
enum : unsigned {
WASM_COMDAT_DATA = 0x0,
WASM_COMDAT_FUNCTION = 0x1,
+ // GLOBAL, EVENT, and TABLE are in here but LLVM doesn't use them yet.
+ WASM_COMDAT_SECTION = 0x5,
};
// Kind codes used in the custom "linking" section in the WASM_SYMBOL_TABLE
@@ -298,6 +342,7 @@
WASM_SYMBOL_TYPE_GLOBAL = 0x2,
WASM_SYMBOL_TYPE_SECTION = 0x3,
WASM_SYMBOL_TYPE_EVENT = 0x4,
+ WASM_SYMBOL_TYPE_TABLE = 0x5,
};
// Kinds of event attributes.
@@ -316,6 +361,7 @@
const unsigned WASM_SYMBOL_UNDEFINED = 0x10;
const unsigned WASM_SYMBOL_EXPORTED = 0x20;
const unsigned WASM_SYMBOL_EXPLICIT_NAME = 0x40;
+const unsigned WASM_SYMBOL_NO_STRIP = 0x80;
#define WASM_RELOC(name, value) name = value,
@@ -332,7 +378,8 @@
F32 = WASM_TYPE_F32,
F64 = WASM_TYPE_F64,
V128 = WASM_TYPE_V128,
- EXCEPT_REF = WASM_TYPE_EXCEPT_REF,
+ FUNCREF = WASM_TYPE_FUNCREF,
+ EXTERNREF = WASM_TYPE_EXTERNREF,
};
struct WasmSignature {