Results 1 to 3 of 3

Thread: Linker Errors (R_MIPS_GPREL16)

                  
   
  1. #1
    DCEmu Coder
    Join Date
    Feb 2007
    Location
    Cleveland, OH USA
    Posts
    41
    Rep Power
    0

    Default Linker Errors (R_MIPS_GPREL16)

    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.

  2. #2
    DCEmu Newbie
    Join Date
    Sep 2007
    Posts
    1
    Rep Power
    0

    Default

    Hi. I'm the author of EDuke32 and I have some source code that I haven't released yet which you might be interested in. The errors appear to be caused by the program's somewhat large data segment; it seems to be larger than what the PSP (or the compiler, I don't really know) can handle.

    The solution I had in mind was to replace a bunch of the insane arrays of global variables bloating the data segment with a bunch of dynamic allocation crap. It knocked about a meg and a half off of the bss so far, but I don't know if that's going to be enough.

  3. #3
    DCEmu Coder
    Join Date
    Aug 2006
    Location
    Bloomington, IN
    Age
    41
    Posts
    268
    Rep Power
    73

    Default

    I have huge static arrays defined (several MB) and have never had this problem with -G0. The problem must be more specific than that.
    http://gpsp-dev.blogspot.com/

    I haven't quit gpSP, just put it on hiatus for a while.

    Games like Super Mario Advance 3, Riviera and Sword of Mana actually DO work in gpSP, believe it or not. If they don't work for you then you're using the faulty BIOS. Don't argue with me, it's true; the sooner you accept this the sooner you can move on.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •