psp-gcc instead of psp-ld

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
dandev
Posts: 7
Joined: Fri Jun 24, 2005 11:08 pm
Location: Canada

psp-gcc instead of psp-ld

Post by dandev »

Hi,
I've been using psp-ld to link my code for the last couple of days, but I then found out that I need to use psp-gcc instead, and it also complains less when linking libc.

Anyways, when I was using psp-ld, my own Hello World program had produced a EBOOT.PBP that runs on my PSP fine, but when I try linking with psp-gcc instead, the program says in my PSP, "The game could not be started. (800200D9)"

Here is what I do to compile:

rm *.o
psp-gcc -g -c controller.c
psp-gcc -g -c hellopsp.c
psp-gcc -g -c pg.c
psp-gcc -g -c -xassembler -O -o startup.o startup.S


psp-gcc startup.o hellopsp.o pg.o controller.o -Wl,-Ttext -Wl,8900000 -o out -lc

(Was: psp-ld -O0 -G0 startup.o hellopsp.o pg.o controller.o -M -Ttext 8900000 -q -o out -lc > hellopsp.map --> worked)

g++ outpatch.cpp -o outpatch
./outpatch out

elf2pbp outp

===

Any idea what I need to do to psp-gcc so that I get a working EBOOT.PBP?
weak
Posts: 114
Joined: Thu Jan 13, 2005 8:31 pm
Location: Vienna, Austria

Post by weak »

psp-gcc startup.o hellopsp.o pg.o controller.o -Wl,-Ttext -Wl,8900000 -nostartfiles -o out -lc

should do the trick
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

Also note that you can skip the outpatch step entirely, thanks to the astute observations of Warren.

Take out the -q in the linker step (seems you already have). Make sure .xodata.sceModuleInfo in startup.s is called .rodata.sceModuleInfo instead.

If you do this then you won't have to run outpatch over the final ELF.
dandev
Posts: 7
Joined: Fri Jun 24, 2005 11:08 pm
Location: Canada

Post by dandev »

Alright, thanks. It works now.

What I had to do was one change:

psp-gcc startup.o hellopsp.o pg.o controller.o -Wl,-Ttext -Wl,8900000 -nostartfiles -o out -lc


However, if I take out the outpatch lines and do an elf2pbp on just "out" (instead of outp), the PSP crashes the program. And, If I changed to: .section .rodata.sceModuleInfo, "a", @progbits, the compiler complains it cannot find "scemoduleinfo".
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

Yeah, sorry about that, it seems you have to have a custom linker script that declares the .rodata.sceModuleInfo section before the .rodata section. This is because the PSP bootloader specifically looks for the .rodata.sceModuleInfo section to locate the module info structure.

I've just finished support for that custom linker script within the linker itself. It's in Subversion awaiting release from ooPo. If you see a 20050625 on his site that's the one :).
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

Note also with the 20050625 toolchain that "-Wl,-Ttext -Wl,8900000" is no longer required.
TommyBear
Posts: 50
Joined: Fri Jun 24, 2005 11:21 pm

Post by TommyBear »

mrbrown wrote:Note also with the 20050625 toolchain that "-Wl,-Ttext -Wl,8900000" is no longer required.
Is this the version in SVN? If so do we have access to the SVN repository for updates?

Tommy.
Post Reply