public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] SH: Fix wrong branch offset computations
@ 2004-06-29 14:07 Kaz Kojima
  2004-06-29 15:54 ` Ulrich Drepper
  0 siblings, 1 reply; 2+ messages in thread
From: Kaz Kojima @ 2004-06-29 14:07 UTC (permalink / raw)
  To: libc-hacker

Hi,

There is an embarrassing bug in sysdeps/unix/sysv/linux/sh/sysdep.h
when computing the branch offset for the PLT entry and there are
similar bugs in nptl and linuxthreads.
The appended patch fixes them.

Regards,
	kaz
--
[ChangeLog]
2004-06-29  Kaz Kojima  <kkojima@rr.iij4u.or.jp>

	* sysdeps/unix/sysv/linux/sh/sysdep.h (SYSCALL_ERROR_HANDLER):
	Fix branch offset for a PLT entry.

[nptl/ChangeLog]
2004-06-29  Kaz Kojima  <kkojima@rr.iij4u.or.jp>

	* sysdeps/unix/sysv/linux/sh/pthread_once.S (__pthread_once):
	Fix branch offset for a PLT entry.
	* sysdeps/unix/sysv/linux/sh/sem_post.S (__new_sem_post):
	Likewise.
	* sysdeps/unix/sysv/linux/sh/sem_timedwait.S (sem_timedwait):
	Likewise.
	* sysdeps/unix/sysv/linux/sh/sem_trywait.S (__new_sem_trywait):
	Likewise.
	* sysdeps/unix/sysv/linux/sh/sem_wait.S (__new_sem_wait):
	Likewise.

[linuxthreads/ChangeLog]
2004-06-29  Kaz Kojima  <kkojima@rr.iij4u.or.jp>

	* sysdeps/unix/sysv/linux/sh/sysdep-cancel.h (CENABLE): Fix
	branch offset for a PLT entry.
	(CDISABLE): Likewise.

diff -u3prN ORIG/libc/sysdeps/unix/sysv/linux/sh/sysdep.h LOCAL/libc/sysdeps/unix/sysv/linux/sh/sysdep.h
--- ORIG/libc/sysdeps/unix/sysv/linux/sh/sysdep.h	Sat Apr 17 07:11:55 2004
+++ LOCAL/libc/sysdeps/unix/sysv/linux/sh/sysdep.h	Tue Jun 29 16:45:10 2004
@@ -160,7 +160,7 @@
 	 mov _IMM1,r0; \
 	.align 2; \
      0: .long _GLOBAL_OFFSET_TABLE_; \
-     1: .long PLTJMP(C_SYMBOL_NAME(__errno_location))-(2b+2-.)
+     1: .long PLTJMP(C_SYMBOL_NAME(__errno_location))-(2b-.)
 /* A quick note: it is assumed that the call to `__errno_location' does
    not modify the stack!  */
 #  endif
diff -u3prN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S
--- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S	Sat Mar 20 15:24:30 2004
+++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S	Tue Jun 29 16:45:10 2004
@@ -210,7 +210,7 @@ __pthread_once:
 
 	.align	2
 .Lsigsetjmp:
-	.long	__sigsetjmp@PLT-(.Lsigsetjmp0+2-.)
+	.long	__sigsetjmp@PLT-(.Lsigsetjmp0-.)
 .Lcpush:
 	.long	HIDDEN_JUMPTARGET(__pthread_register_cancel)-.Lcpush0
 .Lcpop:
diff -u3prN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S
--- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S	Sat Mar 29 10:09:31 2003
+++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S	Tue Jun 29 16:55:50 2004
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004 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
@@ -81,7 +81,7 @@ __new_sem_post:
 	.long	errno@GOTTPOFF
 #else
 .Lerrloc3:
-	.long	__errno_location@PLT-(.Lerrloc3b+2-.)
+	.long	__errno_location@PLT-(.Lerrloc3b-.)
 #endif
 	.size	__new_sem_post,.-__new_sem_post
 	versioned_symbol(libpthread, __new_sem_post, sem_post, GLIBC_2_1)
diff -u3prN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S
--- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S	Tue Apr 20 14:24:01 2004
+++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S	Tue Jun 29 16:45:10 2004
@@ -228,7 +228,7 @@ sem_timedwait:
 	.long	errno@GOTTPOFF
 #else
 .Lerrloc2:
-	.long	__errno_location@PLT-(.Lerrloc2b+2-.)
+	.long	__errno_location@PLT-(.Lerrloc2b-.)
 #endif
 .Lenable0:
 	.long	__pthread_enable_asynccancel-.Lenable0b
diff -u3prN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S
--- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S	Thu May 29 14:37:14 2003
+++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S	Tue Jun 29 16:56:15 2004
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004 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
@@ -83,7 +83,7 @@ __new_sem_trywait:
 	.long	errno@GOTTPOFF
 #else
 .Lerrloc1:
-	.long	__errno_location@PLT-(.Lerrloc1b+2-.)
+	.long	__errno_location@PLT-(.Lerrloc1b-.)
 #endif
 	.size	__new_sem_trywait,.-__new_sem_trywait
 	versioned_symbol(libpthread, __new_sem_trywait, sem_trywait, GLIBC_2_1)
diff -u3prN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S
--- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S	Tue Apr 20 14:24:01 2004
+++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S	Tue Jun 29 16:45:10 2004
@@ -155,7 +155,7 @@ __new_sem_wait:
 	.long	errno@GOTTPOFF
 #else
 .Lerrloc0:
-	.long	__errno_location@PLT-(.Lerrloc0b+2-.)
+	.long	__errno_location@PLT-(.Lerrloc0b-.)
 #endif
 .Lenable0:
 	.long	__pthread_enable_asynccancel-.Lenable0b

diff -u3prN ORIG/libc/linuxthreads/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h LOCAL/libc/linuxthreads/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
--- ORIG/libc/linuxthreads/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h	Tue Apr 20 14:23:59 2004
+++ LOCAL/libc/linuxthreads/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h	Tue Jun 29 17:29:34 2004
@@ -114,7 +114,7 @@
 	 mov r0,r2; \
 	.align 2; \
      1: .long _GLOBAL_OFFSET_TABLE_; \
-     2: .long __local_enable_asynccancel@PLT - (0b+2-.); \
+     2: .long __local_enable_asynccancel@PLT - (0b-.); \
      3: mov.l @r15+,r12
 
 #  define CDISABLE \
@@ -129,7 +129,7 @@
 	 nop; \
 	.align 2; \
      1: .long _GLOBAL_OFFSET_TABLE_; \
-     2: .long __local_disable_asynccancel@PLT - (0b+2-.); \
+     2: .long __local_disable_asynccancel@PLT - (0b-.); \
      3: mov.l @r15+,r12
 # else
 #  define CENABLE \

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] SH: Fix wrong branch offset computations
  2004-06-29 14:07 [PATCH] SH: Fix wrong branch offset computations Kaz Kojima
@ 2004-06-29 15:54 ` Ulrich Drepper
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2004-06-29 15:54 UTC (permalink / raw)
  To: Kaz Kojima; +Cc: libc-hacker

Applied.

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-06-29 15:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-29 14:07 [PATCH] SH: Fix wrong branch offset computations Kaz Kojima
2004-06-29 15:54 ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).