about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2014-05-21 13:24:03 -0400
committerRichard Henderson <rth@redhat.com>2014-05-21 13:24:03 -0400
commit690bb11f6080800be584d5db7b0b0ff61253c461 (patch)
tree5bc2eaa0f485f9772ee7bc948492f6cbd544ad6d
parent9e6dad45f730560cc85fdb828fd85d49b953d623 (diff)
downloadglibc-690bb11f6080800be584d5db7b0b0ff61253c461.tar.gz
glibc-690bb11f6080800be584d5db7b0b0ff61253c461.tar.xz
glibc-690bb11f6080800be584d5db7b0b0ff61253c461.zip
aarch64: Merge __local_multiple_threads offset with memory reference
This also highlights that we'd been loading 64-bits instead of
the proper 32-bits.  Caught by the linker as a relocation error,
since the variable happened to be unaligned for 64-bits.

Cherry-pick of a6b3657be6bc5067aeec98d990f60765361c6557.
-rw-r--r--ports/ChangeLog.aarch646
-rw-r--r--ports/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h9
2 files changed, 10 insertions, 5 deletions
diff --git a/ports/ChangeLog.aarch64 b/ports/ChangeLog.aarch64
index 6d4ab4778b..1dfc50b0a4 100644
--- a/ports/ChangeLog.aarch64
+++ b/ports/ChangeLog.aarch64
@@ -1,3 +1,9 @@
+2014-05-21  Richard Henderson  <rth@redhat.com>
+
+	* sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
+	(SINGLE_THREAD_P): Use the correct width load.  Fold an add
+	into the ldr offset.
+
 2014-01-22  Marcus Shawcroft  <marcus.shawcroft@arm.com>
 
 	* sysdeps/aarch64/libm-test-ulps: Regenerated.
diff --git a/ports/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h b/ports/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
index f6903b5dd8..fed1dcb215 100644
--- a/ports/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
+++ b/ports/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
@@ -162,9 +162,8 @@ extern int __local_multiple_threads attribute_hidden;
 #  else
 #   define SINGLE_THREAD_P						\
   adrp	x16, __local_multiple_threads;					\
-  add	x16, x16, #:lo12:__local_multiple_threads;			\
-  ldr	x16, [x16];							\
-  cmp	x16, 0;
+  ldr	w16, [x16, :lo12:__local_multiple_threads];			\
+  cmp	w16, 0;
 #  endif
 # else
 /*  There is no __local_multiple_threads for librt, so use the TCB.  */
@@ -180,12 +179,12 @@ extern int __local_multiple_threads attribute_hidden;
   cfi_rel_offset (x30, 8);						\
   bl	__read_tp;							\
   sub	x0, x0, PTHREAD_SIZEOF;						\
-  ldr	x16, [x0, PTHREAD_MULTIPLE_THREADS_OFFSET];			\
+  ldr	w16, [x0, PTHREAD_MULTIPLE_THREADS_OFFSET];			\
   ldp	x0, x30, [sp], 16;						\
   cfi_restore (x0);							\
   cfi_restore (x30);							\
   cfi_adjust_cfa_offset (-16);						\
-  cmp	x16, 0
+  cmp	w16, 0
 #   define SINGLE_THREAD_P_PIC(x) SINGLE_THREAD_P
 #  endif
 # endif