Skip to content

Commit

Permalink
Check for duplicate symbols (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrederoxDev authored Apr 22, 2023
1 parent 726f9e2 commit 19ef3d0
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tools/process_symbol_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ def __parse_vtables(self, value):
for vtable in self.vtables.keys():
self.__process_vtable(vtable)


def __add_func(self, version: str, name: str, mangled_name: str, addr: str):
full_addr = Map.__addr_helper(addr, mangled_name)

Expand All @@ -228,6 +227,10 @@ def __add_func(self, version: str, name: str, mangled_name: str, addr: str):
def __parse_funcs(self, value):
for obj in value:
mangled_name = obj["name"]
if any(item[1] == mangled_name for item in self.symbol_list):
print(f"Found duplicate symbol: '{mangled_name}'")
continue

name = Windows.mangle_to_var(mangled_name)
addr = obj["address"]

Expand All @@ -244,6 +247,10 @@ def __parse_funcs(self, value):

def __parse_variables(self, key, value):
for var_name in value.keys():
if var_name in self.var_list:
print(f"Found duplicate variable: '{var_name}'")
continue

self.var_list.append(var_name)
addr = value[var_name]
if type(addr) is str:
Expand Down Expand Up @@ -378,8 +385,6 @@ def generate_init(self, out: Output):
out.cxx("}")
out.cxx("")



# Supported Platforms
class Windows:
def mangle_to_var(name):
Expand Down Expand Up @@ -442,7 +447,6 @@ def generate_asm(self, arch: str, out: Output, map: Map):
case _:
print(f"Unsupported arch: {arch}")


def generate(args: Args, out: Output, map: Map):
file_comment = "This file was automatically generated using tools/" + os.path.basename(__file__)
gen_time = datetime.datetime.utcnow().strftime("%a %b %d %Y %H:%M:%S UTC")
Expand Down Expand Up @@ -499,8 +503,6 @@ def should_rebuild_symbols(args: Args) -> bool:

return False



args = Args()
if should_rebuild_symbols(args):
out = Output(args)
Expand Down

0 comments on commit 19ef3d0

Please sign in to comment.