[uClibc] Re: non-PIC ARM assembly

Peter S. Mazinger ps.m at gmx.net
Fri Jun 10 10:18:55 UTC 2005


On Fri, 10 Jun 2005, Joakim Tjernlund wrote:

> > 
> > On Fri, 10 Jun 2005, Peter S. Mazinger wrote:
> > 
> > > - copied __syscall_error.c from powerpc and added to Makefile (where to 
> > > 	add attribute_hidden?)
> > 
> > attached attribute_hidden for arm/mips/powerpc
> 
> This and the previous patch looks much better :)
> Regarding attribute_hidden, this attribute makes the function local to the lib
> and therefore you done need to call it via the PLT.
> Please remove #ifdef _PIC_ for __syscall_error in the affected
> asm files(look in my previous post).

second round for attribute_hidden __syscall_error (for arm it applies only 
after the earlier textrel-pic patch)
> 
> I am not convinced that the error path is correct, maybe a simple test or two could
> confirm that.

how to test?

Peter

-- Peter S. Mazinger <ps dot m at gmx dot net> ID: 0xA5F059F2 Key
fingerprint = 92A4 31E1 56BC 3D5A 2D08 BB6E C389 975E A5F0 59F2
-------------- next part --------------
--- uClibc-0.9.27/libc/sysdeps/linux/arm/__syscall_error.c.mps	2005-06-10 12:10:50 +0200
+++ uClibc-0.9.27/libc/sysdeps/linux/arm/__syscall_error.c	2005-06-10 12:11:04 +0200
@@ -21,7 +21,7 @@
 
 /* This routine is jumped to by all the syscall handlers, to stash
  * an error number into errno.  */
-int __syscall_error (int err_no)
+int attribute_hidden __syscall_error (int err_no)
 {
 	__set_errno (err_no);
 	return -1;
--- uClibc-0.9.27/libc/sysdeps/linux/arm/clone.S.mps	2005-06-10 12:11:13 +0200
+++ uClibc-0.9.27/libc/sysdeps/linux/arm/clone.S	2005-06-10 12:11:42 +0200
@@ -28,9 +28,9 @@
 /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
 
 	.text
-	.globl __clone;
+	.globl __clone
 	.type __clone,%function
-	.align 4;
+	.align 4
 __clone:
 	@ sanity check args
 	cmp	r0, #0
@@ -66,15 +66,11 @@
 #endif
 
 __error:
-#ifdef __PIC__
-	b	__syscall_error(PLT)
-#else
 	b	__syscall_error
-#endif
 
-	.size __clone,.-__clone;
+	.size __clone,.-__clone
 
-	.weak clone;
+	.weak clone
 	clone = __clone
 
 #endif
--- uClibc-0.9.27/libc/sysdeps/linux/arm/mmap64.S.mps	2005-06-10 12:12:37 +0200
+++ uClibc-0.9.27/libc/sysdeps/linux/arm/mmap64.S	2005-06-10 12:13:12 +0200
@@ -25,9 +25,9 @@
 
 	/* The mmap2 system call takes six arguments, all in registers.  */
 	.text
-	.global mmap64;
+	.global mmap64
 	.type mmap64,%function
-	.align 4;
+	.align 4
 mmap64:
 	stmfd	sp!, {r4, r5, lr}
 	ldr	r5, [sp, $16]
@@ -63,12 +63,8 @@
 	b	__error
 
 __error:
-#ifdef __PIC__
-	b	__syscall_error(PLT)
-#else
 	b	__syscall_error
-#endif
 
-	.size mmap64,.-mmap64;
+	.size mmap64,.-mmap64
 
 #endif
--- uClibc-0.9.27/libc/sysdeps/linux/arm/vfork.S.mps	2005-06-10 12:13:20 +0200
+++ uClibc-0.9.27/libc/sysdeps/linux/arm/vfork.S	2005-06-10 12:13:59 +0200
@@ -26,9 +26,9 @@
 
 #ifdef __NR_fork
 	.text
-	.global vfork;
+	.global vfork
 	.type vfork,%function
-	.align 4;                                                               \
+	.align 4
 vfork:
 
 #ifdef __NR_vfork
@@ -50,12 +50,7 @@
 	movcc   pc, lr
 
 __error:
-#ifdef __PIC__
-	b	__syscall_error(PLT)
-#else
 	b	__syscall_error
-#endif
-
-	.size vfork,.-vfork;
 
+	.size vfork,.-vfork
 #endif
--- uClibc-0.9.27/libc/sysdeps/linux/mips/__syscall_error.c.mps	2005-06-10 12:09:53 +0200
+++ uClibc-0.9.27/libc/sysdeps/linux/mips/__syscall_error.c	2005-06-10 12:10:08 +0200
@@ -21,7 +21,7 @@
 
 /* This routine is jumped to by all the syscall handlers, to stash
  * an error number into errno.  */
-int __syscall_error (int err_no)
+int attribute_hidden __syscall_error (int err_no)
 {
 	__set_errno (err_no);
 	return -1;
--- uClibc-0.9.27/libc/sysdeps/linux/powerpc/__syscall_error.c.mps	2005-06-10 11:59:52 +0200
+++ uClibc-0.9.27/libc/sysdeps/linux/powerpc/__syscall_error.c	2005-06-10 12:00:07 +0200
@@ -21,7 +21,7 @@
 
 /* This routine is jumped to by all the syscall handlers, to stash
  * an error number into errno.  */
-int __syscall_error (int err_no)
+int attribute_hidden __syscall_error (int err_no)
 {
 	__set_errno (err_no);
 	return -1;
--- uClibc-0.9.27/libc/sysdeps/linux/powerpc/brk.S.mps	2005-06-10 12:00:24 +0200
+++ uClibc-0.9.27/libc/sysdeps/linux/powerpc/brk.S	2005-06-10 12:04:29 +0200
@@ -24,10 +24,10 @@
 
 #ifdef __NR_brk
 	.comm	__curbrk,4,4
-	.section ".text"
-.globl      __brk;
-.type      __brk, @function;
-.align  2;
+	.text
+	.globl	__brk
+	.type	__brk, at function
+	.align	2
 
 __brk:
 	stwu    r1,-16(r1)
@@ -51,13 +51,11 @@
 	li	r3,0
 	blelr+
 	li      r3,ENOMEM
-#ifdef __PIC__
-	b	__syscall_error at plt
-#else
+
 	b	__syscall_error
-#endif
-.size __brk,.-__brk
 
-.weak brk;
-brk=__brk        
+	.size __brk,.-__brk
+
+	.weak brk
+	brk=__brk        
 #endif	
--- uClibc-0.9.27/libc/sysdeps/linux/powerpc/__uClibc_syscall.S.mps	2005-06-10 12:04:48 +0200
+++ uClibc-0.9.27/libc/sysdeps/linux/powerpc/__uClibc_syscall.S	2005-06-10 12:05:41 +0200
@@ -1,14 +1,12 @@
-.section ".text"
+	.text
 	.align 2
-.globl __uClibc_syscall
+	.globl __uClibc_syscall
 	.type	__uClibc_syscall, at function
 __uClibc_syscall:
 .Lsize:
 	sc
 	bnslr
-#ifdef __PIC__
-	b	__syscall_error at plt
-#else
+
 	b	__syscall_error
-#endif
+
 	.size	__uClibc_syscall,.Lsize-__uClibc_syscall
--- uClibc-0.9.27/libc/sysdeps/linux/powerpc/clone.S.mps	2005-06-10 12:05:53 +0200
+++ uClibc-0.9.27/libc/sysdeps/linux/powerpc/clone.S	2005-06-10 12:07:38 +0200
@@ -30,10 +30,9 @@
    		  int flags [r5], void *arg [r6]); */
 
 #ifdef __NR_clone
-.globl      __clone;
-.type      __clone, @function;
-.align  2;
-
+	.globl __clone
+	.type __clone, at function
+	.align 2
 
 __clone:
 	/* Check for child_stack == NULL || fn == NULL.  */
@@ -90,21 +89,15 @@
 	lmw	r29,16(r1)
 	addi	r1,r1,32
 	bnslr+
-#ifdef __PIC__
-	b	__syscall_error at plt
-#else
+
 	b	__syscall_error
-#endif
 
 .Lbadargs:
 	li	r3,EINVAL
-#ifdef __PIC__
-	b	__syscall_error at plt
-#else
+
 	b	__syscall_error
-#endif
 
-.size __clone,.-__clone
-.weak clone;
-clone=__clone
+	.size __clone,.-__clone
+	.weak clone
+	clone=__clone
 #endif
--- uClibc-0.9.27/libc/sysdeps/linux/powerpc/syscall.S.mps	2005-06-10 12:08:05 +0200
+++ uClibc-0.9.27/libc/sysdeps/linux/powerpc/syscall.S	2005-06-10 12:09:12 +0200
@@ -18,14 +18,10 @@
 
 #include <features.h>
 
-	.section ".text"
-	.globl	syscall;
-	.type	syscall, at function;
-	.align  2;
-
-.globl syscall;
-.type syscall, at function;
-.align 2;
+	.text
+	.globl	syscall
+	.type	syscall, at function
+	.align  2
 
 syscall:
 	mr 0,3
@@ -36,10 +32,7 @@
 	mr 7,8
 	sc
 	bnslr;
-#ifdef __PIC__
-	b __syscall_error at plt
-#else
+
 	b __syscall_error
-#endif
 
-.size syscall,.-syscall
+	.size syscall,.-syscall


More information about the uClibc mailing list