NuggetQ : Changing the Load Address of a PSX exe
In order to change the Load Memory Address (LMA) of your psx executable, you should use one of those solutions ;
$ file hello_poly.ps-exe
hello_poly.ps-exe: Sony Playstation executable PC=0x8001f000, .text=[0x8001f000,0x1c000], Stack=0x801fff00, ()
From the command line
When compiling, use the following command :
LDFLAGS ="-Xlinker --defsym=TLOAD_ADDR=0x80010000" make
From the Makefile
In the project's makefile, add the following line :
LDFLAGS += -Xlinker --defsym=TLOAD_ADDR=0x80010000
With an ld script
In the project's Makefile, add a line to include the ld script:
OVERLAYSCRIPT ?= script.ld
in the linked script, add the following lines :
TLOAD_ADDR = 0x8001f000; /*Changes the PC*/
__heap_base = 0x8001f000; /* Build fails if not provided */
Source
https://discord.com/channels/642647820683444236/646781091252011058/791255427990945823
https://discord.com/channels/642647820683444236/663664210525290507/894235813657837569