Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into fault
Browse files Browse the repository at this point in the history
  • Loading branch information
hensldm committed Dec 8, 2023
2 parents 4f8aeeb + 8d9b289 commit 14ac402
Show file tree
Hide file tree
Showing 55 changed files with 3,251 additions and 362 deletions.
16 changes: 13 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

MAKEFLAGS += --no-builtin-rules

SHELL = /bin/bash
.SHELLFLAGS = -o pipefail -c

#### Defaults ####

# If COMPARE is 1, check the output md5sum after building
Expand All @@ -20,6 +23,8 @@ RUN_CC_CHECK ?= 1
CC_CHECK_COMP ?= gcc
# Dump build object files
OBJDUMP_BUILD ?= 0
# Disassembles matched functions and migrated data as well
FULL_DISASM ?= 0
# Number of threads to compress with
N_THREADS ?= $(shell nproc)

Expand Down Expand Up @@ -69,7 +74,7 @@ $(error Native Windows is currently unsupported for building this repository, us
else ifeq ($(UNAME_S),Linux)
DETECTED_OS := linux
else ifeq ($(UNAME_S),Darwin)
DETECTED_OS := mac
DETECTED_OS := macos
MAKE := gmake
CPPFLAGS += -xc++
endif
Expand Down Expand Up @@ -157,6 +162,11 @@ ifeq ($(NON_MATCHING),0)
COMPFLAGS += --matching
endif

SPLAT_FLAGS ?=
ifneq ($(FULL_DISASM), 0)
SPLAT_FLAGS += --disassemble-all
endif

#### Files ####

$(shell mkdir -p asm bin linker_scripts/$(VERSION)/auto)
Expand Down Expand Up @@ -215,7 +225,7 @@ setup:
extract:
$(RM) -r asm/$(VERSION) bin/$(VERSION)
$(CAT) yamls/$(VERSION)/header.yaml yamls/$(VERSION)/makerom.yaml yamls/$(VERSION)/main.yaml > $(SPLAT_YAML)
$(SPLAT) $(SPLAT_YAML)
$(SPLAT) $(SPLAT_FLAGS) $(SPLAT_YAML)

diff-init: uncompressed
$(RM) -rf expected/
Expand Down Expand Up @@ -255,7 +265,7 @@ $(BUILD_DIR)/%.o: %.bin
$(OBJCOPY) -I binary -O elf32-big $< $@

$(BUILD_DIR)/%.o: %.s
$(CPP) $(CPPFLAGS) $(BUILD_DEFINES) $(IINC) -I $(dir $*) $(COMMON_DEFINES) $(RELEASE_DEFINES) $(GBI_DEFINES) $(AS_DEFINES) $< | $(ICONV) $(ICONV_FLAGS) | $(AS) $(ASFLAGS) $(ENDIAN) $(IINC) -I $(dir $*) -o $@
$(ICONV) $(ICONV_FLAGS) $< | $(AS) $(ASFLAGS) $(ENDIAN) $(IINC) -I $(dir $*) -o $@
$(OBJDUMP_CMD)

$(BUILD_DIR)/%.o: %.c
Expand Down
54 changes: 54 additions & 0 deletions tools/splat/.github/workflows/publish_docs_to_wiki.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Based on script from https://github.com/orgs/community/discussions/25929

name: Publish docs to Wiki

# Trigger this action only if there are changes pushed to the docs/** directory under the main branch
on:
push:
paths:
- docs/** # This includes all sub folders
branches:
- main # This can be changed to any branch of your preference

jobs:
publish_docs_to_wiki:
name: Publish docs to Wiki
runs-on: ubuntu-latest
steps:
# Clone the wiki repository
- name: Checkout Wiki repository
uses: actions/checkout@v4
with:
repository: ${{ github.event.repository.owner.name }}/${{ github.event.repository.name }}.wiki
path: wiki_repo

# Clone the main repository
- name: Checkout main repository
uses: actions/checkout@v4
with:
repository: ${{ github.event.repository.owner.name }}/${{ github.event.repository.name }}
path: splat_repo

- name: Get the new Wiki files
run: |
cd wiki_repo
rm *.md
cp ../splat_repo/docs/* .
# `git log -1 --pretty=%aN` prints the current commit's author name
# `git log -1 --pretty=%aE` prints the current commit's author mail
- name: Stage new files
run: |
cd wiki_repo
git config user.name $(git log -1 --pretty=%aN)
git config user.email $(git log -1 --pretty=%aE)
git add .
# `git diff-index --quiet HEAD` returns non-zero if there are any changes.
# This allows to avoid making a commit/push if there are no changes to the Wiki files

# `git log -1 --pretty=%B` prints the current commit's message
- name: Push new files to the Wiki
run: |
cd wiki_repo
git diff-index --quiet HEAD || (git commit -m "$(git log -1 --pretty=%B)" && git push)
10 changes: 5 additions & 5 deletions tools/splat/.gitrepo
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
; DO NOT EDIT (unless you know what you are doing)
;
; This subdirectory is a git "subrepo", and this file is maintained by the
; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme
; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme
;
[subrepo]
remote = https://github.com/ethteck/splat.git
branch = master
commit = 172022a8141f4e25b20c61885bc94c94c06062b0
parent = 73c802a3bb33f347e761786c5b40b7bf6f272582
remote = git@github.com:ethteck/splat.git
branch = main
commit = 3e9e7cb7342f1b53084f4faffe0ed05e4ccf577c
parent = 8d6aac5bdfa6573d40a8d11dfe94448d64f75d46
method = merge
cmdver = 0.4.6
130 changes: 128 additions & 2 deletions tools/splat/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,132 @@
# splat Release Notes

### 0.19.6

* The `*_END` linker symbol of every section for each segment is now aligned to the configured alignment by default.
* New yaml option: `ld_align_section_vram_end`
* Allows to toggle aligning the `*_END` linker symbol of each section.
* Defaults to `True`.

### 0.19.5

* The `*_VRAM_END` linker symbol for each segment is now aligned to the configured alignment by default.
* New yaml option: `ld_align_segment_vram_end`
* Allows to toggle aligning the `*_VRAM_END` linker symbol.
* Defaults to `True`.

### 0.19.4

* Fix `ld_fill_value` not accepting `null` as a valid value on the yaml

### 0.19.3

* New yaml option: `ld_bss_is_noload`
* Allows to control if `bss` sections (and derivatived sections) will be put on a `NOLOAD` segment on the generated linker script or not.
* Applies to all `bss` (`sbss`, `common`, `scommon`, etc) sections.
* Defaults to `True`, meaning `bss` sections will be put on `NOLOAD` segments.

### 0.19.2

* `named_regs_for_c_funcs` (default True): Can be disabled to make c functions' disassembled functions contain numeric registers.

### 0.19.1

* Fixed disassembly of certain ps2 instructions to properly re-assemble in a compatible and matching way.

### 0.19.0: vram_classes

* New top-level yaml feature: `vram_classes`. This allows you to make common definitions for vram locations that can be applied to multiple segments. Please see the [documentation](docs/VramClasses.md) for more details!
* Renamed `ld_use_follows` to `ld_use_symbolic_vram_addresses` to more accurately describe what it's doing
* Renamed `vram_of_symbol` segment option to `vram_symbol` to provide consistency between the segment-level option and the vram class field.
* Removed `appears_after_overlays_addr` symbol_addrs option in favor of specifying this behavior with `vram_classes`
* Removed `dead` symbol_addrs option
* A warning is now emitted when the `sha1` top-level yaml option is not provided. Adding this is highly recommended, as it prevents errors using splat in which the wrong binary is provided.

### 0.18.3

* splat now will emit a `FILL(0)` statement on each segment of a linker script by default, to customize this behavior use the `ld_fill_value` yaml option or the per-segment `ld_fill_value` option.
* New yaml option: `ld_fill_value`
* Allows to specify the value of the `FILL` statement generated on every segment of the linker script.
* It must be either an integer, which will be used as the parameter for the `FILL` statement, or `null`, which tells splat to not emit `FILL` statements.
* This behavior can be customized per segment too.
* New per segment option: `ld_fill_value`
* Allows to specify the value of the `FILL` statement generated for this specific top-level segment of the linker script, ignoring the global configuration.
* If not set, then the global configuration is used.

### 0.18.2

* Fix rodata migration for `.rdata` sections (and other rodata sections that don't use the name `.rodata`)
* `spimdisasm` 1.18.0 or above is now required.

### 0.18.1

* New yaml options: `check_consecutive_segment_types`
* Allows to turn off checking for segment types not being in a consecutive order
* New option for segments: `linker_section_order` and `linker_section`
* `linker_section_order`: Allows overriding the section order used for linker script generation. Useful when a section of a file is not between the other sections of the same type in the ROM, for example a file having its data section between other files's rodata.
* `linker_section`: Allows to override the `.section` directive that will be used when generating the disassembly of the corresponding section, without needing to write an extension segment. This also affects the section name that will be used during link time. Useful for sections with special names, like an executable section named `.start`

### 0.18.0

* `symbol_addrs` parsing checks:
* Enforce lines contain a single `;`
* Enforce no duplicates (same vram, same rom)

### 0.17.3

* Move wiki to the `docs` folder
* Added the ability to specify `find_file_boundaries` on a per segment basis
* Fix `cpp` segment not symbolizing rodata symbols properly

### 0.17.2

* Added more support for PS2 elf files

### 0.17.1

* New yaml options: `ld_sections_allowlist` and `ld_sections_denylist`
* `ld_sections_allowlist`: A list of sections to preserve during link time. It can be useful to preserve debugging sections.
* `ld_sections_denylist`: A list of sections to discard during link time. It can be useful to avoid using the wildcard discard. Note that this option does not turn off `ld_discard_section`.

### 0.17.0

* BREAKING: Linker script generation now imposes the specified `section_order`, which may not completely reflect the yaml order.
* In case this new linker script generation can't be properly adapted to a repo, the old generation can be reenabled by using the `ld_legacy_generation` flag as a temporary solution. Keep in mind this option may be removed in the future.
* New yaml options related to linker script generation: `ld_partial_linking`, `ld_partial_scripts_path`, `ld_partial_build_segments_path`, `elf_path`, `ld_dependencies`
* `ld_partial_linking`: Changes how the linker script is generated, allowing partially linking each segment. This allows for faster linking times when making changes to files at the cost of a slower build time from a clean build and loosing filepaths in the mapfile. This is also known as "incremental linking". This option requires both `ld_partial_scripts_path` and `ld_partial_build_segments_path`.
* `ld_partial_scripts_path`: Folder were each intermediary linker script will be written to.
* `ld_partial_build_segments_path`: Folder where the built partially linked segments will be placed by the build system.
* `elf_path`: Path to the final elf target.
* `ld_dependencies`: Generate a dependency file for every linker script generated, including the main linker script and the ones for partial linking. Dependency files will have the same path and name as the corresponding linker script, but changing the extension to `.d`. Requires `elf_path` to be set.
* New misc yaml options: `asm_function_alt_macro` and `ique_symbols`
* `asm_function_alt_macro`: Allows to use a different label on symbols that are in the middle of functions (that are not branch targets of any kind) than the one used for the label for functions, allowing for alternative function entrypoints.
* `ique_symbols` Automatically fills libultra symbols that are exclusive for iQue. This option is ignored if platform is not N64.
* New "incbin" segments: `textbin`, `databin` and `rodatabin`
* Allows to specify binary blobs to be linked in a specific section instead of the data default.
* If a `textbin` section has a corresponding `databin` and/or `rodatabin` section with the same name then those will be included in the same generated assembly file.
* If a known symbol matches the vram of a incbin section then it will be emitted properly, allowing for better integration with the rest of splat's symbol system.
* `spimdisasm` 1.17.0 or above is now required.

### 0.16.10

* Produce an error if subsegments do not have an ascending vram order.
* This can happen because bss subsegments need their vram to be specified explicitly.

### 0.16.9

* Add command line argument `--disassemble-all`, which has the same effect as the `disassemble_all` yaml option so will disamble already matched functions as well as migrated data.
* Note: the command line argument takes precedence over the yaml, so will take effect even if the yaml option is set to false.

### 0.16.8

* Avoid ignoring the `align` defined in a segment for `code` segments

### 0.16.7

* Use `pylibyaml` to speed-up yaml parsing

### 0.16.6

* Add option `ld_rom_start`.
* Allows offsetting rom address linker symbols by some arbitrary value.
* Useful for SN64 games which often have rom addresses offset by 0xB0000000.
Expand Down Expand Up @@ -462,10 +588,10 @@ Internally, there's a new Symbol class which stores information about a symbol a

## 0.5 The Rename Update
* n64splat name changed to splat
* Some refactoring was done to support other platforms besides n64 in the future
* Some refactoring was done to support other platforms besides n64 in the future
* New `platform` option, which defaults to `n64`
* This will cause breaking changes in custom segments, so please refer to one of the changes in one of the n64 base segments for details
* Support for custom artifact paths
* Support for custom artifact paths
* New `undefined_syms_auto_path` option
* New `undefined_funcs_auto_path` option
* New `cache_path` option
Expand Down
2 changes: 1 addition & 1 deletion tools/splat/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# splat
A binary splitting tool to assist with decompilation and modding projects

Currently, only N64 and PSX binaries are supported.
Currently, only N64, PSX, and PS2 binaries are supported.

Please check out the [wiki](https://github.com/ethteck/splat/wiki) for more information including [examples](https://github.com/ethteck/splat/wiki/Examples) of projects that use splat.

Expand Down
Loading

0 comments on commit 14ac402

Please sign in to comment.