Using LDC to compile D code for the PSP (Playstation Portable)

pineapple meapineapple at gmail.com
Mon Sep 7 22:12:47 UTC 2020


I've been taking in interest in PSP homebrew development, and I'd 
like to be able to write some things with D. Unfortunately, I'm 
having some trouble getting things working.

I've been using the Minimalist PSPSDK for Windows and made some 
nice little C programs that run in an emulator and on my PSP 
hardware. Now I'm trying to incorporate some D code for the PSP's 
MIPS R4000 compile target. What I'm stuck on currently is how to 
get LDC to use the same ABI as the PSP libraries.

My build command looks like this:

     ldc2 --betterC --march=mipsel --mcpu=mips3 -c -of=src/main.o 
src/main.d

The linker errors I get look like this:

     psp-ld: src/main.o: warning: linking PIC files with non-PIC 
files
     psp-ld: src/main.o: linking mips:4000 module with previous 
mips:allegrex modules
     psp-ld: src/main.o: ABI mismatch: linking O32 module with 
previous EABI32 modules
     psp-ld: failed to merge target specific data of file 
src/main.o

I also get rather a lot of warnings about position-independent 
code, though I'm not sure if these are going to cause problems or 
not:

     psp-ld: C:/pspsdk/psp/sdk/lib/prxexports.o: warning: linking 
PIC files with non-PIC files
     psp-ld: C:/pspsdk/psp/sdk/lib\libpspgu.a(sceGuClear.o): 
warning: linking PIC files with non-PIC files
     psp-ld: C:/pspsdk/psp/sdk/lib\libpspgu.a(sceGuClearColor.o): 
warning: linking PIC files with non-PIC files
     psp-ld: C:/pspsdk/psp/sdk/lib\libpspgu.a(sceGuDispBuffer.o): 
warning: linking PIC files with non-PIC files
     psp-ld: C:/pspsdk/psp/sdk/lib\libpspgu.a(sceGuDisplay.o): 
warning: linking PIC files with non-PIC files
     psp-ld: C:/pspsdk/psp/sdk/lib\libpspgu.a(sceGuDrawArray.o): 
warning: linking PIC files with non-PIC files
     psp-ld: C:/pspsdk/psp/sdk/lib\libpspgu.a(sceGuDrawBuffer.o): 
warning: linking PIC files with non-PIC files
     & etc...

Can anyone help me out? Let me know what configuration I'm 
missing, or point me to where in LDC I might start hacking at if 
there is no such configuration yet?

Thanks!


More information about the digitalmars-d-ldc mailing list