You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
pack including static symbols using 'nm' (#646)
Co-authored-by: someone2639 <someone2639@gmail.com>
This commit is contained in:
2
Makefile
2
Makefile
@@ -873,7 +873,7 @@ $(BUILD_DIR)/goddard.txt: $(BUILD_DIR)/sm64_prelim.elf
|
||||
|
||||
$(BUILD_DIR)/asm/debug/map.o: asm/debug/map.s $(BUILD_DIR)/sm64_prelim.elf
|
||||
$(call print,Assembling:,$<,$@)
|
||||
$(V)python3 tools/mapPacker.py $(BUILD_DIR)/sm64_prelim.map $(BUILD_DIR)/bin/addr.bin $(BUILD_DIR)/bin/name.bin
|
||||
$(V)python3 tools/mapPacker.py $(BUILD_DIR)/sm64_prelim.elf $(BUILD_DIR)/bin/addr.bin $(BUILD_DIR)/bin/name.bin
|
||||
$(V)$(CROSS)gcc -c $(ASMFLAGS) $(foreach i,$(INCLUDE_DIRS),-Wa,-I$(i)) -x assembler-with-cpp -MMD -MF $(BUILD_DIR)/$*.d -o $@ $<
|
||||
|
||||
# Link SM64 ELF file
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import sys, struct
|
||||
import sys, struct, subprocess
|
||||
|
||||
class MapEntry():
|
||||
def __init__(self, nm, addr):
|
||||
@@ -15,11 +15,19 @@ structDef = ">LLLL"
|
||||
|
||||
symNames = []
|
||||
|
||||
with open(sys.argv[1]) as f:
|
||||
for line in f:
|
||||
if "0x000000008" in line and "=" not in line and "." not in line and "*" not in line and "load address" not in line:
|
||||
tokens = line.split()
|
||||
symNames.append(MapEntry(tokens[1], int(tokens[0], 16)))
|
||||
|
||||
proc = subprocess.Popen(["nm", "-S", sys.argv[1]], stdout=subprocess.PIPE)
|
||||
|
||||
symbols = proc.communicate()[0].decode('ascii').split("\n")
|
||||
for line in symbols:
|
||||
# format:
|
||||
# 80153210 000000f8 T global_sym
|
||||
# 80153210 t static_sym
|
||||
tokens = line.split()
|
||||
if len(tokens) >= 3 and len(tokens[-2]) == 1:
|
||||
addr = int(tokens[0], 16)
|
||||
if addr & 0x80000000 and tokens[-2].lower() == "t":
|
||||
symNames.append(MapEntry(tokens[-1], addr))
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user