- C 99.4%
- CMake 0.6%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
All checks were successful
Build / build (push) Successful in 23s
Neither platform's package ever included the repo's own LICENSE. Kept outside the shared tools/ directory (licenses/srxfixup/, not tools/LICENSE) - ninja/srxfixup/tools all extract into the same $PS2DEV/tools/, so a bare LICENSE filename there would risk one component's file silently overwriting another's, matching the same per-component licenses/ convention already used for ninja. Co-Authored-By: Claude Sonnet 5 <[email protected]> |
||
| .forgejo/workflows | ||
| src | ||
| .clang-format | ||
| .gitignore | ||
| CMakeLists.txt | ||
| LICENSE | ||
| README.md | ||
srxfixup
This tool mainly handles generation of IRX and ERX files, mainly used as relocatable executables or libraries. This tool performs the following tasks on relocatable ELF files in order to ensure that loadcore can load it as a relocatable file:
-
Sets the ELF header
e_typeto0xFF80,0xFF81, or0xFF91, depending on the features and architecture used -
Creates the
.iopmodor.eemodsection and first program header, containing metadata about the file, such as name, version, and section sizes/offsets -
Rebuilds relocations
Building
Builds with either MSVC (the default CMake generator on Windows) or GCC/Clang:
cmake -S . -B build
cmake --build build --config Release
cmake --install build --config Release --prefix /path/to/install
Installing produces bin/srxfixup plus the eefixup, erx-strip,
iopfixup, and irx-strip aliases described below.
Aliases
srxfixup picks its EE/IOP and fixup-vs-strip behavior from argv[0] (see
main() in src/srxfixup.c), so it is installed under these additional
names, each a plain copy of the same binary:
iopfixupirx-stripeefixuperx-strip
Usage
To see usage and possible command line arguments that can be used with the program, run it without arguments.
Zero-.text symbol check
When processing a relocatable ELF (ET_REL), srxfixup checks for function
or no-type symbols in the .text section whose st_value is exactly 0. Such
symbols indicate that real code was placed first in .text by the linker.
If an IOP export table has a zeroed or uninitialized entry, the dispatcher
will issue a jal 0x0 — silently jumping into whatever function sits at
.text offset 0 instead of faulting. The symbols _start and _ftext are
excluded because they are entry points / linker labels that are never
dispatched through an export table.
If any offending symbol is found, srxfixup prints an error like:
ERROR: foo.irx: symbol 'bar' (sym#3) is in .text with value 0 -- if this module has an export table, put exports.o first in IOP_OBJS and move _retonly after DECLARE_EXPORT_TABLE in exports.tab; otherwise use --allow-zero-text.
and exits with a non-zero status so the build fails.
For modules with an export table, the fix is to ensure exports.o is
first in IOP_OBJS and that the _retonly definition appears after
DECLARE_EXPORT_TABLE in exports.tab. This places the export-table struct
(STT_OBJECT) at .text offset 0 instead of function code.
For modules without an export table, the jal 0x0 hazard does not apply.
Use --allow-zero-text to suppress the check.
License
Licensed under the Academic Free License version 2.0 — see LICENSE.
Acknowledgements
Extracted from the ps2dev/ps2sdk project into its own repo, built standalone with CMake instead of PS2SDK's own Makefiles.
This project is not affiliated with, endorsed by, or officially connected to ps2sdk, ps2dev, or any of their maintainers, in any way. It's an independent fork - if something's broken here, it's ours to fix, not theirs. Please don't file issues about this project against any upstream repository.