diff --git a/CHANGELOG.md b/CHANGELOG.md index f64445e..103ae9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Use `GlobalConfig.ASM_INDENTATION` and `GlobalConfig.ASM_INDENTATION_LABELS` to disable this behavior. +### Fixed + +- Prevent generating labels for ignored symbols that are referenced by function + calls (ie in a `jal`). + ## [1.30.0] - 2024-09-10 ### Changed diff --git a/spimdisasm/common/ContextSymbols.py b/spimdisasm/common/ContextSymbols.py index f0d8283..cfd811d 100644 --- a/spimdisasm/common/ContextSymbols.py +++ b/spimdisasm/common/ContextSymbols.py @@ -728,6 +728,9 @@ def getCsvHeader() -> str: output += "isDefined,isUserDeclared,isAutogenerated," output += "isMaybeString,failedStringDecoding,isMaybePascalString,failedPascalStringDecoding," output += "referenceCounter," + if False: + output += "referenceFunctions," + output += "referenceSymbols," output += "parentFunction," output += "parentFileName," output += "inFileOffset," @@ -760,6 +763,9 @@ def toCsv(self) -> str: output += f"{self.isDefined},{self.isUserDeclared},{self.isAutogenerated}," output += f"{self.isMaybeString},{self.failedStringDecoding},{self.isMaybePascalString},{self.failedPascalStringDecoding}," output += f"{self.referenceCounter}," + if False: + output += f"\"{','.join(x.getName() for x in self.referenceFunctions)}\"," + output += f"\"{','.join(x.getName() for x in self.referenceSymbols)}\"," if self.parentFunction is not None: output += f"{self.parentFunction.getName()}," diff --git a/spimdisasm/mips/symbols/MipsSymbolFunction.py b/spimdisasm/mips/symbols/MipsSymbolFunction.py index 28efd02..11544b4 100644 --- a/spimdisasm/mips/symbols/MipsSymbolFunction.py +++ b/spimdisasm/mips/symbols/MipsSymbolFunction.py @@ -428,6 +428,9 @@ def analyze(self) -> None: # Branches for instrOffset, targetBranchVram in self.instrAnalyzer.branchInstrOffsets.items(): + if self.context.isAddressBanned(targetBranchVram): + continue + if common.GlobalConfig.INPUT_FILE_TYPE == common.InputFileType.ELF: if self.getVromOffset(instrOffset) in self.context.globalRelocationOverrides: # Avoid creating wrong symbols on elf files @@ -442,6 +445,9 @@ def analyze(self) -> None: # Function calls for instrOffset, targetVram in self.instrAnalyzer.funcCallInstrOffsets.items(): + if self.context.isAddressBanned(targetVram): + continue + if common.GlobalConfig.INPUT_FILE_TYPE == common.InputFileType.ELF: if self.getVromOffset(instrOffset) in self.context.globalRelocationOverrides: # Avoid creating wrong symbols on elf files @@ -521,6 +527,9 @@ def analyze(self) -> None: # Jump tables for targetVram in self.instrAnalyzer.referencedJumpTableOffsets.values(): + if self.context.isAddressBanned(targetVram): + continue + jumpTable = self.addJumpTable(targetVram, isAutogenerated=True) jumpTable.parentFunction = self.contextSym self.contextSym.jumpTables.add(jumpTable.vram, jumpTable)