about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-09-17 18:23:49 +0000
committerUlrich Drepper <drepper@redhat.com>2003-09-17 18:23:49 +0000
commit06f6ca9019897f5d1799c0ae8d7293ed249c0f97 (patch)
tree9a04e5058de47ce0898cf279205c8e58735efb96 /sysdeps
parent65af7e61427ce9bbbc0e43b2ad44e5b4678a37fc (diff)
downloadglibc-06f6ca9019897f5d1799c0ae8d7293ed249c0f97.tar.gz
glibc-06f6ca9019897f5d1799c0ae8d7293ed249c0f97.tar.xz
glibc-06f6ca9019897f5d1799c0ae8d7293ed249c0f97.zip
Update.
2003-09-17  Philip Blundell  <philb@gnu.org>

	* sysdeps/unix/sysv/linux/arm/vfork.S: Branch to fork if
	libpthread is loaded.  Elide backwards compatibility code when not
	required.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/arm/dl-machine.h72
-rw-r--r--sysdeps/arm/sysdep.h9
-rw-r--r--sysdeps/i386/i686/Makefile2
-rw-r--r--sysdeps/unix/sysv/linux/arm/vfork.S5
-rw-r--r--sysdeps/x86_64/tst-stack-align.h47
5 files changed, 90 insertions, 45 deletions
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
index 9c11f0b28c..15de939a3c 100644
--- a/sysdeps/arm/dl-machine.h
+++ b/sysdeps/arm/dl-machine.h
@@ -123,22 +123,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
   return lazy;
 }
 
-/* This code is used in dl-runtime.c to call the `fixup' function
-   and then redirect to the address it returns.  */
-   // macro for handling PIC situation....
-#ifdef PIC
-#define CALL_ROUTINE(x) "\
-	ldr sl,0f\n\
-	add 	sl, pc, sl\n\
-1:	ldr	r2, 2f\n\
-	mov	lr, pc\n\
-	add	pc, sl, r2\n\
-	b	3f\n\
-0:	.word	_GLOBAL_OFFSET_TABLE_ - 1b - 4\n\
-2:	.word " #x "(GOTOFF)\n\
-3:	"
+#if defined(__THUMB_INTERWORK__)
+#define BX(x) "bx\t" #x
 #else
-#define CALL_ROUTINE(x) " bl " #x
+#define BX(x) "mov\tpc, " #x
 #endif
 
 #ifndef PROF
@@ -153,8 +141,11 @@ _dl_runtime_resolve:\n\
 	@	ip contains &GOT[n+3] (pointer to function)\n\
 	@	lr points to &GOT[2]\n\
 \n\
-	@ save almost everything; lr is already on the stack\n\
-	stmdb	sp!,{r0-r3,sl,fp}\n\
+	@ stack arguments\n\
+	stmdb	sp!,{r0-r3}\n\
+\n\
+	@ get pointer to linker struct\n\
+	ldr	r0, [lr, #-4]\n\
 \n\
 	@ prepare to call fixup()\n\
 	@ change &GOT[n+3] into 8*n        NOTE: reloc are 8 bytes each\n\
@@ -162,20 +153,17 @@ _dl_runtime_resolve:\n\
 	sub	r1, r1, #4\n\
 	add	r1, r1, r1\n\
 \n\
-	@ get pointer to linker struct\n\
-	ldr	r0, [lr, #-4]\n\
-\n\
 	@ call fixup routine\n\
-	" CALL_ROUTINE(fixup) "\n\
+	bl	fixup\n\
 \n\
 	@ save the return\n\
 	mov	ip, r0\n\
 \n\
-	@ restore the stack\n\
-	ldmia	sp!,{r0-r3,sl,fp,lr}\n\
+	@ get arguments and return address back\n\
+	ldmia	sp!, {r0-r3,lr}\n\
 \n\
 	@ jump to the newly found address\n\
-	mov	pc, ip\n\
+	" BX(ip) "\n\
 \n\
 	.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
 \n\
@@ -183,8 +171,11 @@ _dl_runtime_resolve:\n\
 	.type _dl_runtime_profile, #function\n\
 	.align 2\n\
 _dl_runtime_profile:\n\
-	@ save almost everything; lr is already on the stack\n\
-	stmdb	sp!,{r0-r3,sl,fp}\n\
+	@ stack arguments\n\
+	stmdb	sp!, {r0-r3}\n\
+\n\
+	@ get pointer to linker struct\n\
+	ldr	r0, [lr, #-4]\n\
 \n\
 	@ prepare to call fixup()\n\
 	@ change &GOT[n+3] into 8*n        NOTE: reloc are 8 bytes each\n\
@@ -192,20 +183,17 @@ _dl_runtime_profile:\n\
 	sub	r1, r1, #4\n\
 	add	r1, r1, r1\n\
 \n\
-	@ get pointer to linker struct\n\
-	ldr	r0, [lr, #-4]\n\
-\n\
 	@ call profiling fixup routine\n\
-	" CALL_ROUTINE(profile_fixup) "\n\
+	bl	profile_fixup\n\
 \n\
 	@ save the return\n\
 	mov	ip, r0\n\
 \n\
-	@ restore the stack\n\
-	ldmia	sp!,{r0-r3,sl,fp,lr}\n\
+	@ get arguments and return address back\n\
+	ldmia	sp!, {r0-r3,lr}\n\
 \n\
 	@ jump to the newly found address\n\
-	mov	pc, ip\n\
+	" BX(ip) "\n\
 \n\
 	.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
 	.previous\n\
@@ -225,8 +213,11 @@ _dl_runtime_profile:\n\
 	@	ip contains &GOT[n+3] (pointer to function)\n\
 	@	lr points to &GOT[2]\n\
 \n\
-	@ save almost everything; return add is already on the stack\n\
-	stmdb	sp!,{r0-r3,sl,fp}\n\
+	@ stack arguments\n\
+	stmdb	sp!, {r0-r3}\n\
+\n\
+	@ get pointer to linker struct\n\
+	ldr	r0, [lr, #-4]\n\
 \n\
 	@ prepare to call fixup()\n\
 	@ change &GOT[n+3] into 8*n        NOTE: reloc are 8 bytes each\n\
@@ -234,20 +225,17 @@ _dl_runtime_profile:\n\
 	sub	r1, r1, #4\n\
 	add	r1, r1, r1\n\
 \n\
-	@ get pointer to linker struct\n\
-	ldr	r0, [lr, #-4]\n\
-\n\
 	@ call profiling fixup routine\n\
-	" CALL_ROUTINE(fixup) "\n\
+	bl	fixup\n\
 \n\
 	@ save the return\n\
 	mov	ip, r0\n\
 \n\
-	@ restore the stack\n\
-	ldmia	sp!,{r0-r3,sl,fp,lr}\n\
+	@ get arguments and return address back\n\
+	ldmia	sp!, {r0-r3,lr}\n\
 \n\
 	@ jump to the newly found address\n\
-	mov	pc, ip\n\
+	" BX(ip) "\n\
 \n\
 	.size _dl_runtime_profile, .-_dl_runtime_profile\n\
 	.previous\n\
diff --git a/sysdeps/arm/sysdep.h b/sysdeps/arm/sysdep.h
index 4bc7d827b8..cb3f105afe 100644
--- a/sysdeps/arm/sysdep.h
+++ b/sysdeps/arm/sysdep.h
@@ -52,11 +52,20 @@
 	ldm##cond	base,reglist
 #define RETINSTR(instr, regs...)\
 	instr	regs
+#ifdef __THUMB_INTERWORK__
+#define DO_RET(_reg)		\
+	bx _reg
+#else
+#define DO_RET(_reg)		\
+	mov pc, _reg
+#endif
 #else  /* APCS-26 */
 #define LOADREGS(cond, base, reglist...)\
 	ldm##cond	base,reglist^
 #define RETINSTR(instr, regs...)\
 	instr##s	regs
+#define DO_RET(_reg)		\
+	movs pc, _reg
 #endif
 
 /* Define an entry point visible from C.  */
diff --git a/sysdeps/i386/i686/Makefile b/sysdeps/i386/i686/Makefile
index e9ac505e78..bfc0fc93f3 100644
--- a/sysdeps/i386/i686/Makefile
+++ b/sysdeps/i386/i686/Makefile
@@ -4,4 +4,4 @@ static-only-routines += hp-timing
 endif
 
 # So that we can test __m128's alignment
-stack-align-test-flags += -msse -mpreferred-stack-boundary=4
+stack-align-test-flags += -msse
diff --git a/sysdeps/unix/sysv/linux/arm/vfork.S b/sysdeps/unix/sysv/linux/arm/vfork.S
index 0630c7ff06..bba1a548ba 100644
--- a/sysdeps/unix/sysv/linux/arm/vfork.S
+++ b/sysdeps/unix/sysv/linux/arm/vfork.S
@@ -38,8 +38,7 @@ ENTRY (__vfork)
 	b	PLTJMP(C_SYMBOL_NAME(__syscall_error))
 # else
 	/* Check if vfork syscall is known at all.  */
-	ldr	a2, =-ENOSYS
-	teq	a1, a2
+	cmn	a2, #ENOSYS
 	bne	PLTJMP(C_SYMBOL_NAME(__syscall_error))
 # endif
 #endif
@@ -50,6 +49,8 @@ ENTRY (__vfork)
 	cmn	a1, #4096
 	RETINSTR(movcc, pc, lr)
     	b	PLTJMP(C_SYMBOL_NAME(__syscall_error))
+#elif !defined __NR_vfork
+# error "__NR_vfork not available and __ASSUME_VFORK_SYSCALL defined"
 #endif
 
 PSEUDO_END (__vfork)
diff --git a/sysdeps/x86_64/tst-stack-align.h b/sysdeps/x86_64/tst-stack-align.h
new file mode 100644
index 0000000000..a89f092c5c
--- /dev/null
+++ b/sysdeps/x86_64/tst-stack-align.h
@@ -0,0 +1,47 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <stdio.h>
+#include <stdint.h>
+
+#define TEST_STACK_ALIGN() \
+  ({									     \
+    /* AMD64 ABI mandates 16byte aligned stack.				     \
+       Unfortunately, current GCC doesn't support __int128 or __float128     \
+       types, so use aligned attribute instead.  */			     \
+    struct _S								     \
+      {									     \
+        int _i __attribute__((aligned (16)));				     \
+	int _pad[3];							     \
+      } _s = { ._i = 18 };						     \
+    double _d = 12.0;							     \
+    long double _ld = 15.0;						     \
+    int _ret = 0;							     \
+    printf ("__int128:  %d %p %zu\n", _s._i, &_s, __alignof (_s));	     \
+    if ((((uintptr_t) &_s) & (__alignof (_s) - 1)) != 0)		     \
+      _ret = 1;								     \
+									     \
+    printf ("double:  %g %p %zu\n", _d, &_d, __alignof (double));	     \
+    if ((((uintptr_t) &_d) & (__alignof (double) - 1)) != 0)		     \
+      _ret = 1;								     \
+									     \
+    printf ("ldouble: %Lg %p %zu\n", _ld, &_ld, __alignof (long double));    \
+    if ((((uintptr_t) &_ld) & (__alignof (long double) - 1)) != 0)	     \
+      _ret = 1;								     \
+    _ret;								     \
+    })