RSO (File Format): Difference between revisions

m
>Aruki
>Aruki
 
(One intermediate revision by the same user not shown)
Line 110: Line 110:
| 1
| 1
| '''Internal Relocation Table Offset'''
| '''Internal Relocation Table Offset'''
| Absolute offset of the [[#Relocation Table|relocation table]] for internal relocations (relocations to symbols within this module).
| Absolute offset of the [[#Relocation Table|relocation table]] for internal relocations (relocations for symbols within this module).
|-
|-
| 0x34
| 0x34
Line 122: Line 122:
| 1
| 1
| '''External Relocation Table Offset'''
| '''External Relocation Table Offset'''
| Absolute offset of the [[#Relocation Table|relocation table]] for external relocations (relocations to symbols within other modules).
| Absolute offset of the [[#Relocation Table|relocation table]] for external relocations (relocations for symbols within other modules).
|-
|-
| 0x3C
| 0x3C
Line 152: Line 152:
| 1
| 1
| '''Import Symbol Table Offset'''
| '''Import Symbol Table Offset'''
| Absolute offset of the [[#Symbol Table|symbol table]] for imports (symbols within other modules).
| Absolute offset of the [[#Symbol Table|symbol table]] for imports (symbols within other modules, referenced by this one).
|-
|-
| 0x50
| 0x50
Line 199: Line 199:
=== Relocation Table ===
=== Relocation Table ===


Since modules have space allocated at runtime and therefore do not have a fixed memory address, the relocations table is needed to ensure all data and function addresses are correct; this includes both symbols within the RSO itself, which don't have a fixed address until the RSO is linked in, and symbols within the DOL, which need corrections due to the usage of relative offsets in branch instructions. The relocation table describes the location of every instruction that needs to be patched, and how to patch it.
Since modules have space allocated at runtime and therefore do not have a fixed memory address, the relocations table is needed to ensure all data and function addresses in the RSO are correct; this includes both symbols within the RSO itself, which don't have a fixed address until the RSO is linked in, and symbols within the DOL, which need corrections due to the usage of relative offsets in branch instructions. The relocation table describes the location of every instruction that needs to be patched, and how to patch it.


There are two relocation tables in the file; one for internal relocations (relocations for addresses pointing to symbols within this RSO), and one for external relocations (relocations for addresses pointing to symbols within the main [[DOL (File Format)|DOL executable]]). These tables are pointed to by the ''Internal Relocation Table Offset'' and ''External Relocation Table Offset'' values in the header. You can calculate the number of relocation entries by dividing the size of the table by 0xC (the size of one relocation entry).
There are two relocation tables in the file; one for internal relocations (relocations for addresses pointing to symbols within this RSO), and one for external relocations (relocations for addresses pointing to symbols within the main [[DOL (File Format)|DOL executable]]). These tables are pointed to by the ''Internal Relocation Table Offset'' and ''External Relocation Table Offset'' values in the header. You can calculate the number of relocation entries by dividing the size of the table by 0xC (the size of one relocation entry).
Anonymous user