aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-10-25 19:07:36 +0000
committerUlrich Drepper <drepper@redhat.com>2004-10-25 19:07:36 +0000
commitc2a4357a4582255e0d69ff5e641cb77e3fcee6fe (patch)
tree08d6258ea6acc7c949659d21a4b6935650128b09
parentcd40e3a7cb46f51d5e853c4521e887596af5fabf (diff)
downloadglibc-c2a4357a4582255e0d69ff5e641cb77e3fcee6fe.tar
glibc-c2a4357a4582255e0d69ff5e641cb77e3fcee6fe.tar.gz
glibc-c2a4357a4582255e0d69ff5e641cb77e3fcee6fe.tar.bz2
glibc-c2a4357a4582255e0d69ff5e641cb77e3fcee6fe.zip
Update.
2004-10-25 Kaz Kojima <kkojima@rr.iij4u.or.jp> * sysdeps/sh/dl-machine.h: Include sysdep.h. (ELF_MACHINE_RUNTIME_TRAMPOLINE): Add CFI directives. (elf_machine_runtime_setup): Add always_inline attribute. (_dl_start_user): Pass the correct environ. (elf_machine_rela): Replace static inline by auto inline, add always_inline attribute. (elf_machine_rela_relative): Likewise. (elf_machine_lazy_rel): Likewise.
-rw-r--r--ChangeLog11
-rw-r--r--nptl/ChangeLog8
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S1
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S49
-rw-r--r--sysdeps/sh/dl-machine.h95
5 files changed, 156 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index b73247ead2..ebf8f4fd68 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2004-10-25 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * sysdeps/sh/dl-machine.h: Include sysdep.h.
+ (ELF_MACHINE_RUNTIME_TRAMPOLINE): Add CFI directives.
+ (elf_machine_runtime_setup): Add always_inline attribute.
+ (_dl_start_user): Pass the correct environ.
+ (elf_machine_rela): Replace static inline by auto inline, add
+ always_inline attribute.
+ (elf_machine_rela_relative): Likewise.
+ (elf_machine_lazy_rel): Likewise.
+
2004-10-24 Ulrich Drepper <drepper@redhat.com>
* nis/nis_call.c: Pretty printing. Minor cleanups.
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 3d6bd03cf8..be5893d3d8 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,11 @@
+2004-10-25 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
+ (__pthread_cond_timedwait): Use clock_gettime syscall if exists.
+
+ * sysdeps/unix/sysv/linux/sh/lowlevellock.S
+ (__lll_mutex_timedlock_wait): Fix a bad branch condition.
+
2004-10-24 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/smp.h (is_smp_system): Use
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
index d87f089bdb..bcb15615e5 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
@@ -117,6 +117,7 @@ __lll_mutex_timedlock_wait:
mov #1, r3
mov #2, r4
CMPXCHG (r3, @r8, r4, r2)
+ tst r2, r2
bt 8f
mov r8, r4
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
index d0c55ecfef..74206a71ec 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
@@ -133,6 +133,34 @@ __pthread_cond_timedwait:
8:
/* Get current time. */
+#ifdef __NR_clock_gettime
+ /* Get the clock number. */
+ mov.l @(cond_nwaiters,r8), r4
+ mov #((1 << clock_bits) - 1), r0
+ and r0, r4
+ /* Only clocks 0 and 1 are allowed. Both are handled in the
+ kernel. */
+ mov r15, r5
+ add #16, r5
+ mov.w .L__NR_clock_gettime, r3
+ trapa #0x12
+ SYSCALL_INST_PAD
+# ifndef __ASSUME_POSIX_TIMERS
+ cmp/eq #-ENOSYS, r0
+ bt 19f
+# endif
+
+ /* Compute relative timeout. */
+ mov.l @r13, r2
+ mov.l @(4,r13), r3
+ mov.l @(16,r15), r0
+ bra 0f
+ mov.l @(20,r15), r1
+.L__NR_clock_gettime:
+ .word __NR_clock_gettime
+
+# ifndef __ASSUME_POSIX_TIMERS
+19:
mov r15, r4
add #16, r4
mov #0, r5
@@ -143,11 +171,30 @@ __pthread_cond_timedwait:
/* Compute relative timeout. */
mov.l @(20,r15), r0
mov.w .L1k, r1
- dmulu.l r0, r1 /* Milli seconds to nano seconds. */
+ dmulu.l r0, r1 /* Micro seconds to nano seconds. */
mov.l @r13, r2
mov.l @(4,r13), r3
mov.l @(16,r15), r0
sts macl, r1
+#endif
+0:
+#else
+ mov r15, r4
+ add #16, r4
+ mov #0, r5
+ mov #SYS_gettimeofday, r3
+ trapa #0x12
+ SYSCALL_INST_PAD
+
+ /* Compute relative timeout. */
+ mov.l @(20,r15), r0
+ mov.w .L1k, r1
+ dmulu.l r0, r1 /* Micro seconds to nano seconds. */
+ mov.l @r13, r2
+ mov.l @(4,r13), r3
+ mov.l @(16,r15), r0
+ sts macl, r1
+#endif
sub r0, r2
clrt
subc r1, r3
diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h
index d3cd73762e..271666a2a3 100644
--- a/sysdeps/sh/dl-machine.h
+++ b/sysdeps/sh/dl-machine.h
@@ -26,7 +26,7 @@
#define ELF_MACHINE_NAME "SH"
#include <sys/param.h>
-
+#include <sysdep.h>
#include <assert.h>
/* Return nonzero iff ELF header is compatible with the running host. */
@@ -72,7 +72,7 @@ elf_machine_load_address (void)
/* Set up the loaded object described by L so its unrelocated PLT
entries will jump to the on-demand fixup code in dl-runtime.c. */
-static inline int __attribute__ ((unused))
+static inline int __attribute__ ((unused, always_inline))
elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
{
Elf32_Addr *got;
@@ -141,27 +141,45 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
#ifdef HAVE_FPU
#define FGR_SAVE "\
sts.l fpscr, @-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
mov #8,r3\n\
swap.w r3, r3\n\
lds r3, fpscr\n\
fmov.s fr11, @-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
fmov.s fr10, @-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
fmov.s fr9, @-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
fmov.s fr8, @-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
fmov.s fr7, @-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
fmov.s fr6, @-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
fmov.s fr5, @-r15\n\
- fmov.s fr4, @-r15"
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
+ fmov.s fr4, @-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4)
#define FGR_LOAD "\
fmov.s @r15+, fr4\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
fmov.s @r15+, fr5\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
fmov.s @r15+, fr6\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
fmov.s @r15+, fr7\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
fmov.s @r15+, fr8\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
fmov.s @r15+, fr9\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
fmov.s @r15+, fr10\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
fmov.s @r15+, fr11\n\
- lds.l @r15+, fpscr"
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
+ lds.l @r15+, fpscr\n\
+ " CFI_ADJUST_CFA_OFFSET (-4)
#else
#define FGR_SAVE ""
#define FGR_LOAD ""
@@ -172,19 +190,29 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
.text\n\
.globl _dl_runtime_resolve\n\
.type _dl_runtime_resolve, @function\n\
+ " CFI_STARTPROC "\n\
.align 5\n\
_dl_runtime_resolve:\n\
mov.l r2,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
mov.l r3,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
mov.l r4,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
mov.l r5,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
mov.l r6,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
mov.l r7,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
mov.l r12,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
movt r3 ! Save T flag.\n\
mov.l r3,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
" FGR_SAVE "\n\
sts.l pr,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
tst r0,r0\n\
bt 1f\n\
mov r0,r2\n\
@@ -195,37 +223,57 @@ _dl_runtime_resolve:\n\
jsr @r0 ! Call resolver.\n\
mov r1,r6 ! reloc offset\n\
lds.l @r15+,pr ! Get register content back.\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
" FGR_LOAD "\n\
mov.l @r15+,r3\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
shal r3 ! Lode T flag.\n\
mov.l @r15+,r12\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
mov.l @r15+,r7\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
mov.l @r15+,r6\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
mov.l @r15+,r5\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
mov.l @r15+,r4\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
mov.l @r15+,r3\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
jmp @r0 ! Jump to function address.\n\
mov.l @r15+,r2\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
.align 2\n\
3:\n\
.long " GOTJMP (fixup) "\n\
+ " CFI_ENDPROC "\n\
.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
\n\
.globl _dl_runtime_profile\n\
.type _dl_runtime_profile, @function\n\
+ " CFI_STARTPROC "\n\
.align 5\n\
_dl_runtime_profile:\n\
mov.l r2,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
mov.l r3,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
mov.l r4,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
mov.l r5,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
mov.l r6,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
mov.l r7,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
mov.l r12,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
movt r3 ! Save T flag.\n\
mov.l r3,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
" FGR_SAVE "\n\
sts.l pr,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
tst r0,r0\n\
bt 1f\n\
mov r0,r2\n\
@@ -237,20 +285,30 @@ _dl_runtime_profile:\n\
jsr @r0 ! Call resolver.\n\
mov r1,r6 ! reloc offset\n\
lds.l @r15+,pr ! Get register content back.\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
" FGR_LOAD "\n\
mov.l @r15+,r3\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
shal r3 ! Lode T flag.\n\
mov.l @r15+,r12\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
mov.l @r15+,r7\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
mov.l @r15+,r6\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
mov.l @r15+,r5\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
mov.l @r15+,r4\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
mov.l @r15+,r3\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
jmp @r0 ! Jump to function address.\n\
mov.l @r15+,r2\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
.align 2\n\
3:\n\
.long " GOTJMP (profile_fixup) "\n\
+ " CFI_ENDPROC "\n\
.size _dl_runtime_profile, .-_dl_runtime_profile\n\
.previous\n\
");
@@ -265,16 +323,25 @@ _dl_runtime_profile:\n\
_dl_runtime_resolve:\n\
_dl_runtime_profile:\n\
mov.l r2,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
mov.l r3,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
mov.l r4,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
mov.l r5,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
mov.l r6,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
mov.l r7,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
mov.l r12,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
movt r3 ! Save T flag.\n\
mov.l r3,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
" FGR_SAVE "\n\
sts.l pr,@-r15\n\
+ " CFI_ADJUST_CFA_OFFSET (4) "\n\
tst r0,r0\n\
bt 1f\n\
mov r0,r2\n\
@@ -286,20 +353,30 @@ _dl_runtime_profile:\n\
jsr @r0 ! Call resolver.\n\
mov r1,r6 ! reloc offset\n\
lds.l @r15+,pr ! Get register content back.\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
" FGR_LOAD "\n\
mov.l @r15+,r3\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
shal r3 ! Lode T flag.\n\
mov.l @r15+,r12\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
mov.l @r15+,r7\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
mov.l @r15+,r6\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
mov.l @r15+,r5\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
mov.l @r15+,r4\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
mov.l @r15+,r3\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
jmp @r0 ! Jump to function address.\n\
mov.l @r15+,r2\n\
+ " CFI_ADJUST_CFA_OFFSET (-4) "\n\
.align 2\n\
3:\n\
.long " GOTJMP (fixup) "\n\
+ " CFI_ENDPROC "\n\
.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
.size _dl_runtime_profile, .-_dl_runtime_profile\n\
.previous\n\
@@ -355,6 +432,7 @@ _dl_start_user:\n\
mov r5,r7\n\
shll2 r7\n\
add r15,r7\n\
+ add #8,r7\n\
mov.l .L_dl_loaded,r0\n\
mov.l @(r0,r12),r0\n\
mov.l @r0,r4\n\
@@ -442,7 +520,8 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
MAP is the object containing the reloc. */
-static inline void
+auto inline void
+__attribute ((always_inline))
elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
const Elf32_Sym *sym, const struct r_found_version *version,
void *const reloc_addr_arg)
@@ -618,7 +697,8 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
}
}
-static inline void
+auto inline void
+__attribute__ ((always_inline))
elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
void *const reloc_addr_arg)
{
@@ -636,7 +716,8 @@ elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
#undef COPY_UNALIGNED_WORD
}
-static inline void
+auto inline void
+__attribute__ ((always_inline))
elf_machine_lazy_rel (struct link_map *map,
Elf32_Addr l_addr, const Elf32_Rela *reloc)
{