diff --git a/CHANGELOG.md b/CHANGELOG.md index c6ec65b8..27a7307c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.32.0] - 2024-12-28 + +### Added + +- Add `referencedVrams` member to `SymbolBase`. + - Contains every vram that is referenced by the current symbol. + +### Fixed + +- Fix jumptable labels sometimes missing their rom suffix, again. + ## [1.31.3] - 2024-12-21 ### Fixed @@ -1720,6 +1731,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Version 1.0.0 [unreleased]: https://github.com/Decompollaborate/spimdisasm/compare/master...develop +[1.32.0]: https://github.com/Decompollaborate/spimdisasm/compare/1.31.3...1.32.0 [1.31.3]: https://github.com/Decompollaborate/spimdisasm/compare/1.31.2...1.31.3 [1.31.2]: https://github.com/Decompollaborate/spimdisasm/compare/1.31.1...1.31.2 [1.31.1]: https://github.com/Decompollaborate/spimdisasm/compare/1.31.0...1.31.1 diff --git a/pyproject.toml b/pyproject.toml index d2a274ab..26a080ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ [project] name = "spimdisasm" # Version should be synced with spimdisasm/__init__.py -version = "1.31.3" +version = "1.32.0" description = "MIPS disassembler" readme = "README.md" license = {file = "LICENSE"} diff --git a/spimdisasm/__init__.py b/spimdisasm/__init__.py index 251e5461..ea0817b8 100644 --- a/spimdisasm/__init__.py +++ b/spimdisasm/__init__.py @@ -5,7 +5,7 @@ from __future__ import annotations -__version_info__: tuple[int, int, int] = (1, 31, 3) +__version_info__: tuple[int, int, int] = (1, 32, 0) __version__ = ".".join(map(str, __version_info__))# + "-dev0" __author__ = "Decompollaborate" diff --git a/spimdisasm/mips/sections/MipsSectionRodata.py b/spimdisasm/mips/sections/MipsSectionRodata.py index de4beb01..484b538c 100644 --- a/spimdisasm/mips/sections/MipsSectionRodata.py +++ b/spimdisasm/mips/sections/MipsSectionRodata.py @@ -53,10 +53,18 @@ def _analyze_processJumptable(self, localOffset: int, w: int, contextSym: common return None, firstJumptableWord # Generate the current label - labelAddr = w if lastVramSymbol.isGot and common.GlobalConfig.GP_VALUE is not None: labelAddr = common.GlobalConfig.GP_VALUE + rabbitizer.Utils.from2Complement(w, 32) - labelSym = self.addJumpTableLabel(labelAddr, isAutogenerated=True) + labelVrom = None + else: + labelAddr = w + maybeVrom = self.vromStart + labelAddr - self.vram + segment = self.getSegmentForVrom(self.segmentVromStart) + if not segment._isTheUnknownSegment and segment.isVromInRange(maybeVrom): + labelVrom = maybeVrom + else: + labelVrom = None + labelSym = self.addJumpTableLabel(labelAddr, isAutogenerated=True, symbolVrom=labelVrom) if labelSym.unknownSegment: return None, firstJumptableWord diff --git a/spimdisasm/mips/symbols/MipsSymbolBase.py b/spimdisasm/mips/symbols/MipsSymbolBase.py index 38ef25ae..937ef412 100644 --- a/spimdisasm/mips/symbols/MipsSymbolBase.py +++ b/spimdisasm/mips/symbols/MipsSymbolBase.py @@ -28,6 +28,9 @@ def __init__(self, context: common.Context, vromStart: int, vromEnd: int, inFile self.relocs: dict[int, common.RelocationInfo] = dict() "key: word offset" + self.referencedVrams: set[int] = set() + "Every referenced vram found" + def getName(self) -> str: return self.contextSym.getName() @@ -228,6 +231,7 @@ def analyze(self) -> None: if referencedSym is not None: if not referencedSym.isJumpTable(): referencedSym.referenceSymbols.add(self.contextSym) + self.referencedVrams.add(referencedSym.vram) def getEndOfLineComment(self, wordIndex: int) -> str: diff --git a/spimdisasm/mips/symbols/MipsSymbolFunction.py b/spimdisasm/mips/symbols/MipsSymbolFunction.py index 0d57cdb6..c33078e3 100644 --- a/spimdisasm/mips/symbols/MipsSymbolFunction.py +++ b/spimdisasm/mips/symbols/MipsSymbolFunction.py @@ -545,6 +545,8 @@ def analyze(self) -> None: self.contextSym.autodetectedSize = self.sizew*4 + self.referencedVrams = self.instrAnalyzer.referencedVrams + def countExtraPadding(self) -> int: count = 0