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

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

[PATCH] SH: Fix wrong branch offset computations


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 \


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