IOP/EE relocatable ELF fixup tool (srxfixup/iopfixup/eefixup/irx-strip/erx-strip), extracted from ps2sdk. CMake-built.
  • C 99.4%
  • CMake 0.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
techwritescode dc8b26e00b
All checks were successful
Build / build (push) Successful in 23s
Bundle this repo's own real AFL-2.0 license with every release
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]>
2026-09-08 18:32:10 -05:00
.forgejo/workflows Bundle this repo's own real AFL-2.0 license with every release 2026-09-08 18:32:10 -05:00
src Replace GNU-only extensions for MSVC portability 2026-09-02 14:27:13 -05:00
.clang-format Extract srxfixup from ps2sdk into its own repo, build with CMake 2026-09-02 14:22:49 -05:00
.gitignore Extract srxfixup from ps2sdk into its own repo, build with CMake 2026-09-02 14:22:49 -05:00
CMakeLists.txt Add release workflow and real cmake --install rules 2026-09-02 15:35:44 -05:00
LICENSE Extract srxfixup from ps2sdk into its own repo, build with CMake 2026-09-02 14:22:49 -05:00
README.md Add release workflow and real cmake --install rules 2026-09-02 15:35:44 -05:00

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_type to 0xFF80, 0xFF81, or 0xFF91, depending on the features and architecture used

  • Creates the .iopmod or .eemod section 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:

  • iopfixup
  • irx-strip
  • eefixup
  • erx-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.