Skip to content

Commit 46abf6a

Browse files
committed
Fix missing recomp .data/.rodata syms
1 parent c9ed25a commit 46abf6a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tools/gen_recomp_syms.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def gen_core_syms(syms_toml: TextIO, datasyms_toml: TextIO):
6767
value = sym.entry["st_value"]
6868
size = sym.entry["st_size"]
6969
st_shndx = sym.entry["st_shndx"]
70+
st_info_type = sym.entry["st_info"]["type"]
7071

7172
if sym.name.startswith("L8"):
7273
continue
@@ -92,11 +93,9 @@ def gen_core_syms(syms_toml: TextIO, datasyms_toml: TextIO):
9293
pass
9394
elif value >= text_end:
9495
# Data
95-
if st_shndx != "SHN_ABS":
96-
continue
97-
98-
data_global = { "name": sym.name, "vram": value }
99-
data_globals.append(data_global)
96+
if (st_info_type == "STT_NOTYPE" and st_shndx == "SHN_ABS") or (st_info_type == "STT_OBJECT"):
97+
data_global = { "name": sym.name, "vram": value }
98+
data_globals.append(data_global)
10099

101100
# Add any functions defined in the hacks table that wasn't found in the .elf
102101
for (vram, hack) in FUNCTION_DEF_HACKS.items():
@@ -105,7 +104,9 @@ def gen_core_syms(syms_toml: TextIO, datasyms_toml: TextIO):
105104
funcs.append(func)
106105
print("Adding manual function definition {} @ 0x{:X} with size 0x{:X}".format(hack["name"], vram, hack["size"]))
107106

107+
# Sort
108108
funcs.sort(key=lambda f : f["vram"])
109+
data_globals.sort(key=lambda f : f["vram"])
109110

110111
# Write function symbols
111112
syms_toml.write("[[section]]\n")

0 commit comments

Comments
 (0)