Merge "Clean up pthread_internal_t."
diff --git a/libc/arch-arm/cortex-a15/bionic/__strcat_chk.S b/libc/arch-arm/cortex-a15/bionic/__strcat_chk.S
index 616da01..dc86150 100644
--- a/libc/arch-arm/cortex-a15/bionic/__strcat_chk.S
+++ b/libc/arch-arm/cortex-a15/bionic/__strcat_chk.S
@@ -38,7 +38,6 @@
 // Check that the two lengths together don't exceed the threshold, then
 // do a memcpy of the data.
 ENTRY(__strcat_chk)
-    .cfi_startproc
     pld     [r0, #0]
     push    {r0, lr}
     .save   {r0, lr}
@@ -188,8 +187,6 @@
     mov     r2, r4
     add     r0, r0, r3
     pop     {r4, r5}
-
-    .cfi_endproc
 END(__strcat_chk)
 
 #define MEMCPY_BASE         __strcat_chk_memcpy_base
@@ -198,7 +195,6 @@
 #include "memcpy_base.S"
 
 ENTRY_PRIVATE(__strcat_chk_failed)
-    .cfi_startproc
     .save   {r0, lr}
     .save   {r4, r5}
 
@@ -218,8 +214,6 @@
     .word   BIONIC_EVENT_STRCAT_BUFFER_OVERFLOW
 error_message:
     .word   error_string-(1b+4)
-
-    .cfi_endproc
 END(__strcat_chk_failed)
 
     .data
diff --git a/libc/arch-arm/cortex-a15/bionic/__strcpy_chk.S b/libc/arch-arm/cortex-a15/bionic/__strcpy_chk.S
index 929cc98..95aaf4f 100644
--- a/libc/arch-arm/cortex-a15/bionic/__strcpy_chk.S
+++ b/libc/arch-arm/cortex-a15/bionic/__strcpy_chk.S
@@ -37,7 +37,6 @@
 // Get the length of the source string first, then do a memcpy of the data
 // instead of a strcpy.
 ENTRY(__strcpy_chk)
-    .cfi_startproc
     pld     [r0, #0]
     push    {r0, lr}
     .save   {r0, lr}
@@ -155,8 +154,6 @@
 
     // Add 1 for copy length to get the string terminator.
     add     r2, r3, #1
-
-    .cfi_endproc
 END(__strcpy_chk)
 
 #define MEMCPY_BASE         __strcpy_chk_memcpy_base
@@ -164,7 +161,6 @@
 #include "memcpy_base.S"
 
 ENTRY_PRIVATE(__strcpy_chk_failed)
-    .cfi_startproc
     .save   {r0, lr}
     .cfi_def_cfa_offset 8
     .cfi_rel_offset r0, 0
@@ -179,8 +175,6 @@
     .word   BIONIC_EVENT_STRCPY_BUFFER_OVERFLOW
 error_message:
     .word   error_string-(1b+4)
-
-    .cfi_endproc
 END(__strcpy_chk_failed)
 
     .data
diff --git a/libc/arch-arm/cortex-a15/bionic/memcpy.S b/libc/arch-arm/cortex-a15/bionic/memcpy.S
index 6f77ca6..badc93b 100644
--- a/libc/arch-arm/cortex-a15/bionic/memcpy.S
+++ b/libc/arch-arm/cortex-a15/bionic/memcpy.S
@@ -63,24 +63,19 @@
         .fpu    neon
 
 ENTRY(__memcpy_chk)
-        .cfi_startproc
         cmp     r2, r3
         bhi     __memcpy_chk_fail
 
         // Fall through to memcpy...
-        .cfi_endproc
 END(__memcpy_chk)
 
 ENTRY(memcpy)
-        .cfi_startproc
         pld     [r1, #64]
         push    {r0, lr}
         .save   {r0, lr}
         .cfi_def_cfa_offset 8
         .cfi_rel_offset r0, 0
         .cfi_rel_offset lr, 4
-
-        .cfi_endproc
 END(memcpy)
 
 #define MEMCPY_BASE         __memcpy_base
@@ -88,7 +83,6 @@
 #include "memcpy_base.S"
 
 ENTRY_PRIVATE(__memcpy_chk_fail)
-        .cfi_startproc
         // Preserve lr for backtrace.
         push    {lr}
         .save   {lr}
@@ -104,7 +98,6 @@
         .word   BIONIC_EVENT_MEMCPY_BUFFER_OVERFLOW
 error_message:
         .word   error_string-(1b+8)
-        .cfi_endproc
 END(__memcpy_chk_fail)
 
         .data
diff --git a/libc/arch-arm/cortex-a15/bionic/memcpy_base.S b/libc/arch-arm/cortex-a15/bionic/memcpy_base.S
index 4de23b3..287ea2b 100644
--- a/libc/arch-arm/cortex-a15/bionic/memcpy_base.S
+++ b/libc/arch-arm/cortex-a15/bionic/memcpy_base.S
@@ -54,7 +54,6 @@
  */
 
 ENTRY_PRIVATE(MEMCPY_BASE)
-        .cfi_startproc
         .save   {r0, lr}
         .cfi_def_cfa_offset 8
         .cfi_rel_offset r0, 0
@@ -168,12 +167,9 @@
         eor     r3, r0, r1
         ands    r3, r3, #0x3
         bne     .L_copy_unknown_alignment
-
-        .cfi_endproc
 END(MEMCPY_BASE)
 
 ENTRY_PRIVATE(MEMCPY_BASE_ALIGNED)
-        .cfi_startproc
         .save   {r0, lr}
         .cfi_def_cfa_offset 8
         .cfi_rel_offset r0, 0
@@ -322,6 +318,4 @@
 
         // Src is guaranteed to be at least word aligned by this point.
         b       .L_word_aligned
-
-        .cfi_endproc
 END(MEMCPY_BASE_ALIGNED)
diff --git a/libc/arch-arm/cortex-a15/bionic/memset.S b/libc/arch-arm/cortex-a15/bionic/memset.S
index 701310c..4e6d322 100644
--- a/libc/arch-arm/cortex-a15/bionic/memset.S
+++ b/libc/arch-arm/cortex-a15/bionic/memset.S
@@ -40,7 +40,6 @@
         .syntax     unified
 
 ENTRY(__memset_chk)
-        .cfi_startproc
         cmp         r2, r3
         bls         .L_done
 
@@ -59,21 +58,16 @@
         .word       BIONIC_EVENT_MEMSET_BUFFER_OVERFLOW
 error_message:
         .word       error_string-(1b+8)
-
-        .cfi_endproc
 END(__memset_chk)
 
 ENTRY(bzero)
-        .cfi_startproc
         mov         r2, r1
         mov         r1, #0
 .L_done:
         // Fall through to memset...
-        .cfi_endproc
 END(bzero)
 
 ENTRY(memset)
-        .cfi_startproc
         .save       {r0}
         stmfd       sp!, {r0}
         .cfi_def_cfa_offset 4
@@ -192,7 +186,6 @@
         strbcs      r1, [r0], #1
         ldmfd       sp!, {r0}
         bx          lr
-        .cfi_endproc
 END(memset)
 
         .data
diff --git a/libc/arch-arm/cortex-a15/bionic/strcmp.S b/libc/arch-arm/cortex-a15/bionic/strcmp.S
index 422be86..0cccf06 100644
--- a/libc/arch-arm/cortex-a15/bionic/strcmp.S
+++ b/libc/arch-arm/cortex-a15/bionic/strcmp.S
@@ -159,7 +159,6 @@
 #endif /* not  __ARMEB__ */
         .endm /* setup_return */
 
-        .cfi_startproc
         pld [r0, #0]
         pld [r1, #0]
 
@@ -375,5 +374,4 @@
         it      ls
         sbcls   r0, r0, r0
         bx      lr
-        .cfi_endproc
 END(strcmp)
diff --git a/libc/arch-arm/cortex-a9/bionic/__strcat_chk.S b/libc/arch-arm/cortex-a9/bionic/__strcat_chk.S
index 23b4e98..7009168 100644
--- a/libc/arch-arm/cortex-a9/bionic/__strcat_chk.S
+++ b/libc/arch-arm/cortex-a9/bionic/__strcat_chk.S
@@ -38,7 +38,6 @@
 // Check that the two lengths together don't exceed the threshold, then
 // do a memcpy of the data.
 ENTRY(__strcat_chk)
-    .cfi_startproc
     pld     [r0, #0]
     push    {r0, lr}
     .save   {r0, lr}
@@ -193,7 +192,6 @@
     pop     {r4, r5}
 
     // Fall through into the memcpy_base function.
-    .cfi_endproc
 END(__strcat_chk)
 
 #define MEMCPY_BASE         __strcat_chk_memcpy_base
@@ -201,8 +199,6 @@
 #include "memcpy_base.S"
 
 ENTRY_PRIVATE(__strcat_chk_fail)
-    .cfi_startproc
-
     .save   {r0, lr}
     .save   {r4, r5}
     .cfi_def_cfa_offset 8
@@ -221,8 +217,6 @@
     .word   BIONIC_EVENT_STRCAT_BUFFER_OVERFLOW
 error_message:
     .word   error_string-(1b+4)
-
-    .cfi_endproc
 END(__strcat_chk_fail)
 
     .data
diff --git a/libc/arch-arm/cortex-a9/bionic/__strcpy_chk.S b/libc/arch-arm/cortex-a9/bionic/__strcpy_chk.S
index adefdc3..908eec4 100644
--- a/libc/arch-arm/cortex-a9/bionic/__strcpy_chk.S
+++ b/libc/arch-arm/cortex-a9/bionic/__strcpy_chk.S
@@ -37,7 +37,6 @@
 // Get the length of the source string first, then do a memcpy of the data
 // instead of a strcpy.
 ENTRY(__strcpy_chk)
-    .cfi_startproc
     pld     [r0, #0]
     push    {r0, lr}
     .save   {r0, lr}
@@ -158,8 +157,6 @@
     // Add 1 for copy length to get the string terminator.
     add     r2, r3, #1
 
-    .cfi_endproc
-
     // Fall through into the memcpy_base function.
 END(__strcpy_chk)
 
@@ -168,8 +165,6 @@
 #include "memcpy_base.S"
 
 ENTRY_PRIVATE(__strcpy_chk_fail)
-    .cfi_startproc
-
     .save   {r0, lr}
     .cfi_def_cfa_offset 8
     .cfi_rel_offset r0, 0
@@ -185,8 +180,6 @@
     .word   BIONIC_EVENT_STRCPY_BUFFER_OVERFLOW
 error_message:
     .word   error_string-(1b+4)
-
-    .cfi_endproc
 END(__strcpy_chk_fail)
 
     .data
diff --git a/libc/arch-arm/cortex-a9/bionic/memcpy.S b/libc/arch-arm/cortex-a9/bionic/memcpy.S
index 6e0712f..72c1a66 100644
--- a/libc/arch-arm/cortex-a9/bionic/memcpy.S
+++ b/libc/arch-arm/cortex-a9/bionic/memcpy.S
@@ -41,17 +41,13 @@
         .thumb_func
 
 ENTRY(__memcpy_chk)
-        .cfi_startproc
         cmp         r2, r3
         bhi         __memcpy_chk_fail
 
         // Fall through to memcpy...
-        .cfi_endproc
 END(__memcpy_chk)
 
 ENTRY(memcpy)
-        .cfi_startproc
-
         pld     [r1, #0]
         stmfd   sp!, {r0, lr}
         .save   {r0, lr}
@@ -59,8 +55,6 @@
         .cfi_rel_offset r0, 0
         .cfi_rel_offset lr, 4
         pld     [r1, #64]
-
-        .cfi_endproc
 END(memcpy)
 
 #define MEMCPY_BASE         __memcpy_base
@@ -68,7 +62,6 @@
 #include "memcpy_base.S"
 
 ENTRY_PRIVATE(__memcpy_chk_fail)
-        .cfi_startproc
         // Preserve lr for backtrace.
         push    {lr}
         .save   {lr}
@@ -84,7 +77,6 @@
         .word   BIONIC_EVENT_MEMCPY_BUFFER_OVERFLOW
 error_message:
         .word   error_string-(1b+4)
-        .cfi_endproc
 END(__memcpy_chk_fail)
 
         .data
diff --git a/libc/arch-arm/cortex-a9/bionic/memcpy_base.S b/libc/arch-arm/cortex-a9/bionic/memcpy_base.S
index 55fd3bd..c385657 100644
--- a/libc/arch-arm/cortex-a9/bionic/memcpy_base.S
+++ b/libc/arch-arm/cortex-a9/bionic/memcpy_base.S
@@ -33,7 +33,6 @@
  */
 
 ENTRY_PRIVATE(MEMCPY_BASE)
-        .cfi_startproc
         .save       {r0, lr}
         .cfi_def_cfa_offset 8
         .cfi_rel_offset r0, 0
@@ -137,13 +136,9 @@
 
         ldmfd       sp!, {r0, lr}
         bx          lr
-
-        .cfi_endproc
 END(MEMCPY_BASE)
 
 ENTRY_PRIVATE(MEMCPY_BASE_ALIGNED)
-        .cfi_startproc
-
         .save       {r0, lr}
         .cfi_def_cfa_offset 8
         .cfi_rel_offset r0, 0
@@ -228,6 +223,4 @@
 6:
         ldmfd       sp!, {r4-r8}
         ldmfd       sp!, {r0, pc}
-
-        .cfi_endproc
 END(MEMCPY_BASE_ALIGNED)
diff --git a/libc/arch-arm/cortex-a9/bionic/memset.S b/libc/arch-arm/cortex-a9/bionic/memset.S
index e2a3f75..7f77dad 100644
--- a/libc/arch-arm/cortex-a9/bionic/memset.S
+++ b/libc/arch-arm/cortex-a9/bionic/memset.S
@@ -38,7 +38,6 @@
     .fpu    neon
 
 ENTRY(__memset_chk)
-        .cfi_startproc
         cmp         r2, r3
         bls         .L_done
 
@@ -57,25 +56,19 @@
         .word       BIONIC_EVENT_MEMSET_BUFFER_OVERFLOW
 error_message:
         .word       error_string-(1b+8)
-
-        .cfi_endproc
 END(__memset_chk)
 
 ENTRY(bzero)
-        .cfi_startproc
         mov     r2, r1
         mov     r1, #0
 
 .L_done:
         // Fall through to memset...
-        .cfi_endproc
 END(bzero)
 
 /* memset() returns its first argument.  */
 ENTRY(memset)
-        .cfi_startproc
-
-        # The neon memset only wins for less than 132.
+        // The neon memset only wins for less than 132.
         cmp         r2, #132
         bhi         __memset_large_copy
 
@@ -115,13 +108,9 @@
         strcsb      r1, [r0], #1
         ldmfd       sp!, {r0}
         bx          lr
-
-        .cfi_endproc
 END(memset)
 
 ENTRY_PRIVATE(__memset_large_copy)
-        .cfi_startproc
-
         /* compute the offset to align the destination
          * offset = (4-(src&3))&3 = -src & 3
          */
@@ -196,7 +185,6 @@
         strcsb      r1, [r0]
         ldmfd       sp!, {r0, r4-r7, lr}
         bx          lr
-        .cfi_endproc
 END(__memset_large_copy)
 
         .data
diff --git a/libc/arch-arm/cortex-a9/bionic/strcmp.S b/libc/arch-arm/cortex-a9/bionic/strcmp.S
index 24a4157..eacdb89 100644
--- a/libc/arch-arm/cortex-a9/bionic/strcmp.S
+++ b/libc/arch-arm/cortex-a9/bionic/strcmp.S
@@ -159,7 +159,6 @@
 #endif /* not  __ARMEB__ */
         .endm /* setup_return */
 
-        .cfi_startproc
         pld [r0, #0]
         pld [r1, #0]
 
@@ -547,5 +546,4 @@
     adds    sp, sp, #16
 
 	bx	lr
-    .cfi_endproc
 END(strcmp)
diff --git a/libc/arch-arm/include/machine/asm.h b/libc/arch-arm/include/machine/asm.h
index 047e54d..f16baf8 100644
--- a/libc/arch-arm/include/machine/asm.h
+++ b/libc/arch-arm/include/machine/asm.h
@@ -70,12 +70,12 @@
 #define _ASM_TYPE_FUNCTION	#function
 #define _ASM_TYPE_OBJECT	#object
 #define _ENTRY(x) \
-	.text; _ALIGN_TEXT; .globl x; .type x,_ASM_TYPE_FUNCTION; x: .fnstart
+	.text; _ALIGN_TEXT; .globl x; .type x,_ASM_TYPE_FUNCTION; x: .fnstart; .cfi_startproc;
 
 #define _ASM_SIZE(x)	.size x, .-x;
 
 #define _END(x) \
-	.fnend; \
+	.fnend; .cfi_endproc; \
 	_ASM_SIZE(x)
 
 #ifdef GPROF
diff --git a/libc/arch-arm/krait/bionic/__strcat_chk.S b/libc/arch-arm/krait/bionic/__strcat_chk.S
index 302478e..a5d06f3 100644
--- a/libc/arch-arm/krait/bionic/__strcat_chk.S
+++ b/libc/arch-arm/krait/bionic/__strcat_chk.S
@@ -38,7 +38,6 @@
 // Check that the two lengths together don't exceed the threshold, then
 // do a memcpy of the data.
 ENTRY(__strcat_chk)
-    .cfi_startproc
     pld     [r0, #0]
     push    {r0, lr}
     .save   {r0, lr}
@@ -188,8 +187,6 @@
     mov     r2, r4
     add     r0, r0, r3
     pop     {r4, r5}
-
-    .cfi_endproc
 END(__strcat_chk)
 
 #define MEMCPY_BASE         __strcat_chk_memcpy_base
@@ -197,7 +194,6 @@
 #include "memcpy_base.S"
 
 ENTRY_PRIVATE(__strcat_chk_failed)
-    .cfi_startproc
     .save   {r0, lr}
     .save   {r4, r5}
     .cfi_def_cfa_offset 8
@@ -216,8 +212,6 @@
     .word   BIONIC_EVENT_STRCAT_BUFFER_OVERFLOW
 error_message:
     .word   error_string-(1b+4)
-
-    .cfi_endproc
 END(__strcat_chk_failed)
 
     .data
diff --git a/libc/arch-arm/krait/bionic/__strcpy_chk.S b/libc/arch-arm/krait/bionic/__strcpy_chk.S
index a2c1df1..95aaf4f 100644
--- a/libc/arch-arm/krait/bionic/__strcpy_chk.S
+++ b/libc/arch-arm/krait/bionic/__strcpy_chk.S
@@ -37,7 +37,6 @@
 // Get the length of the source string first, then do a memcpy of the data
 // instead of a strcpy.
 ENTRY(__strcpy_chk)
-    .cfi_startproc
     pld     [r0, #0]
     push    {r0, lr}
     .save   {r0, lr}
@@ -155,8 +154,6 @@
 
     // Add 1 for copy length to get the string terminator.
     add     r2, r3, #1
-
-    .cfi_endproc
 END(__strcpy_chk)
 
 #define MEMCPY_BASE         __strcpy_chk_memcpy_base
@@ -164,7 +161,6 @@
 #include "memcpy_base.S"
 
 ENTRY_PRIVATE(__strcpy_chk_failed)
-    .cfi_startproc
     .save   {r0, lr}
     .cfi_def_cfa_offset 8
     .cfi_rel_offset r0, 0
@@ -179,7 +175,6 @@
     .word   BIONIC_EVENT_STRCPY_BUFFER_OVERFLOW
 error_message:
     .word   error_string-(1b+4)
-    .cfi_endproc
 END(__strcpy_chk_failed)
 
     .data
diff --git a/libc/arch-arm/krait/bionic/memcpy.S b/libc/arch-arm/krait/bionic/memcpy.S
index b3ce95d..58915e4 100644
--- a/libc/arch-arm/krait/bionic/memcpy.S
+++ b/libc/arch-arm/krait/bionic/memcpy.S
@@ -44,23 +44,19 @@
         .thumb_func
 
 ENTRY(__memcpy_chk)
-        .cfi_startproc
         cmp         r2, r3
         bhi         __memcpy_chk_fail
 
         // Fall through to memcpy...
-        .cfi_endproc
 END(__memcpy_chk)
 
 ENTRY(memcpy)
-        .cfi_startproc
         pld     [r1, #64]
         stmfd   sp!, {r0, lr}
         .save   {r0, lr}
         .cfi_def_cfa_offset 8
         .cfi_rel_offset r0, 0
         .cfi_rel_offset lr, 4
-        .cfi_endproc
 END(memcpy)
 
 #define MEMCPY_BASE         __memcpy_base
@@ -68,7 +64,6 @@
 #include "memcpy_base.S"
 
 ENTRY_PRIVATE(__memcpy_chk_fail)
-        .cfi_startproc
         // Preserve lr for backtrace.
         push    {lr}
         .save   {lr}
@@ -84,7 +79,6 @@
         .word   BIONIC_EVENT_MEMCPY_BUFFER_OVERFLOW
 error_message:
         .word   error_string-(1b+4)
-        .cfi_endproc
 END(__memcpy_chk_fail)
 
         .data
diff --git a/libc/arch-arm/krait/bionic/memcpy_base.S b/libc/arch-arm/krait/bionic/memcpy_base.S
index 9984177..99fc255 100644
--- a/libc/arch-arm/krait/bionic/memcpy_base.S
+++ b/libc/arch-arm/krait/bionic/memcpy_base.S
@@ -36,7 +36,6 @@
 // Assumes neon instructions and a cache line size of 32 bytes.
 
 ENTRY_PRIVATE(MEMCPY_BASE)
-        .cfi_startproc
         .save {r0, lr}
         .cfi_def_cfa_offset 8
         .cfi_rel_offset r0, 0
@@ -122,6 +121,4 @@
 
         ldmfd       sp!, {r0, lr}
         bx          lr
-
-        .cfi_endproc
 END(MEMCPY_BASE)
diff --git a/libc/arch-arm/krait/bionic/memset.S b/libc/arch-arm/krait/bionic/memset.S
index c5a9386..1563327 100644
--- a/libc/arch-arm/krait/bionic/memset.S
+++ b/libc/arch-arm/krait/bionic/memset.S
@@ -39,7 +39,6 @@
     .fpu    neon
 
 ENTRY(__memset_chk)
-        .cfi_startproc
         cmp         r2, r3
         bls         .L_done
 
@@ -58,23 +57,18 @@
         .word       BIONIC_EVENT_MEMSET_BUFFER_OVERFLOW
 error_message:
         .word       error_string-(1b+8)
-
-        .cfi_endproc
 END(__memset_chk)
 
 ENTRY(bzero)
-        .cfi_startproc
         mov     r2, r1
         mov     r1, #0
 
 .L_done:
         // Fall through to memset...
-        .cfi_endproc
 END(bzero)
 
 /* memset() returns its first argument.  */
 ENTRY(memset)
-        .cfi_startproc
         .save       {r0}
         stmfd       sp!, {r0}
         .cfi_def_cfa_offset 4
@@ -111,7 +105,6 @@
         strcsb      r1, [r0], #1
         ldmfd       sp!, {r0}
         bx          lr
-        .cfi_endproc
 END(memset)
 
         .data
diff --git a/libc/arch-arm/krait/bionic/strcmp.S b/libc/arch-arm/krait/bionic/strcmp.S
index e78bc9c..f735fb5 100644
--- a/libc/arch-arm/krait/bionic/strcmp.S
+++ b/libc/arch-arm/krait/bionic/strcmp.S
@@ -159,7 +159,6 @@
 #endif /* not  __ARMEB__ */
         .endm /* setup_return */
 
-        .cfi_startproc
         pld [r0, #0]
         pld [r1, #0]
 
@@ -485,5 +484,4 @@
     .cfi_restore r7
 
 	bx	lr
-    .cfi_endproc
 END(strcmp)
diff --git a/libc/arch-x86/include/machine/asm.h b/libc/arch-x86/include/machine/asm.h
index 2e8d298..5ccf78f 100644
--- a/libc/arch-x86/include/machine/asm.h
+++ b/libc/arch-x86/include/machine/asm.h
@@ -94,7 +94,7 @@
 #endif
 
 #define _ENTRY(x) \
-	.text; _ALIGN_TEXT; .globl x; .type x,@function; x:
+	.text; _ALIGN_TEXT; .globl x; .type x,@function; x: .cfi_startproc;
 #define _LABEL(x) \
 	.globl x; x:
 
@@ -175,7 +175,7 @@
 #define	NENTRY(y)	_ENTRY(_C_LABEL(y))
 #define	ASENTRY(y)	_ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
 #define	LABEL(y)	_LABEL(_C_LABEL(y))
-#define	END(y)		.size y, . - y
+#define	END(y)		.cfi_endproc; .size y, . - y
 
 #define	ASMSTR		.asciz
 
diff --git a/libc/arch-x86/string/bcopy.S b/libc/arch-x86/string/bcopy.S
index dde5ae1..40df1d0 100644
--- a/libc/arch-x86/string/bcopy.S
+++ b/libc/arch-x86/string/bcopy.S
@@ -38,15 +38,13 @@
 	 *  ws@tools.de     (Wolfgang Solfrank, TooLs GmbH) +49-228-985800
 	 */
 
-#ifdef MEMCOPY
+#if defined(MEMCOPY)
 ENTRY(memcpy)
-#else
-#ifdef MEMMOVE
+#elif defined(MEMMOVE)
 ENTRY(memmove)
 #else
 ENTRY(bcopy)
 #endif
-#endif
 	pushl	%esi
 	pushl	%edi
 #if defined(MEMCOPY) || defined(MEMMOVE)
@@ -91,3 +89,10 @@
 	popl	%esi
 	cld
 	ret
+#if defined(MEMCOPY)
+END(memcpy)
+#elif defined(MEMMOVE)
+END(memmove)
+#else
+END(bcopy)
+#endif
diff --git a/libc/arch-x86_64/bionic/__bionic_clone.S b/libc/arch-x86_64/bionic/__bionic_clone.S
index 309c365..7692013 100644
--- a/libc/arch-x86_64/bionic/__bionic_clone.S
+++ b/libc/arch-x86_64/bionic/__bionic_clone.S
@@ -70,3 +70,4 @@
         hlt
 2:
         ret
+END(__bionic_clone)
diff --git a/libc/arch-x86_64/bionic/_setjmp.S b/libc/arch-x86_64/bionic/_setjmp.S
index d9a59f7..e9b8dbb 100644
--- a/libc/arch-x86_64/bionic/_setjmp.S
+++ b/libc/arch-x86_64/bionic/_setjmp.S
@@ -63,6 +63,7 @@
 
 	xorl	%eax,%eax
 	ret
+END(_setjmp)
 
 ENTRY(_longjmp)
 	movq    (_JB_RBX * 8)(%rdi),%rbx
@@ -80,3 +81,4 @@
 	incl	%eax
 1:	movq	%r11,0(%rsp)
 	ret
+END(_longjmp)
diff --git a/libc/arch-x86_64/bionic/futex_x86_64.S b/libc/arch-x86_64/bionic/futex_x86_64.S
index d94792e..48a437e 100644
--- a/libc/arch-x86_64/bionic/futex_x86_64.S
+++ b/libc/arch-x86_64/bionic/futex_x86_64.S
@@ -42,7 +42,7 @@
     mov     $__NR_futex, %eax
     syscall
     ret
-
+END(__futex_wait)
 
 /* int __futex_wake(volatile void *ftx, int count) */
 
@@ -52,12 +52,14 @@
     mov     $__NR_futex, %eax
     syscall
     ret
+END(__futex_wake)
 
 /* int __futex_syscall3(volatile void *ftx, int op, int count) */
 ENTRY(__futex_syscall3)
     mov     $__NR_futex, %eax
     syscall
     ret
+END(__futex_syscall3)
 
 /* int __futex_syscall4(volatile void *ftx, int op, int val, const struct timespec *timeout) */
 ENTRY(__futex_syscall4)
@@ -65,3 +67,4 @@
     mov     $__NR_futex, %eax
     syscall
     ret
+END(__futex_syscall4)
diff --git a/libc/arch-x86_64/bionic/setjmp.S b/libc/arch-x86_64/bionic/setjmp.S
index 1641add..4dd9028 100644
--- a/libc/arch-x86_64/bionic/setjmp.S
+++ b/libc/arch-x86_64/bionic/setjmp.S
@@ -73,6 +73,7 @@
 
 2:	xorl	%eax,%eax
 	ret
+END(setjmp)
 
 ENTRY(longjmp)
 	movq	%rdi,%r12
@@ -101,3 +102,4 @@
 	incl	%eax
 1:	movq	%r11,0(%rsp)
 	ret
+END(longjmp)
diff --git a/libc/arch-x86_64/bionic/sigsetjmp.S b/libc/arch-x86_64/bionic/sigsetjmp.S
index 51b055a..842d6ff 100644
--- a/libc/arch-x86_64/bionic/sigsetjmp.S
+++ b/libc/arch-x86_64/bionic/sigsetjmp.S
@@ -77,6 +77,7 @@
 
 2:	xorl	%eax,%eax
 	ret
+END(sigsetjmp)
 
 ENTRY(siglongjmp)
 	movq	%rdi,%r12
@@ -105,3 +106,4 @@
 	incl	%eax
 1:	movq	%r11,0(%rsp)
 	ret
+END(siglongjmp)
diff --git a/libc/arch-x86_64/include/machine/asm.h b/libc/arch-x86_64/include/machine/asm.h
index 07b241c..310b230 100644
--- a/libc/arch-x86_64/include/machine/asm.h
+++ b/libc/arch-x86_64/include/machine/asm.h
@@ -70,7 +70,7 @@
 #endif
 
 #define _ENTRY(x) \
-	.text; _ALIGN_TEXT; .globl x; .type x,@function; x:
+	.text; _ALIGN_TEXT; .globl x; .type x,@function; x: .cfi_startproc;
 #define _LABEL(x) \
 	.globl x; x:
 
@@ -108,7 +108,7 @@
 #define	ALTENTRY(x)	NENTRY(x)
 #define	ASENTRY(y)	_ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
 #define	LABEL(y)	_LABEL(_C_LABEL(y))
-#define	END(y)		.size y, . - y
+#define	END(y)		.cfi_endproc; .size y, . - y
 
 #define	ASMSTR		.asciz
 
diff --git a/libc/include/sys/user.h b/libc/include/sys/user.h
new file mode 100644
index 0000000..dc07c1f
--- /dev/null
+++ b/libc/include/sys/user.h
@@ -0,0 +1,191 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _SYS_USER_H_
+#define _SYS_USER_H_
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
+#if __i386__
+
+struct user_i387_struct {
+  long cwd;
+  long swd;
+  long twd;
+  long fip;
+  long fcs;
+  long foo;
+  long fos;
+  long st_space[20];
+};
+struct user_fxsr_struct {
+  unsigned short cwd;
+  unsigned short swd;
+  unsigned short twd;
+  unsigned short fop;
+  long fip;
+  long fcs;
+  long foo;
+  long fos;
+  long mxcsr;
+  long reserved;
+  long st_space[32];
+  long xmm_space[32];
+  long padding[56];
+};
+struct user_regs_struct {
+  unsigned long bx;
+  unsigned long cx;
+  unsigned long dx;
+  unsigned long si;
+  unsigned long di;
+  unsigned long bp;
+  unsigned long ax;
+  unsigned long ds;
+  unsigned long es;
+  unsigned long fs;
+  unsigned long gs;
+  unsigned long orig_ax;
+  unsigned long ip;
+  unsigned long cs;
+  unsigned long flags;
+  unsigned long sp;
+  unsigned long ss;
+};
+struct user{
+  struct user_regs_struct regs;
+  int u_fpvalid;
+  struct user_i387_struct i387;
+  unsigned long int u_tsize;
+  unsigned long int u_dsize;
+  unsigned long int u_ssize;
+  unsigned long start_code;
+  unsigned long start_stack;
+  long int signal;
+  int reserved;
+  unsigned long u_ar0;
+  struct user_i387_struct *u_fpstate;
+  unsigned long magic;
+  char u_comm[32];
+  int u_debugreg[8];
+};
+
+#elif defined(__x86_64__)
+
+struct user_i387_struct {
+  unsigned short cwd;
+  unsigned short swd;
+  unsigned short twd;
+  unsigned short fop;
+  __u64 rip;
+  __u64 rdp;
+  __u32 mxcsr;
+  __u32 mxcsr_mask;
+  __u32 st_space[32];
+  __u32 xmm_space[64];
+  __u32 padding[24];
+};
+struct user_regs_struct {
+  unsigned long r15;
+  unsigned long r14;
+  unsigned long r13;
+  unsigned long r12;
+  unsigned long bp;
+  unsigned long bx;
+  unsigned long r11;
+  unsigned long r10;
+  unsigned long r9;
+  unsigned long r8;
+  unsigned long ax;
+  unsigned long cx;
+  unsigned long dx;
+  unsigned long si;
+  unsigned long di;
+  unsigned long orig_ax;
+  unsigned long ip;
+  unsigned long cs;
+  unsigned long flags;
+  unsigned long sp;
+  unsigned long ss;
+  unsigned long fs_base;
+  unsigned long gs_base;
+  unsigned long ds;
+  unsigned long es;
+  unsigned long fs;
+  unsigned long gs;
+};
+struct user {
+  struct user_regs_struct regs;
+  int u_fpvalid;
+  int pad0;
+  struct user_i387_struct i387;
+  unsigned long int u_tsize;
+  unsigned long int u_dsize;
+  unsigned long int u_ssize;
+  unsigned long start_code;
+  unsigned long start_stack;
+  long int signal;
+  int reserved;
+  int pad1;
+  unsigned long u_ar0;
+  struct user_i387_struct *u_fpstate;
+  unsigned long magic;
+  char u_comm[32];
+  unsigned long u_debugreg[8];
+  unsigned long error_code;
+  unsigned long fault_address;
+};
+
+#elif defined(__mips__)
+
+struct user {
+  unsigned long regs[180 / sizeof(unsigned long) + 64];
+  size_t u_tsize;
+  size_t u_dsize;
+  size_t u_ssize;
+  unsigned long start_code;
+  unsigned long start_data;
+  unsigned long start_stack;
+  long int signal;
+  unsigned long u_ar0;
+  unsigned long magic;
+  char u_comm[32];
+};
+
+#else
+
+/* arm and aarch64 have uapi user.h headers. */
+#include <asm/user.h>
+
+#endif
+
+__END_DECLS
+
+#endif  /* _SYS_USER_H_ */