about summary refs log tree commit diff
path: root/ports/sysdeps/unix/sysv
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2013-02-12 17:15:52 -0800
committerRichard Henderson <rth@twiddle.net>2013-02-28 00:16:05 -0800
commit783a65c253b144cd7b500720cf37bbddaf861a03 (patch)
tree09e6655f98d7e27b1ec35a7ce5140f3ee907a6ad /ports/sysdeps/unix/sysv
parent63cc0e75eadde85676bdde0fe8c90b540c200465 (diff)
downloadglibc-783a65c253b144cd7b500720cf37bbddaf861a03.tar.gz
glibc-783a65c253b144cd7b500720cf37bbddaf861a03.tar.xz
glibc-783a65c253b144cd7b500720cf37bbddaf861a03.zip
arm: Introduce and use PC_OFS
Scour the source for raw "-8" adjustments that are related to the
offset created by reading the pc.
Diffstat (limited to 'ports/sysdeps/unix/sysv')
-rw-r--r--ports/sysdeps/unix/sysv/linux/arm/getcontext.S2
-rw-r--r--ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h2
-rw-r--r--ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c9
-rw-r--r--ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c9
-rw-r--r--ports/sysdeps/unix/sysv/linux/arm/setcontext.S2
-rw-r--r--ports/sysdeps/unix/sysv/linux/arm/sysdep.h2
6 files changed, 12 insertions, 14 deletions
diff --git a/ports/sysdeps/unix/sysv/linux/arm/getcontext.S b/ports/sysdeps/unix/sysv/linux/arm/getcontext.S
index f7857c1996..fa00c0b789 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/getcontext.S
+++ b/ports/sysdeps/unix/sysv/linux/arm/getcontext.S
@@ -103,7 +103,7 @@ ENTRY(__getcontext)
 END(__getcontext)
 
 #ifdef PIC
-1:      .long   _GLOBAL_OFFSET_TABLE_ - 0b - 8
+1:      .long   _GLOBAL_OFFSET_TABLE_ - 0b - PC_OFS
 .Lrtld_global_ro:
 	.long   C_SYMBOL_NAME(_rtld_global_ro)(GOT)
 #else
diff --git a/ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h b/ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h
index 4bd79d4d4f..df85d51995 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h
+++ b/ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h
@@ -208,7 +208,7 @@ extern int __local_multiple_threads attribute_hidden;
 	ldr ip, [pc, ip];						\
 	teq ip, #0;
 #   define PSEUDO_PROLOGUE						\
-  1:	.word	__local_multiple_threads - 2f - 8;
+  1:	.word	__local_multiple_threads - 2f - PC_OFS;
 #  endif
 # else
 /*  There is no __local_multiple_threads for librt, so use the TCB.  */
diff --git a/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c b/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
index 58ca9acf64..caa6a26260 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
+++ b/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
@@ -84,6 +84,9 @@ __unwind_freeres (void)
    ARM unwinder relies on register state at entrance.  So we write this in
    assembly.  */
 
+#define STR1(S) #S
+#define STR(S)  STR1(S)
+
 asm (
 "	.globl	_Unwind_Resume\n"
 "	.type	_Unwind_Resume, %function\n"
@@ -118,11 +121,7 @@ asm (
 "	b	5b\n"
 "	" CFI_ENDPROC "\n"
 "	.align 2\n"
-#ifdef __thumb2__
-"1:	.word	_GLOBAL_OFFSET_TABLE_ - 3b - 4\n"
-#else
-"1:	.word	_GLOBAL_OFFSET_TABLE_ - 3b - 8\n"
-#endif
+"1:	.word	_GLOBAL_OFFSET_TABLE_ - 3b - " STR (PC_OFS) "\n"
 "2:	.word	libgcc_s_resume(GOTOFF)\n"
 "	.size	_Unwind_Resume, .-_Unwind_Resume\n"
 );
diff --git a/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c b/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
index 0a3ad953b8..1211599131 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
+++ b/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
@@ -47,6 +47,9 @@ init (void)
    ARM unwinder relies on register state at entrance.  So we write this in
    assembly.  */
 
+#define STR1(S) #S
+#define STR(S)  STR1(S)
+
 asm (
 "	.globl	_Unwind_Resume\n"
 "	.type	_Unwind_Resume, %function\n"
@@ -81,11 +84,7 @@ asm (
 "	b	5b\n"
 "	" CFI_ENDPROC "\n"
 "	.align 2\n"
-#ifdef __thumb2__
-"1:	.word	_GLOBAL_OFFSET_TABLE_ - 3b - 4\n"
-#else
-"1:	.word	_GLOBAL_OFFSET_TABLE_ - 3b - 8\n"
-#endif
+"1:	.word	_GLOBAL_OFFSET_TABLE_ - 3b - " STR (PC_OFS) "\n"
 "2:	.word	libgcc_s_resume(GOTOFF)\n"
 "	.size	_Unwind_Resume, .-_Unwind_Resume\n"
 );
diff --git a/ports/sysdeps/unix/sysv/linux/arm/setcontext.S b/ports/sysdeps/unix/sysv/linux/arm/setcontext.S
index 8e71f5b4e4..edd17bcd40 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/setcontext.S
+++ b/ports/sysdeps/unix/sysv/linux/arm/setcontext.S
@@ -93,7 +93,7 @@ ENTRY(__startcontext)
 END(__startcontext)
 
 #ifdef PIC
-1:      .long   _GLOBAL_OFFSET_TABLE_ - 0b - 8
+1:      .long   _GLOBAL_OFFSET_TABLE_ - 0b - PC_OFS
 .Lrtld_global_ro:
 	.long   C_SYMBOL_NAME(_rtld_global_ro)(GOT)
 #else
diff --git a/ports/sysdeps/unix/sysv/linux/arm/sysdep.h b/ports/sysdeps/unix/sysv/linux/arm/sysdep.h
index 676a14358a..f9b3443c14 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/sysdep.h
+++ b/ports/sysdeps/unix/sysv/linux/arm/sysdep.h
@@ -114,7 +114,7 @@ __local_syscall_error:						\
 0:     str     r0, [pc, r1];					\
        mvn     r0, #0;						\
        DO_RET(lr);						\
-1:     .word C_SYMBOL_NAME(rtld_errno) - 0b - 8;
+1:     .word C_SYMBOL_NAME(rtld_errno) - 0b - PC_OFS;
 # else
 #  if defined(__ARM_ARCH_4T__) && defined(__THUMB_INTERWORK__)
 #   define POP_PC \