This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: MIPS: PSEUDO define for n32 abi is broken for non-pic


Hi Joseph,

I agree with you about the fix, should be applied to all the three ABIs.

According to the GIT sources, the 'nop' is present for o32 abi, only
needs to be applied to n64 and n32 abi.
 
I don't know when the PSEUDO define for PIC is used, as the macro is
redefined in sysdep-cancel.h file. I don't see the issue with the define
in this file.

Please find the revised patch.

Thanks
Chandra

ChangeLog.mips:
	* sysdeps/unix/mips/mips64/n64/sysdep.h (PSEUDO): Add 'nop' in jump
        delay slot.
	* sysdeps/unix/mips/mips64/n32/sysdep.h (PSEUDO): Ditto.


On Thu, 2010-08-12 at 15:43, Joseph S. Myers wrote:
> On Fri, 6 Aug 2010, Chandrakala Chavva wrote:
> 
> > The toolchain by default generates non-pic executable for n32 ABI.
> > 
> > When compiling glibc the PSEUDO define generates the following code:
> > 
> >      j __syscall_error
> >      li v0, SYSCALL_NAME
> >      syscall
> > 
> > SYSCALL_NAME is loaded in jump delay slot, which overwrites the errno
> > returned by syscall.
> > 
> > Please let me know is the attached patch okay to apply, ran glibc
> > testsuite with the patch.
> > 
> > Thanks
> > Chandra
> > 
> > ports/ChangeLog.mips:
> > 
> > 	* sysdeps/unix/mips/mips64/n32/sysdep.h (PSEUDO): Add 'nop' in the
> > 	delay slot for calling __syscall_error.
> 
> Could you clarify why you are changing just this particular jump to have a 
> nop after it?  As far as I can see, each of the three ABIs has such jumps 
> for both the PIC and non-PIC cases, and there is only one such nop present 
> (for the o32 non-PIC case); what is it that makes the other four cases, 
> with no existing nop and where your patch does not add a nop, safe?
Index: unix/mips/mips64/n32/sysdep.h
===================================================================
--- unix/mips/mips64/n32/sysdep.h	(revision 51799)
+++ unix/mips/mips64/n32/sysdep.h	(working copy)
@@ -45,6 +45,7 @@ L(syse1):
   .set noreorder;							      \
   .align 2;								      \
   99: j __syscall_error;						      \
+  nop;                                                                        \
   ENTRY(name)								      \
   .set noreorder;							      \
   li v0, SYS_ify(syscall_name);						      \
Index: unix/mips/mips64/n64/sysdep.h
===================================================================
--- unix/mips/mips64/n64/sysdep.h	(revision 51799)
+++ unix/mips/mips64/n64/sysdep.h	(working copy)
@@ -45,6 +45,7 @@ L(syse1):
   .set noreorder;							      \
   .align 2;								      \
   99: j __syscall_error;						      \
+  nop;                                                                        \
   ENTRY(name)								      \
   .set noreorder;							      \
   li v0, SYS_ify(syscall_name);						      \

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]