forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

-G0 option in makefiles important?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
michaelp



Joined: 02 Jul 2007
Posts: 7

PostPosted: Wed Dec 30, 2009 5:27 am    Post subject: -G0 option in makefiles important? Reply with quote

Recently, I have been trying to get GDC(GCC D compiler, for the D programming language) working on the PSP using the instructions listed here:
http://forums.qj.net/psp-development-forum/142864-how-program-d-psptoolchain-gdc.html
I got everything to install okay, but when I tried to use functions from graphics.c/.h, using the tutorial here:
http://forums.qj.net/psp-development-forum/158366-tut-beginner-c-programming-tutorials.html#post2184931
I got various errors, some are shown here:
Code:
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libgphobos.a(cbridge_stdio.o): In function `_d_gnu_cbridge_init_stdio':
../../../libphobos/gcc/cbridge_stdio.c:29: relocation truncated to fit: R_MIPS_GPREL16 against `_d_gnu_cbridge_stderr'
../../../libphobos/gcc/cbridge_stdio.c:27: relocation truncated to fit: R_MIPS_GPREL16 against `_d_gnu_cbridge_stdin'
../../../libphobos/gcc/cbridge_stdio.c:30: relocation truncated to fit: R_MIPS_GPREL16 against `_d_gnu_cbridge_stdout'
collect2: ld returned 1 exit status
make: *** [HelloPspInD.elf] Error 1

Basically, whenever stdin or stdout or stderr were used in Phobos and one of the files was compiled with the program, there were these errors.(Even though files like std.stdio, where some errors came from, were not imported by me)
So, this Makefile line:
Code:
CFLAGS = -O2 -G0 -Wall

was changed to:
Code:
CFLAGS = -O2 -Wall

and everything was fine. (Tested on my PSP too, and worked fine.)

So, is the -G0 flag important, or is it okay for me to compile everything without it?
Back to top
View user's profile Send private message
Criptych



Joined: 12 Sep 2009
Posts: 79

PostPosted: Wed Dec 30, 2009 6:13 am    Post subject: Reply with quote

Actually, I've had the exact opposite problem before (in a C program); I kept receiving "relocation truncated to fit" linker errors until I recompiled one of the libraries with -G0. IIRC it has something to do with how data is arranged in the data segment, but I don't think it will inherently cause problems to omit it.

Also, make sure there are still no errors when you make rebuild, because when I had this problem, even though the first make would fail, the next worked -- but the program crashed in sceKernelModMgr-something.
_________________
PSP-2000 // CFW: 5.50 GEN-D2 ...and not upgrading until OFW supports homebrew!
(But I did downgrade to 1.50 with TimeMachine...)
"I want you to tell me how the machine makes you feel."
Back to top
View user's profile Send private message
michaelp



Joined: 02 Jul 2007
Posts: 7

PostPosted: Thu Dec 31, 2009 6:24 am    Post subject: Reply with quote

Okay.
After running a make rebuild, everything is still fine, and works okay on the PSP.
Thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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