www.digitalmars.com         C & C++   DMDScript  

D.gnu - alignment problem causing strange linker error

In my journey of GDC on the PSP, I have encountered this awful mess when 
trying to use the function sceGumDrawArray with second argument == 
anything but a literal constant:
psp-gdc -c main.d  -fversion=Psp
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall 
-D_PSP_FW_VERSION=300  -L. -L/usr/local/pspdev/psp/sdk/lib   module.o 
main.o -lgphobos -lpspgum -lpspgu -lm  -lpspdebug -lpspdisplay -lpspge 
-lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl 
-lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o DieCrittersDie.elf
main.o: In function `_D4main8drawLineFiikZv':
main.d:(.text+0x7e0): undefined reference to 
`_D6pspsdk5pspgu24__T15GU_VERTEX_SHIFTVi3Z15GU_VERTEX_SHIFTi'
main.d:(.text+0x7e0): relocation truncated to fit: R_MIPS_GPREL16 
against `_D6pspsdk5pspgu24__T15GU_VERTEX_SHIFTVi3Z15GU_VERTEX_SHIFTi'
main.d:(.text+0x7e4): undefined reference to 
`_D6pspsdk5pspgu27__T18GU_TRANSFORM_SHIFTVi0Z18GU_TRANSFORM_SHIFTi'
main.d:(.text+0x7e4): relocation truncated to fit: R_MIPS_GPREL16 
against `_D6pspsdk5pspgu27__T18GU_TRANSFORM_SHIFTVi0Z18GU_TRANSFORM_SHIFTi'
collect2: ld returned 1 exit status
I've tried everything including align(16) in front of constant 
declarations (which were #define's in the C header).
This is the prototype of the function in C:
void sceGumDrawArray(int prim, int vtype, int count, const void* 
indices, const void* vertices);
Translated to D:
void sceGumDrawArray(int prim, int vtype, int count, void* indices, 
void* vertices);
That second parameter, vtype, has to be a literal constant or that error 
  occurs. Even returning a constant from a function call doesn't work. 
Local variables don't work either. This is a real problem because 
writing literal numbers is too obscure and error-prone. I hope this is 
easily fixable. Thanks.
Jul 27 2008