MrPeanut
September 4th, 2007, 01:54
Hi guys, I thought I'd actually post my errors and see if anyone has a solution. I'm currently porting duke nukem 3d to the psp and everything compiles fine (the engine library and the game code) but when they are being linked I get tons of linker relocation errors:
-G0 shows the same amount of errors but in different objects. I updated and rebuilt my whole pspsdk toolchain but I'm not sure if that has anything to do with it.
(WITH -G0)
psp-gcc -o eduke32 obj.nix/game.o obj.nix/actors.o obj.nix/anim.o obj.nix/animlib.o obj.nix/config.o obj.nix/gamedef.o obj.nix/gameexec.o obj.nix/global.o obj.nix/menus.o obj.nix/namesdyn.o obj.nix/player.o obj.nix/premap.o obj.nix/savegame.o obj.nix/sector.o obj.nix/rts.o obj.nix/testcd.o obj.nix/osdfuncs.o obj.nix/osdcmds.o obj.nix/util_lib.o obj.nix/file_lib.o obj.nix/control.o obj.nix/keyboard.o obj.nix/mouse.o obj.nix/mathutil.o obj.nix/scriplib.o obj.nix/audiolib_musicstub.o obj.nix/audiolib_fxstub.o obj.nix/sounds.o eobj.nix/libengine.a -L/usr/local/pspdev/psp/lib -lSDLmain -lSDL -lm -L/usr/local/pspdev/psp/sdk/lib -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspsdk -lpsprtc -lpspaudio -lc -lpspuser -lpsputility -lpspkernel -lpspnet_inet -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -lsupc++ -Wl,-Map=eduke32.map
eobj.nix/libengine.a(baselayer.o): In function `osdcmd_glinfo':
baselayer.c:(.text+0xac): relocation truncated to fit: R_MIPS_GPREL16 against `bpp'
eobj.nix/libengine.a(engine.o): In function `setrendermode':
engine.c:(.text+0x3f1c): relocation truncated to fit: R_MIPS_GPREL16 against `bpp'
eobj.nix/libengine.a(engine.o): In function `setpolymost2dview':
engine.c.text+0x4128): relocation truncated to fit: R_MIPS_GPREL16 against `xres'
engine.c.text+0x4134): relocation truncated to fit: R_MIPS_GPREL16 against `yres'
engine.c.text+0x4154): relocation truncated to fit: R_MIPS_GPREL16 against `xres'
engine.c.text+0x4158): relocation truncated to fit: R_MIPS_GPREL16 against `yres'
eobj.nix/libengine.a(engine.o): In function `resizeglcheck':
engine.c.text+0x481c): relocation truncated to fit: R_MIPS_GPREL16 against `yres'
engine.c.text+0x48d4): relocation truncated to fit: R_MIPS_GPREL16 against `nofog'
eobj.nix/libengine.a(engine.o): In function `printext16':
engine.c.text+0x5010): relocation truncated to fit: R_MIPS_GPREL16 against `frameplace'
eobj.nix/libengine.a(engine.o): In function `getpixel':
engine.c.text+0x511c): relocation truncated to fit: R_MIPS_GPREL16 against `frameplace'
eobj.nix/libengine.a(engine.o): In function `clearallviews':
engine.c.text+0x5470): additional relocation overflows omitted from the output
collect2: ld returned 1 exit status
make: *** [eduke32] Error 1
(WITHOUT -G0)
psp-gcc -o eduke32 obj.nix/game.o obj.nix/actors.o obj.nix/anim.o obj.nix/animlib.o obj.nix/config.o obj.nix/gamedef.o obj.nix/gameexec.o obj.nix/global.o obj.nix/menus.o obj.nix/namesdyn.o obj.nix/player.o obj.nix/premap.o obj.nix/savegame.o obj.nix/sector.o obj.nix/rts.o obj.nix/testcd.o obj.nix/osdfuncs.o obj.nix/osdcmds.o obj.nix/util_lib.o obj.nix/file_lib.o obj.nix/control.o obj.nix/keyboard.o obj.nix/mouse.o obj.nix/mathutil.o obj.nix/scriplib.o obj.nix/audiolib_musicstub.o obj.nix/audiolib_fxstub.o obj.nix/sounds.o eobj.nix/libengine.a -L/usr/local/pspdev/psp/lib -lSDLmain -lSDL -lm -L/usr/local/pspdev/psp/sdk/lib -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspsdk -lpsprtc -lpspaudio -lc -lpspuser -lpsputility -lpspkernel -lpspnet_inet -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -lsupc++ -Wl,-Map=eduke32.map
obj.nix/game.o: In function `strip_color_codes':
game.c.text+0x6fc): relocation truncated to fit: R_MIPS_GPREL16 against `__ctype_ptr'
game.c.text+0x72c): relocation truncated to fit: R_MIPS_GPREL16 against `__ctype_ptr'
obj.nix/game.o: In function `gametext_':
game.c.text+0x87c): relocation truncated to fit: R_MIPS_GPREL16 against `__ctype_ptr'
game.c.text+0x8ac): relocation truncated to fit: R_MIPS_GPREL16 against `__ctype_ptr'
game.c.text+0xa44): relocation truncated to fit: R_MIPS_GPREL16 against `__ctype_ptr'
game.c.text+0xa78): relocation truncated to fit: R_MIPS_GPREL16 against `__ctype_ptr'
obj.nix/game.o: In function `minitext_':
game.c.text+0xfe4): relocation truncated to fit: R_MIPS_GPREL16 against `__ctype_ptr'
obj.nix/game.o: In function `checksync':
game.c.text+0x733c): relocation truncated to fit: R_MIPS_GPREL16 against `syncstate'
obj.nix/game.o: In function `strget_':
game.c.text+0xe2e4): relocation truncated to fit: R_MIPS_GPREL16 against `__ctype_ptr'
obj.nix/game.o: In function `typemode':
game.c.text+0xe9e4): relocation truncated to fit: R_MIPS_GPREL16 against `__ctype_ptr'
game.c.text+0xea3c): additional relocation overflows omitted from the output
collect2: ld returned 1 exit status
The only libraries I'm linking to other than the pspsdk ones are SDL for PSP and GL, and the libengine.a library which is specified with -G0 as well.
My CFLAGS are:
-I/usr/local/pspdev/psp/sdk/include -I/usr/local/pspdev/psp/include/SDL -Dmain=SDL_main -D_PSP_FW_VERSION=150 -fomit-frame-pointer -W -Wall -Wimplicit -Wno-char-subscripts -Wunused -funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS -DNOCOPYPROTECT -Isource -I../duke3d_psp_build/include -Isource/jmact -Isource/jaudiolib -I../jfaud/inc -DRENDERTYPESDL=1 -DSUPERBUILD -DPOLYMOST -DUSE_OPENGL -DUSE_A_C -DNOASM -DSETSPRITEZ
I've tried just about every gcc MIPS related flag/options with no results. -G0 alleviates the _ctype_ptr but doesn't fix the other reallocation overflows.
From what I've researched, you get these errors when ld is trying to cram too much into the small data sections of the executable. -G0 is supposed to fix this, and it seems like it does, to an extent. I'm completely clueless on where to go next with this because the only linker errors I've ever dealt with in my days are unresolved externals which are easy to fix :)
Sorry for the long post but I really want to get this fixed and get the project rolling again. If anyone knows something that may help please let me know! I had ld create a map file of the elf and I can post that as well but it's very big.
-G0 shows the same amount of errors but in different objects. I updated and rebuilt my whole pspsdk toolchain but I'm not sure if that has anything to do with it.
(WITH -G0)
psp-gcc -o eduke32 obj.nix/game.o obj.nix/actors.o obj.nix/anim.o obj.nix/animlib.o obj.nix/config.o obj.nix/gamedef.o obj.nix/gameexec.o obj.nix/global.o obj.nix/menus.o obj.nix/namesdyn.o obj.nix/player.o obj.nix/premap.o obj.nix/savegame.o obj.nix/sector.o obj.nix/rts.o obj.nix/testcd.o obj.nix/osdfuncs.o obj.nix/osdcmds.o obj.nix/util_lib.o obj.nix/file_lib.o obj.nix/control.o obj.nix/keyboard.o obj.nix/mouse.o obj.nix/mathutil.o obj.nix/scriplib.o obj.nix/audiolib_musicstub.o obj.nix/audiolib_fxstub.o obj.nix/sounds.o eobj.nix/libengine.a -L/usr/local/pspdev/psp/lib -lSDLmain -lSDL -lm -L/usr/local/pspdev/psp/sdk/lib -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspsdk -lpsprtc -lpspaudio -lc -lpspuser -lpsputility -lpspkernel -lpspnet_inet -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -lsupc++ -Wl,-Map=eduke32.map
eobj.nix/libengine.a(baselayer.o): In function `osdcmd_glinfo':
baselayer.c:(.text+0xac): relocation truncated to fit: R_MIPS_GPREL16 against `bpp'
eobj.nix/libengine.a(engine.o): In function `setrendermode':
engine.c:(.text+0x3f1c): relocation truncated to fit: R_MIPS_GPREL16 against `bpp'
eobj.nix/libengine.a(engine.o): In function `setpolymost2dview':
engine.c.text+0x4128): relocation truncated to fit: R_MIPS_GPREL16 against `xres'
engine.c.text+0x4134): relocation truncated to fit: R_MIPS_GPREL16 against `yres'
engine.c.text+0x4154): relocation truncated to fit: R_MIPS_GPREL16 against `xres'
engine.c.text+0x4158): relocation truncated to fit: R_MIPS_GPREL16 against `yres'
eobj.nix/libengine.a(engine.o): In function `resizeglcheck':
engine.c.text+0x481c): relocation truncated to fit: R_MIPS_GPREL16 against `yres'
engine.c.text+0x48d4): relocation truncated to fit: R_MIPS_GPREL16 against `nofog'
eobj.nix/libengine.a(engine.o): In function `printext16':
engine.c.text+0x5010): relocation truncated to fit: R_MIPS_GPREL16 against `frameplace'
eobj.nix/libengine.a(engine.o): In function `getpixel':
engine.c.text+0x511c): relocation truncated to fit: R_MIPS_GPREL16 against `frameplace'
eobj.nix/libengine.a(engine.o): In function `clearallviews':
engine.c.text+0x5470): additional relocation overflows omitted from the output
collect2: ld returned 1 exit status
make: *** [eduke32] Error 1
(WITHOUT -G0)
psp-gcc -o eduke32 obj.nix/game.o obj.nix/actors.o obj.nix/anim.o obj.nix/animlib.o obj.nix/config.o obj.nix/gamedef.o obj.nix/gameexec.o obj.nix/global.o obj.nix/menus.o obj.nix/namesdyn.o obj.nix/player.o obj.nix/premap.o obj.nix/savegame.o obj.nix/sector.o obj.nix/rts.o obj.nix/testcd.o obj.nix/osdfuncs.o obj.nix/osdcmds.o obj.nix/util_lib.o obj.nix/file_lib.o obj.nix/control.o obj.nix/keyboard.o obj.nix/mouse.o obj.nix/mathutil.o obj.nix/scriplib.o obj.nix/audiolib_musicstub.o obj.nix/audiolib_fxstub.o obj.nix/sounds.o eobj.nix/libengine.a -L/usr/local/pspdev/psp/lib -lSDLmain -lSDL -lm -L/usr/local/pspdev/psp/sdk/lib -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspsdk -lpsprtc -lpspaudio -lc -lpspuser -lpsputility -lpspkernel -lpspnet_inet -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -lsupc++ -Wl,-Map=eduke32.map
obj.nix/game.o: In function `strip_color_codes':
game.c.text+0x6fc): relocation truncated to fit: R_MIPS_GPREL16 against `__ctype_ptr'
game.c.text+0x72c): relocation truncated to fit: R_MIPS_GPREL16 against `__ctype_ptr'
obj.nix/game.o: In function `gametext_':
game.c.text+0x87c): relocation truncated to fit: R_MIPS_GPREL16 against `__ctype_ptr'
game.c.text+0x8ac): relocation truncated to fit: R_MIPS_GPREL16 against `__ctype_ptr'
game.c.text+0xa44): relocation truncated to fit: R_MIPS_GPREL16 against `__ctype_ptr'
game.c.text+0xa78): relocation truncated to fit: R_MIPS_GPREL16 against `__ctype_ptr'
obj.nix/game.o: In function `minitext_':
game.c.text+0xfe4): relocation truncated to fit: R_MIPS_GPREL16 against `__ctype_ptr'
obj.nix/game.o: In function `checksync':
game.c.text+0x733c): relocation truncated to fit: R_MIPS_GPREL16 against `syncstate'
obj.nix/game.o: In function `strget_':
game.c.text+0xe2e4): relocation truncated to fit: R_MIPS_GPREL16 against `__ctype_ptr'
obj.nix/game.o: In function `typemode':
game.c.text+0xe9e4): relocation truncated to fit: R_MIPS_GPREL16 against `__ctype_ptr'
game.c.text+0xea3c): additional relocation overflows omitted from the output
collect2: ld returned 1 exit status
The only libraries I'm linking to other than the pspsdk ones are SDL for PSP and GL, and the libengine.a library which is specified with -G0 as well.
My CFLAGS are:
-I/usr/local/pspdev/psp/sdk/include -I/usr/local/pspdev/psp/include/SDL -Dmain=SDL_main -D_PSP_FW_VERSION=150 -fomit-frame-pointer -W -Wall -Wimplicit -Wno-char-subscripts -Wunused -funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS -DNOCOPYPROTECT -Isource -I../duke3d_psp_build/include -Isource/jmact -Isource/jaudiolib -I../jfaud/inc -DRENDERTYPESDL=1 -DSUPERBUILD -DPOLYMOST -DUSE_OPENGL -DUSE_A_C -DNOASM -DSETSPRITEZ
I've tried just about every gcc MIPS related flag/options with no results. -G0 alleviates the _ctype_ptr but doesn't fix the other reallocation overflows.
From what I've researched, you get these errors when ld is trying to cram too much into the small data sections of the executable. -G0 is supposed to fix this, and it seems like it does, to an extent. I'm completely clueless on where to go next with this because the only linker errors I've ever dealt with in my days are unresolved externals which are easy to fix :)
Sorry for the long post but I really want to get this fixed and get the project rolling again. If anyone knows something that may help please let me know! I had ld create a map file of the elf and I can post that as well but it's very big.