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 

[psptoolchain/newlib] remove readlink(2) declaration

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> Patch Submissions
View previous topic :: View next topic  
Author Message
Beuc



Joined: 26 Mar 2009
Posts: 33
Location: holland

PostPosted: Thu Apr 09, 2009 4:50 am    Post subject: [psptoolchain/newlib] remove readlink(2) declaration Reply with quote

readlink(2) is not defined in the PSP SDK, but it's defined in /usr/local/pspdev/psp/include/sys/unistd.h.

When using a portability layer such as Gnulib (which detects readlink and see if it should use its own generic version or keep the optimized system-provided version), this causes confusion.
In particular, Gnulib's declaration isn't exactly the same as pspsdk/newlib's (there a missing 'unsigned' in newlib).

So, since readlink isn't available, and since the definition is causing confusion, I suggest it's removed :)

Code:
sed -i -e 's/.*_EXFUN(readlink.*//' /usr/local/pspdev/psp/include/sys/unistd.h


Note: I'm willing to make a proper patch, however I don't know how you generate patches/newlib-1.16.0-PSP.patch. Is this described somewhere?
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Wed Apr 15, 2009 4:28 am    Post subject: Reply with quote

Quote:
Note: I'm willing to make a proper patch, however I don't know how you generate patches/newlib-1.16.0-PSP.patch. Is this described somewhere?

It's a mess, for historical reasons :) See
Code:
cd /tmp
svn co -r 2229 svn://svn.ps2dev.org/psp/trunk/psptoolchain@2229
svn co -r 2229 svn://svn.ps2dev.org/psp/trunk/newlib-psp@2229
less psptoolchain/devel/README.TXT

More recently, I think the method has been:
  • unpack newlib sources to -orig
  • copy -orig to -dev
  • apply newlib-1.16.0-PSP.patch to -dev
  • make changes in -dev
  • generate patch between -orig and -dev
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Tue Jun 23, 2009 8:01 am    Post subject: Reply with quote

I modified unistd.h as follows:
Code:
diff -burN orig.newlib-1.16.0/newlib/libc/include/sys/unistd.h newlib-1.16.0/newlib/libc/include/sys/unistd.h
--- orig.newlib-1.16.0/newlib/libc/include/sys/unistd.h 2007-11-08 11:20:12.000000000 -0500
+++ newlib-1.16.0/newlib/libc/include/sys/unistd.h      2009-06-22 17:58:22.000000000 -0400
@@ -225,8 +225,10 @@
 int     _EXFUN(sync, (void));
 #endif
 
+#if !defined(__psp__)
 int     _EXFUN(readlink, (const char *__path, char *__buf, int __buflen));
 int     _EXFUN(symlink, (const char *__name1, const char *__name2));
+#endif
 
 #define        F_OK    0
 #define        R_OK    4

Not a particularly clean fix, but it should be OK (since we don't support symlinks anyway).
Code:

Sending        patches/newlib-1.16.0-PSP.patch
Transmitting file data .
Committed revision 2464.
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 -> Patch Submissions 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