newlib, _close() and $gp enabled...

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Aenea
Posts: 1
Joined: Tue Aug 30, 2005 8:01 am

newlib, _close() and $gp enabled...

Post by Aenea »

Hi there all,

My first post here and have a couple of questions. I've done programming for the PSP the past couple of weeks (ported Stella and Atari800) but since last week, after I updated the toolchain, I got some strange errors. Mostly in stdio calls. So I decided to track it down, this is what I found:

1) on line 622 of the newlib patch it says:

Code: Select all

+		sce_fd == sceKernelStderr();
and I think that should have been an assignment as in the lines above it.
2) why was the following code added in libc/include/sys/config.h? I noticed that on small applications it's not a problem, but on some large ones the ptr of the global reent structure wasn't correctly initialised, maybe a linker bug (or __psp__ is not set correctly?)?:

Code: Select all

/* We compile newlib with -G0 for PSP, but if we're compiling an app with $gp enabled,
   then _impure_ptr is expected to live in .sdata. */
#if defined(__psp__)
#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
#endif
After searching the net I found out that the $gp register can be used as a global pointer to (small) data. So I'm wondering what means $gp enabled? How do you enable it? (or do you enable it with -G8 for example?) Why could it be usefull?

After commenting it out and recompiling everything the projects started working again. Did I find a bug or am I doing something wrong?

Aenea
Post Reply