 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
MrPeanut
Joined: 02 Sep 2007 Posts: 2
|
Posted: Sun Sep 02, 2007 4:12 pm Post subject: I _HATE_ linker errors! |
|
|
Hi guys,
First of all, hi, everyone! I'm new at cross compiling for the psp but I have been coding for a few years, mainly windows API applications, and I've never had to use a compiler other than msvc's or the intel compiler.
What prompts my visit here are these damned linker errors that seem to be related to MIPS in particular. The project I'm currently working on is porting duke nukem 3D to psp. I know there is already a port in existence but there are features missing that I'd like to add, and the source code to the port is non-existent on the internet. and that it'd be a good start for me to get into the psp development community, now here's my question. I've gotten the code for the engine library, and the game itself to compile, but when the game is being linked I get TONS of errors like these:
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'
What that tells me, which is probably wrong, is that the linker is trying to stuff all these symbols in the .data portion of the elf? If I use the -G0 flag I'll only get a few of these errors compared to so many the output doesn't show all of them.
R_MIPS_GPREL16 is defined as 7
Does anyone have any idea on how to get rid of these errors so I can start debugging this thing?!
Thanks! |
|
| Back to top |
|
 |
jimparis
Joined: 10 Jun 2005 Posts: 1179 Location: Boston
|
Posted: Sun Sep 02, 2007 5:16 pm Post subject: |
|
|
| -G0 should be a correct fix, as no GPREL16 relocations should be generated in that case. Please be more specific -- post the code somewhere, post the actual error output when using -G0. My guess would be that you still have some code (libraries, for example) using something other than -G0. |
|
| Back to top |
|
 |
MrPeanut
Joined: 02 Sep 2007 Posts: 2
|
Posted: Sun Sep 02, 2007 6:13 pm Post subject: |
|
|
Hmm, I don't know what I did but -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
That's without -G0.. I tried it both ways.
Thanks for your quick reply, I'm gonna sleep on this one for awhile
Thanks! |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|