aboutsummaryrefslogtreecommitdiffstats
path: root/bruiser/wasm/section_structs.py
diff options
context:
space:
mode:
Diffstat (limited to 'bruiser/wasm/section_structs.py')
-rw-r--r--bruiser/wasm/section_structs.py97
1 files changed, 60 insertions, 37 deletions
diff --git a/bruiser/wasm/section_structs.py b/bruiser/wasm/section_structs.py
index b254ff9..219f7ea 100644
--- a/bruiser/wasm/section_structs.py
+++ b/bruiser/wasm/section_structs.py
@@ -9,19 +9,75 @@ class WASM_SECTION(object):
self.name = str()
self.payload_data = bytes()
+class WASM_SEGMENT_INFO():
+ def __int__(self):
+ self.count = int()
+ self.segments = []
-class Reloc_Entry_1():
+class WASM_SEGMENT_INFO_SEGMENT():
def __init__(self):
- self.offset = int()
+ self.name_len = int()
+ self.name_data = str()
+ self.alignment = int()
+ self.flags = int()
+
+class WASM_COMDAT_INFO_SUB():
+ def __init__(self):
+ self.count = int()
+ self.comdats = []
+
+class COMDAT():
+ def __init(self):
+ self.name_len = int()
+ self.name_str = str()
+ self.flags = int()
+ self.count = int()
+ self.comdat_syms = []
+
+class COMDAT_SYM():
+ def __init(self):
+ self.kind = int()
self.index = int()
+class WASM_COMDAT_KIND():
+ WASM_COMDAT_DATA = 0
+ WASM_COMDAT_FUNCTION = 1
+ WASM_COMDAT_GLOBAL = 2
+
+class WASM_INIT_FUNCS():
+ def __init__(self):
+ self.count = int()
+ self.functions = []
-class Reloc_Entry_2():
+class WASM_SYMBOL_TABLE():
def __init__(self):
+ self.count = int()
+ self.syminfo = []
+
+class SYM_INFO():
+ def __init__(self):
+ self.kind = int()
+ self.flags = int()
+
+class SYM_INFO_FLAGS():
+ WASM_SYM_BINDING_WEAK = 1
+ WASM_SYM_BINDING_LOCAL = 2
+ WASM_SYM_VISIBILITY_HIDDEN = 4
+ WASM_SYM_UNDEFINED = 16
+
+
+class Rel_Entry():
+ def __int__(self):
+ self.type = int()
self.offset = int()
self.index = int()
- self.addend = int()
+class RelA_Entry():
+ def __int__(self):
+ self.type = int()
+ self.offset = int()
+ self.index = int()
+ self.addend = int()
class Relocation_Section():
def __int__(self):
@@ -31,7 +87,6 @@ class Relocation_Section():
self.count = int()
self.entries = int()
-
class Func_Type():
def __init__(self):
self.form = int()
@@ -40,26 +95,22 @@ class Func_Type():
self.return_cnt = int()
self.return_type = []
-
class Global_Type():
def __init__(self):
self.content_type = int()
self.mutability = int()
-
class Resizable_Limits():
def __init__(self):
self.flags = int()
self.initial = int()
self.maximum = int()
-
class Table_Type():
def __init__(self):
self.element_type = int()
self.limit = Resizable_Limits()
-
class External_Kind():
def __init__(self):
self.Function = 0
@@ -67,23 +118,19 @@ class External_Kind():
self.Memory = 2
self.Global = 3
-
class Memory_Type():
def __init__(self):
self.limits = [Resizable_Limits()]
-
# @DEVI-FIXME-
class Init_Expr():
pass
-
class Type_Section():
def __init__(self):
self.count = []
self.func_types = []
-
class Import_Entry():
def __init__(self):
self.module_len = int()
@@ -93,45 +140,38 @@ class Import_Entry():
self.kind = int()
self.type = int()
-
class Import_Section():
def __init__(self):
self.count = []
self.import_entry = []
-
class Function_Section():
def __init__(self):
self.count = []
self.type_section_index = [int()]
-
class Table_Section():
def __init__(self):
self.count = []
self.table_types = []
-
class Memory_Section():
def __init__(self):
self.count = []
# Resizable_Limits
self.memory_types = []
-
class Global_Variable():
def __init__(self):
self.global_type = Global_Type()
self.init_expr = []
-
class Global_Section():
def __init__(self):
self.count = []
# Global_Variable
self.global_variables = []
-
class Export_Entry():
def __init__(self):
self.field_len = int()
@@ -139,19 +179,16 @@ class Export_Entry():
self.kind = int()
self.index = int()
-
class Export_Section():
def __init__(self):
self.count = []
# Export_Entry
self.export_entries = []
-
class Start_Section():
def __init__(self):
self.function_section_index = []
-
class Elem_Segment():
def __init__(self):
self.index = int()
@@ -159,27 +196,23 @@ class Elem_Segment():
self.num_elem = int()
self.elems = []
-
class Element_Section():
def __init__(self):
self.count = []
# Elem_Segment
self.elem_segments = []
-
class Local_Entry():
def __init__(self):
self.count = int()
self.type = int()
-
class WASM_Ins():
def __init__(self):
self.opcode = str()
self.opcodeint = int()
self.operands = []
-
class Func_Body():
def __init__(self):
self.body_size = int()
@@ -190,14 +223,12 @@ class Func_Body():
self.code = []
self.end = int()
-
class Code_Section():
def __init__(self):
self.count = []
# Func_Body
self.func_bodies = []
-
class Data_Segment():
def __init__(self):
self.index = int()
@@ -205,53 +236,45 @@ class Data_Segment():
self.size = int()
self.data = []
-
class Data_Section():
def __init__(self):
self.count = []
# Data_Segment
self.data_segments = []
-
class Name_Type():
Module = 0
Function = 1
Local = 2
-
class Name_Section_Entry(object):
def __init__(self, name_type, name_payload_len, name_payload_data):
self.name_type = name_type
self.name_payload_len = name_payload_len
self.name_payload_data = name_payload_data
-
class Name_Section(object):
def __init__(self, name_section_entry):
self.name_section_entry = []
self.name_section_entry = name_section_entry
-
class Module_Name(object):
def __init__(self, name_len, name_str):
self.name_len = name_len
self.name_str = name_str
-
class Naming(object):
def __init__(self, index, name_len, name_str):
self.index = index
self.name_len = name_len
self.name_str = name_str
-
class Name_Map(object):
def __init__(self, count, naming):
self.count = count
self.naming = []
self.naming = naming
-
# the module class
class Module():
def __init__(self, type_section, import_section, function_section,