Overview
Thesprxlinker tool modifies ELF executables to prepare them for PlayStation 3 SPRX (Shared PRX) dynamic library linking. It fixes import stubs, function descriptors (OPDs), and ELF headers to conform to PS3 Cell OS requirements.
This tool must be run on your ELF file before converting it to SELF format with fself.
What is SPRX?
SPRX Libraries
Shared libraries (similar to .so/.dll) that provide system functions and APIs on PS3. Examples: libc, libgcm_sys, librsx.
Import Stubs
Function stubs that link your application to SPRX exports at runtime. Must be properly formatted for the PS3 loader.
Why sprxlinker?
When compiling PS3 applications with ppu-gcc, the linker creates import stubs for external library functions. However, these stubs need special formatting for the PS3’s dynamic loader:- OPD (Official Procedure Descriptor) Fixing: Function pointers need special 64-bit descriptors
- Import Count Correction: The number of imported functions must be accurately counted
- ELF Header Modification: The OS/ABI field must be set to
ELFOSABI_CELLLV2(102)
Command-Line Usage
Example
What sprxlinker Does
Fix Import Stub Counts
Scans
.lib.stub section and corrects import counts based on .rodata.sceFNID entriesBuild System Integration
The sprxlinker is automatically called in PSL1GHT’sppu_rules:
Automatic Usage
When using PSL1GHT Makefiles, sprxlinker runs automatically:Technical Details
Import Stub Structure
The PS3 import stub format (fromtools/sprxlinker/linker.c:29):
OPD (Official Procedure Descriptor)
Function descriptors on PowerPC 64-bit (fromlinker.c:45):
Import Count Correction
The tool calculates the correct import count by scanning function IDs:SPRX Export Files
While sprxlinker fixes imports, SPRX libraries themselves define exports using.exports files.
Example Export File
Error Messages
”Unable to open elf file”
”libelf could not read elf file”
The file is not a valid ELF or is corrupted.”elf does not have a prx parameter section”
Your ELF is missing the required.sys_proc_prx_param section.
Solution: Ensure you’re linking with PSL1GHT libraries that provide this section.
Complete Build Example
Common Library Stubs
Libraries that require sprxlinker processing:librsx
RSX graphics library for 3D rendering
libgcm_sys
Graphics Command Manager system
libsysutil
System utility functions
liblv2
Low-level system calls
libio
I/O operations
libnet
Network functions
Verifying SPRX Linking
Check if your ELF has proper sections:Check OS/ABI
Source Code Reference
The sprxlinker implementation:- Main:
tools/sprxlinker/linker.c:1-178 - Key Functions:
getSection():linker.c:57- Find ELF sections by nameset_ehdr():linker.c:72- Write modified ELF headermain():linker.c:98- Process stubs and OPDs
Troubleshooting
Application crashes on PS3 startup
Application crashes on PS3 startup
The SPRX stubs may not be properly linked. Ensure:
- sprxlinker ran successfully (no errors)
- You’re linking against the correct SPRX libraries
- Function imports match exported symbols
Symbol not found errors
Symbol not found errors
Your application is trying to import a function that doesn’t exist in the SPRX:
- Check library version compatibility
- Verify function names match exports
- Ensure all required libraries are linked
sprxlinker changes don't take effect
sprxlinker changes don't take effect
Make sure you’re running sprxlinker on the stripped ELF before creating the SELF:
See Also
FSELF Tool
Convert ELF to SELF (run after sprxlinker)
Build System
Automated build process integration
Libraries
Available PSL1GHT SPRX libraries
Linking
Understanding the linking process