    rep     movsb
 -  ret
 +  pop     r11
-+  nacljmp %r11d, r15
++  nacljmp r11d, r15
  
  
  quadword_copy:

   rep     movsb                   /* Copy the remaining bytes */
-  ret
+  pop     r11
+  nacljmp %r11d, r15
diff -uNr newlib-1.17.0.orig/newlib/libc/machine/x86_64/memset.S newlib-1.17.0/newlib/libc/machine/x86_64/memset.S
--- newlib-1.17.0.orig/newlib/libc/machine/x86_64/memset.S	2007-08-28 23:56:49.000000000 +0200
+++ newlib-1.17.0/newlib/libc/machine/x86_64/memset.S	2009-12-17 15:26:04.000000000 +0100
@@ -14,75 +14,90 @@
   SOTYPE_FUNCTION(memset)
 

 
-  movq    rdi, r8                 /* Align on quad word boundary */
-  andq    $7, r8
+  movl    edi, r8d                /* Align on quad word boundary */
+  andl    $7, r8d
   jz      quadword_aligned
-  movq    $8, rcx
-  subq    r8, rcx
-  subq    rcx, rdx
+  movl    $8, ecx
+  subl    r8d, ecx
+  subl    ecx, edx
+  mov     edi, edi
+  add     r15, rdi
