diff --git a/CHANGELOG.md b/CHANGELOG.md index c5790458..0bf0de75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # splat Release Notes +### 0.27.3 +* Added new global option `subalign_override`. If set, overrides the subalign of all segments to the specified value. Unset by default (no change in default behavior). +* Removed global option `emit subalign`. Shiftability problems are great. + ### 0.27.2 * Added new global option `emit_subalign`. If disabled, subalign directives will not be emitted in the generated linker script. Enabled by default (no change in default behavior). diff --git a/README.md b/README.md index 7955ee0b..39f8b78c 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ The brackets corresponds to the optional dependencies to install while installin If you use a `requirements.txt` file in your repository, then you can add this library with the following line: ```txt -splat64[mips]>=0.27.2,<1.0.0 +splat64[mips]>=0.27.3,<1.0.0 ``` ### Optional dependencies diff --git a/docs/Configuration.md b/docs/Configuration.md index d6e5c520..ab58f33b 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -349,12 +349,12 @@ subalign: 4 `16` -### emit_subalign +### subalign_override -Controls whether the `SUBALIGN` directive can be emitted in generated linker scripts. Enabled by default. +Overrides the `SUBALIGN` value for all segments. `null` by default. This parameter was added as a way to override standard behavior with multiple yamls. -The base project yaml may need to use subalign for matching purposes, but shiftable builds might not want such a linker script. +The base project yaml may need to use subalign for matching purposes, but shiftable builds might need a different subalign value. ### auto_link_sections diff --git a/pyproject.toml b/pyproject.toml index 199c9fdc..891e6342 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "splat64" # Should be synced with src/splat/__init__.py -version = "0.27.2" +version = "0.27.3" description = "A binary splitting tool to assist with decompilation and modding projects" readme = "README.md" license = {file = "LICENSE"} diff --git a/src/splat/__init__.py b/src/splat/__init__.py index 5c310cf6..335f0b2e 100644 --- a/src/splat/__init__.py +++ b/src/splat/__init__.py @@ -1,7 +1,7 @@ __package_name__ = __name__ # Should be synced with pyproject.toml -__version__ = "0.27.2" +__version__ = "0.27.3" __author__ = "ethteck" from . import util as util diff --git a/src/splat/segtypes/linker_entry.py b/src/splat/segtypes/linker_entry.py index 492071ff..6c4015ea 100644 --- a/src/splat/segtypes/linker_entry.py +++ b/src/splat/segtypes/linker_entry.py @@ -592,7 +592,9 @@ def _begin_segment( if not noload: seg_rom_start = get_segment_rom_start(seg_name) line += f" AT({seg_rom_start})" - if options.opts.emit_subalign and segment.subalign != None: + if options.opts.subalign_override is not None: + line += f" SUBALIGN({options.opts.subalign_override})" + elif segment.subalign != None: line += f" SUBALIGN({segment.subalign})" self._writeln(line) @@ -634,7 +636,9 @@ def _begin_partial_segment(self, section_name: str, segment: Segment, noload: bo if noload: line += " (NOLOAD)" line += " :" - if options.opts.emit_subalign and segment.subalign != None: + if options.opts.subalign_override is not None: + line += f" SUBALIGN({options.opts.subalign_override})" + elif segment.subalign != None: line += f" SUBALIGN({segment.subalign})" self._writeln(line) diff --git a/src/splat/util/options.py b/src/splat/util/options.py index 7035b59c..e7eb2a8b 100644 --- a/src/splat/util/options.py +++ b/src/splat/util/options.py @@ -92,8 +92,8 @@ class SplatOpts: # Linker script # Determines the default subalign value to be specified in the generated linker script subalign: Optional[int] - # Determines whether to emit the subalign directive in the generated linker script - emit_subalign: bool + # An optional override value for all segments' subalign values + subalign_override: Optional[int] # The following option determines a list of sections for which automatic linker script entries should be added auto_link_sections: List[str] # Determines the desired path to the linker script that splat will generate @@ -435,7 +435,7 @@ def parse_endianness() -> Literal["big", "little"]: lib_path=p.parse_path(base_path, "lib_path", "lib"), elf_section_list_path=p.parse_optional_path(base_path, "elf_section_list_path"), subalign=p.parse_optional_opt_with_default("subalign", int, 16), - emit_subalign=p.parse_opt("emit_subalign", bool, True), + subalign_override=p.parse_optional_opt("subalign_override", int), auto_link_sections=p.parse_opt( "auto_link_sections", list, [".data", ".rodata", ".bss"] ),