Skip to content

Commit

Permalink
Add EEGCC compiler option (#363)
Browse files Browse the repository at this point in the history
* Add EEGCC compiler option

* some cleanup

* version bump

* `SYMBOL_ALIGNMENT_REQUIRES_ALIGNED_SECTION`

* forgor this
  • Loading branch information
AngheloAlf authored Mar 27, 2024
1 parent dd492e8 commit 5ceb843
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 14 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# splat Release Notes

### 0.23.1

* New `EEGCC` compiler option.
* Provide specific adjustments for the GCC compiler used for the PS2 platform.
* `spimdisasm` 1.24.2 or above is now required.

### 0.23.0

* splat now checks if symbol names can be valid filepaths and produce an error if not.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.23.0,<1.0.0
splat64[mips]>=0.23.1,<1.0.0
```

### Optional dependencies
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "splat64"
# Should be synced with src/splat/__init__.py
version = "0.23.0"
version = "0.23.1"
description = "A binary splitting tool to assist with decompilation and modding projects"
readme = "README.md"
license = {file = "LICENSE"}
Expand All @@ -20,7 +20,7 @@ dependencies = [

[project.optional-dependencies]
mips = [
"spimdisasm>=1.23.0,<2.0.0", # This value should be keep in sync with the version listed on disassembler/spimdisasm_disassembler.py
"spimdisasm>=1.24.2,<2.0.0", # This value should be keep in sync with the version listed on disassembler/spimdisasm_disassembler.py
"rabbitizer>=1.8.0,<2.0.0",
"pygfxd",
"n64img>=0.1.4",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ tqdm
intervaltree
colorama
# This value should be keep in sync with the version listed on disassembler/spimdisasm_disassembler.py and pyproject.toml
spimdisasm>=1.23.0
spimdisasm>=1.24.2
rabbitizer>=1.8.0
pygfxd
n64img>=0.1.4
Expand Down
2 changes: 1 addition & 1 deletion src/splat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
__package_name__ = __name__

# Should be synced with pyproject.toml
__version__ = "0.23.0"
__version__ = "0.24.1"
__author__ = "ethteck"

from . import util as util
Expand Down
4 changes: 3 additions & 1 deletion src/splat/disassembler/spimdisasm_disassembler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class SpimdisasmDisassembler(disassembler.Disassembler):
# This value should be kept in sync with the version listed on requirements.txt and pyproject.toml
SPIMDISASM_MIN = (1, 23, 0)
SPIMDISASM_MIN = (1, 24, 2)

def configure(self):
# Configure spimdisasm
Expand Down Expand Up @@ -71,6 +71,8 @@ def configure(self):
spimdisasm.common.GlobalConfig.COMPILER = spimdisasm.common.Compiler.GCC
elif selected_compiler == compiler.IDO:
spimdisasm.common.GlobalConfig.COMPILER = spimdisasm.common.Compiler.IDO
elif selected_compiler == compiler.EEGCC:
spimdisasm.common.GlobalConfig.COMPILER = spimdisasm.common.Compiler.EEGCC

spimdisasm.common.GlobalConfig.DETECT_REDUNDANT_FUNCTION_END = (
options.opts.detect_redundant_function_end
Expand Down
1 change: 1 addition & 0 deletions src/splat/platforms/ps2.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ def init(target_bytes: bytes):
rabbitizer.config.toolchainTweaks_treatJAsUnconditionalBranch = False

spimdisasm.common.GlobalConfig.ABI = spimdisasm.common.Abi.EABI64
spimdisasm.common.GlobalConfig.SYMBOL_ALIGNMENT_REQUIRES_ALIGNED_SECTION = True
14 changes: 7 additions & 7 deletions src/splat/segtypes/common/c.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import spimdisasm

from ...util import log, options, symbols
from ...util.compiler import GCC, SN64, IDO
from ...util.compiler import IDO
from ...util.symbols import Symbol

from .codesubsegment import CommonSegCodeSubsegment
Expand Down Expand Up @@ -105,19 +105,19 @@ def find_include_rodata(text: str):
def get_global_asm_funcs(c_file: Path) -> Set[str]:
with c_file.open() as f:
text = CommonSegC.strip_c_comments(f.read())
if options.opts.compiler in [GCC, SN64]:
return set(CommonSegC.find_include_asm(text))
else:
if options.opts.compiler == IDO:
return set(m.group(2) for m in C_GLOBAL_ASM_IDO_RE.finditer(text))
else:
return set(CommonSegC.find_include_asm(text))

@staticmethod
def get_global_asm_rodata_syms(c_file: Path) -> Set[str]:
with c_file.open() as f:
text = CommonSegC.strip_c_comments(f.read())
if options.opts.compiler in [GCC, SN64]:
return set(CommonSegC.find_include_rodata(text))
else:
if options.opts.compiler == IDO:
return set(m.group(2) for m in C_GLOBAL_ASM_IDO_RE.finditer(text))
else:
return set(CommonSegC.find_include_rodata(text))

@staticmethod
def is_text() -> bool:
Expand Down
4 changes: 3 additions & 1 deletion src/splat/util/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ class Compiler:

IDO = Compiler("IDO", include_macro_inc=False, asm_emit_size_directive=False)

compiler_for_name = {"GCC": GCC, "SN64": SN64, "IDO": IDO}
EEGCC = Compiler("EEGCC")

compiler_for_name = {"GCC": GCC, "SN64": SN64, "IDO": IDO, "EEGCC": EEGCC}


def for_name(name: str) -> Compiler:
Expand Down

0 comments on commit 5ceb843

Please sign in to comment.