Aenea
Joined: 30 Aug 2005 Posts: 1
|
Posted: Wed Sep 14, 2005 3:07 am Post subject: newlib, _close() and $gp enabled... |
|
|
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: | | + 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: | /* 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 |
|