This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
PATCH: Define __NR_futex and use LP_SIZE/RDX_LP
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Mon, 19 Mar 2012 13:50:30 -0700
- Subject: PATCH: Define __NR_futex and use LP_SIZE/RDX_LP
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
SYS_futex may not be 202 when used in x86-64 lowlevellock.h. This
patch defines __NR_futex to 202 if it isn't defined and defines
SYS_futex with __NR_futex. It also uses LP_SIZE and RDX_LP.
H.J.
----
2012-03-19 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h (__NR_futex): New.
(SYS_futex): Use it.
(lll_timedlock): Use RDX_LP
(lll_robust_timedlock): Likewise.
(LLL_STUB_UNWIND_INFO_START): Align label to LP_SIZE instead
of 8.
(LLL_STUB_UNWIND_INFO_END): Likewise.
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
index ab7ca6a..ac24c50 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
@@ -43,7 +43,11 @@
# endif
#endif
-#define SYS_futex 202
+#ifndef __NR_futex
+# define __NR_futex 202
+#endif
+
+#define SYS_futex __NR_futex
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
#define FUTEX_CMP_REQUEUE 4
@@ -119,7 +123,7 @@
".byte 0x12 # DW_CFA_def_cfa_sf\n\t" \
".uleb128 0x7\n\t" \
".sleb128 16\n\t" \
- ".align 8\n" \
+ ".align " LP_SIZE "\n" \
"9:\t" ".long 23f-10f # FDE Length\n" \
"10:\t" ".long 10b-7b # FDE CIE offset\n\t" \
".long 1b-. # FDE initial location\n\t" \
@@ -166,7 +170,7 @@
".uleb128 22f-21f\n" \
"21:\t" ".byte 0x80 # DW_OP_breg16\n\t" \
".sleb128 4b-5b\n" \
-"22:\t" ".align 8\n" \
+"22:\t" ".align " LP_SIZE "\n" \
"23:\t" ".previous\n"
/* Unwind info for
@@ -407,7 +411,7 @@ LLL_STUB_UNWIND_INFO_END
".type _L_timedlock_%=, @function\n" \
"_L_timedlock_%=:\n" \
"1:\tleaq %4, %%rdi\n" \
- "0:\tmovq %8, %%rdx\n" \
+ "0:\tmov %8, %%" RDX_LP "\n" \
"2:\tsubq $128, %%rsp\n" \
"3:\tcallq __lll_timedlock_wait\n" \
"4:\taddq $128, %%rsp\n" \
@@ -431,7 +435,7 @@ LLL_STUB_UNWIND_INFO_END
".type _L_robust_timedlock_%=, @function\n" \
"_L_robust_timedlock_%=:\n" \
"1:\tleaq %4, %%rdi\n" \
- "0:\tmovq %8, %%rdx\n" \
+ "0:\tmov %8, %%" RDX_LP "\n" \
"2:\tsubq $128, %%rsp\n" \
"3:\tcallq __lll_robust_timedlock_wait\n" \
"4:\taddq $128, %%rsp\n" \
--
1.7.6.5