Merge "Implement twalk(3), add unit tests."
diff --git a/libc/arch-mips/bionic/_setjmp.S b/libc/arch-mips/bionic/_setjmp.S
index 4465cd2..d237e6d 100644
--- a/libc/arch-mips/bionic/_setjmp.S
+++ b/libc/arch-mips/bionic/_setjmp.S
@@ -44,17 +44,6 @@
 FRAMESZ= MKFSIZ(0,4)
 GPOFF= FRAMESZ-2*REGSZ
 
-#define FPREG64_S(FPR, OFF, BASE)       \
-        swc1    FPR, OFF(BASE)  ;       \
-        mfhc1   t0, FPR         ;       \
-        sw      t0, OFF+4(BASE) ;
-
-#define FPREG64_L(FPR, OFF, BASE)       \
-        lw      t0, OFF+4(BASE) ;       \
-        lw      t1, OFF(BASE)   ;       \
-        mtc1    t1, FPR         ;       \
-        mthc1   t0, FPR         ;       \
-
 LEAF(_setjmp, FRAMESZ)
 	PTR_SUBU sp, FRAMESZ
 	SETUP_GP64(GPOFF, _setjmp)
@@ -85,32 +74,19 @@
 	li	v0, 1				# be nice if we could tell
 	REG_S	v0, SC_FPUSED(a0)		# sc_fpused = 1
 	cfc1	v0, $31
+	s.d	$f20, SC_FPREGS+((F20-F0)*REGSZ_FP)(a0)
+	s.d	$f22, SC_FPREGS+((F22-F0)*REGSZ_FP)(a0)
+	s.d	$f24, SC_FPREGS+((F24-F0)*REGSZ_FP)(a0)
+	s.d	$f26, SC_FPREGS+((F26-F0)*REGSZ_FP)(a0)
+	s.d	$f28, SC_FPREGS+((F28-F0)*REGSZ_FP)(a0)
+	s.d	$f30, SC_FPREGS+((F30-F0)*REGSZ_FP)(a0)
 #if _MIPS_FPSET == 32
-        FPREG64_S($f20, SC_FPREGS+((F20-F0)*REGSZ_FP), a0)
-        FPREG64_S($f21, SC_FPREGS+((F21-F0)*REGSZ_FP), a0)
-        FPREG64_S($f22, SC_FPREGS+((F22-F0)*REGSZ_FP), a0)
-        FPREG64_S($f23, SC_FPREGS+((F23-F0)*REGSZ_FP), a0)
-        FPREG64_S($f24, SC_FPREGS+((F24-F0)*REGSZ_FP), a0)
-        FPREG64_S($f25, SC_FPREGS+((F25-F0)*REGSZ_FP), a0)
-        FPREG64_S($f26, SC_FPREGS+((F26-F0)*REGSZ_FP), a0)
-        FPREG64_S($f27, SC_FPREGS+((F27-F0)*REGSZ_FP), a0)
-        FPREG64_S($f28, SC_FPREGS+((F28-F0)*REGSZ_FP), a0)
-        FPREG64_S($f29, SC_FPREGS+((F29-F0)*REGSZ_FP), a0)
-        FPREG64_S($f30, SC_FPREGS+((F30-F0)*REGSZ_FP), a0)
-        FPREG64_S($f31, SC_FPREGS+((F31-F0)*REGSZ_FP), a0)
-#else
-        swc1    $f20, SC_FPREGS+((F20-F0)*REGSZ_FP)(a0)
-        swc1    $f21, SC_FPREGS+((F21-F0)*REGSZ_FP)(a0)
-        swc1    $f22, SC_FPREGS+((F22-F0)*REGSZ_FP)(a0)
-        swc1    $f23, SC_FPREGS+((F23-F0)*REGSZ_FP)(a0)
-        swc1    $f24, SC_FPREGS+((F24-F0)*REGSZ_FP)(a0)
-        swc1    $f25, SC_FPREGS+((F25-F0)*REGSZ_FP)(a0)
-        swc1    $f26, SC_FPREGS+((F26-F0)*REGSZ_FP)(a0)
-        swc1    $f27, SC_FPREGS+((F27-F0)*REGSZ_FP)(a0)
-        swc1    $f28, SC_FPREGS+((F28-F0)*REGSZ_FP)(a0)
-        swc1    $f29, SC_FPREGS+((F29-F0)*REGSZ_FP)(a0)
-        swc1    $f30, SC_FPREGS+((F30-F0)*REGSZ_FP)(a0)
-        swc1    $f31, SC_FPREGS+((F31-F0)*REGSZ_FP)(a0)
+	s.d	$f21, SC_FPREGS+((F21-F0)*REGSZ_FP)(a0)
+	s.d	$f23, SC_FPREGS+((F23-F0)*REGSZ_FP)(a0)
+	s.d	$f25, SC_FPREGS+((F25-F0)*REGSZ_FP)(a0)
+	s.d	$f27, SC_FPREGS+((F27-F0)*REGSZ_FP)(a0)
+	s.d	$f29, SC_FPREGS+((F29-F0)*REGSZ_FP)(a0)
+	s.d	$f31, SC_FPREGS+((F31-F0)*REGSZ_FP)(a0)
 #endif
 	REG_S	v0, SC_FPREGS+((FSR-F0)*REGSZ)(a0)
 #endif /* !SOFTFLOAT */
@@ -142,32 +118,19 @@
 	REG_L	sp, SC_REGS+SP*REGSZ(a0)
 #if !defined(SOFTFLOAT)
 	ctc1	v0, $31
+	l.d	$f20, SC_FPREGS+((F20-F0)*REGSZ_FP)(a0)
+	l.d	$f22, SC_FPREGS+((F22-F0)*REGSZ_FP)(a0)
+	l.d	$f24, SC_FPREGS+((F24-F0)*REGSZ_FP)(a0)
+	l.d	$f26, SC_FPREGS+((F26-F0)*REGSZ_FP)(a0)
+	l.d	$f28, SC_FPREGS+((F28-F0)*REGSZ_FP)(a0)
+	l.d	$f30, SC_FPREGS+((F30-F0)*REGSZ_FP)(a0)
 #if _MIPS_FPSET == 32
-        FPREG64_L($f20, SC_FPREGS+((F20-F0)*REGSZ_FP), a0)
-        FPREG64_L($f21, SC_FPREGS+((F21-F0)*REGSZ_FP), a0)
-        FPREG64_L($f22, SC_FPREGS+((F22-F0)*REGSZ_FP), a0)
-        FPREG64_L($f23, SC_FPREGS+((F23-F0)*REGSZ_FP), a0)
-        FPREG64_L($f24, SC_FPREGS+((F24-F0)*REGSZ_FP), a0)
-        FPREG64_L($f25, SC_FPREGS+((F25-F0)*REGSZ_FP), a0)
-        FPREG64_L($f26, SC_FPREGS+((F26-F0)*REGSZ_FP), a0)
-        FPREG64_L($f27, SC_FPREGS+((F27-F0)*REGSZ_FP), a0)
-        FPREG64_L($f28, SC_FPREGS+((F28-F0)*REGSZ_FP), a0)
-        FPREG64_L($f29, SC_FPREGS+((F29-F0)*REGSZ_FP), a0)
-        FPREG64_L($f30, SC_FPREGS+((F30-F0)*REGSZ_FP), a0)
-        FPREG64_L($f31, SC_FPREGS+((F31-F0)*REGSZ_FP), a0)
-#else
-        lwc1    $f20, SC_FPREGS+((F20-F0)*REGSZ_FP)(a0)
-        lwc1    $f21, SC_FPREGS+((F21-F0)*REGSZ_FP)(a0)
-        lwc1    $f22, SC_FPREGS+((F22-F0)*REGSZ_FP)(a0)
-        lwc1    $f23, SC_FPREGS+((F23-F0)*REGSZ_FP)(a0)
-        lwc1    $f24, SC_FPREGS+((F24-F0)*REGSZ_FP)(a0)
-        lwc1    $f25, SC_FPREGS+((F25-F0)*REGSZ_FP)(a0)
-        lwc1    $f26, SC_FPREGS+((F26-F0)*REGSZ_FP)(a0)
-        lwc1    $f27, SC_FPREGS+((F27-F0)*REGSZ_FP)(a0)
-        lwc1    $f28, SC_FPREGS+((F28-F0)*REGSZ_FP)(a0)
-        lwc1    $f29, SC_FPREGS+((F29-F0)*REGSZ_FP)(a0)
-        lwc1    $f30, SC_FPREGS+((F30-F0)*REGSZ_FP)(a0)
-        lwc1    $f31, SC_FPREGS+((F31-F0)*REGSZ_FP)(a0)
+	l.d	$f21, SC_FPREGS+((F21-F0)*REGSZ_FP)(a0)
+	l.d	$f23, SC_FPREGS+((F23-F0)*REGSZ_FP)(a0)
+	l.d	$f25, SC_FPREGS+((F25-F0)*REGSZ_FP)(a0)
+	l.d	$f27, SC_FPREGS+((F27-F0)*REGSZ_FP)(a0)
+	l.d	$f29, SC_FPREGS+((F29-F0)*REGSZ_FP)(a0)
+	l.d	$f31, SC_FPREGS+((F31-F0)*REGSZ_FP)(a0)
 #endif
 #endif /* !SOFTFLOAT */
 	bne	a1, zero, 1f
diff --git a/libc/arch-mips/bionic/setjmp.S b/libc/arch-mips/bionic/setjmp.S
index 2af1fbd..31786be 100644
--- a/libc/arch-mips/bionic/setjmp.S
+++ b/libc/arch-mips/bionic/setjmp.S
@@ -45,17 +45,6 @@
 GPOFF= FRAMESZ-2*REGSZ
 RAOFF= FRAMESZ-1*REGSZ
 
-#define FPREG64_S(FPR, OFF, BASE)       \
-        swc1    FPR, OFF(BASE)  ;       \
-        mfhc1   t0, FPR         ;       \
-        sw      t0, OFF+4(BASE) ;
-
-#define FPREG64_L(FPR, OFF, BASE)       \
-        lw      t0, OFF+4(BASE) ;       \
-        lw      t1, OFF(BASE)   ;       \
-        mtc1    t1, FPR         ;       \
-        mthc1   t0, FPR         ;       \
-
 NON_LEAF(setjmp, FRAMESZ, ra)
 	.mask	0x80000000, RAOFF
 	PTR_SUBU sp, FRAMESZ			# allocate stack frame
@@ -98,32 +87,19 @@
 	li	v0, 1				# be nice if we could tell
 	REG_S	v0, SC_FPUSED(a0)		# sc_fpused = 1
 	cfc1	v0, $31
+	s.d	$f20, SC_FPREGS+((F20-F0)*REGSZ_FP)(a0)
+	s.d	$f22, SC_FPREGS+((F22-F0)*REGSZ_FP)(a0)
+	s.d	$f24, SC_FPREGS+((F24-F0)*REGSZ_FP)(a0)
+	s.d	$f26, SC_FPREGS+((F26-F0)*REGSZ_FP)(a0)
+	s.d	$f28, SC_FPREGS+((F28-F0)*REGSZ_FP)(a0)
+	s.d	$f30, SC_FPREGS+((F30-F0)*REGSZ_FP)(a0)
 #if _MIPS_FPSET == 32
-        FPREG64_S($f20, SC_FPREGS+((F20-F0)*REGSZ_FP), a0)
-        FPREG64_S($f21, SC_FPREGS+((F21-F0)*REGSZ_FP), a0)
-        FPREG64_S($f22, SC_FPREGS+((F22-F0)*REGSZ_FP), a0)
-        FPREG64_S($f23, SC_FPREGS+((F23-F0)*REGSZ_FP), a0)
-        FPREG64_S($f24, SC_FPREGS+((F24-F0)*REGSZ_FP), a0)
-        FPREG64_S($f25, SC_FPREGS+((F25-F0)*REGSZ_FP), a0)
-        FPREG64_S($f26, SC_FPREGS+((F26-F0)*REGSZ_FP), a0)
-        FPREG64_S($f27, SC_FPREGS+((F27-F0)*REGSZ_FP), a0)
-        FPREG64_S($f28, SC_FPREGS+((F28-F0)*REGSZ_FP), a0)
-        FPREG64_S($f29, SC_FPREGS+((F29-F0)*REGSZ_FP), a0)
-        FPREG64_S($f30, SC_FPREGS+((F30-F0)*REGSZ_FP), a0)
-        FPREG64_S($f31, SC_FPREGS+((F31-F0)*REGSZ_FP), a0)
-#else
-        swc1    $f20, SC_FPREGS+((F20-F0)*REGSZ_FP)(a0)
-        swc1    $f21, SC_FPREGS+((F21-F0)*REGSZ_FP)(a0)
-        swc1    $f22, SC_FPREGS+((F22-F0)*REGSZ_FP)(a0)
-        swc1    $f23, SC_FPREGS+((F23-F0)*REGSZ_FP)(a0)
-        swc1    $f24, SC_FPREGS+((F24-F0)*REGSZ_FP)(a0)
-        swc1    $f25, SC_FPREGS+((F25-F0)*REGSZ_FP)(a0)
-        swc1    $f26, SC_FPREGS+((F26-F0)*REGSZ_FP)(a0)
-        swc1    $f27, SC_FPREGS+((F27-F0)*REGSZ_FP)(a0)
-        swc1    $f28, SC_FPREGS+((F28-F0)*REGSZ_FP)(a0)
-        swc1    $f29, SC_FPREGS+((F29-F0)*REGSZ_FP)(a0)
-        swc1    $f30, SC_FPREGS+((F30-F0)*REGSZ_FP)(a0)
-        swc1    $f31, SC_FPREGS+((F31-F0)*REGSZ_FP)(a0)
+	s.d	$f21, SC_FPREGS+((F21-F0)*REGSZ_FP)(a0)
+	s.d	$f23, SC_FPREGS+((F23-F0)*REGSZ_FP)(a0)
+	s.d	$f25, SC_FPREGS+((F25-F0)*REGSZ_FP)(a0)
+	s.d	$f27, SC_FPREGS+((F27-F0)*REGSZ_FP)(a0)
+	s.d	$f29, SC_FPREGS+((F29-F0)*REGSZ_FP)(a0)
+	s.d	$f31, SC_FPREGS+((F31-F0)*REGSZ_FP)(a0)
 #endif
 	REG_S	v0, SC_FPREGS+((FSR-F0)*REGSZ)(a0)
 #endif /* !SOFTFLOAT */
@@ -173,32 +149,19 @@
 #if !defined(SOFTFLOAT)
 	REG_L	v0, SC_FPREGS+((FSR-F0)*REGSZ)(a0)
 	ctc1	v0, $31
+	l.d	$f20, SC_FPREGS+((F20-F0)*REGSZ_FP)(a0)
+	l.d	$f22, SC_FPREGS+((F22-F0)*REGSZ_FP)(a0)
+	l.d	$f24, SC_FPREGS+((F24-F0)*REGSZ_FP)(a0)
+	l.d	$f26, SC_FPREGS+((F26-F0)*REGSZ_FP)(a0)
+	l.d	$f28, SC_FPREGS+((F28-F0)*REGSZ_FP)(a0)
+	l.d	$f30, SC_FPREGS+((F30-F0)*REGSZ_FP)(a0)
 #if _MIPS_FPSET == 32
-        FPREG64_L($f20, SC_FPREGS+((F20-F0)*REGSZ_FP), a0)
-        FPREG64_L($f21, SC_FPREGS+((F21-F0)*REGSZ_FP), a0)
-        FPREG64_L($f22, SC_FPREGS+((F22-F0)*REGSZ_FP), a0)
-        FPREG64_L($f23, SC_FPREGS+((F23-F0)*REGSZ_FP), a0)
-        FPREG64_L($f24, SC_FPREGS+((F24-F0)*REGSZ_FP), a0)
-        FPREG64_L($f25, SC_FPREGS+((F25-F0)*REGSZ_FP), a0)
-        FPREG64_L($f26, SC_FPREGS+((F26-F0)*REGSZ_FP), a0)
-        FPREG64_L($f27, SC_FPREGS+((F27-F0)*REGSZ_FP), a0)
-        FPREG64_L($f28, SC_FPREGS+((F28-F0)*REGSZ_FP), a0)
-        FPREG64_L($f29, SC_FPREGS+((F29-F0)*REGSZ_FP), a0)
-        FPREG64_L($f30, SC_FPREGS+((F30-F0)*REGSZ_FP), a0)
-        FPREG64_L($f31, SC_FPREGS+((F31-F0)*REGSZ_FP), a0)
-#else
-        lwc1    $f20, SC_FPREGS+((F20-F0)*REGSZ_FP)(a0)
-        lwc1    $f21, SC_FPREGS+((F21-F0)*REGSZ_FP)(a0)
-        lwc1    $f22, SC_FPREGS+((F22-F0)*REGSZ_FP)(a0)
-        lwc1    $f23, SC_FPREGS+((F23-F0)*REGSZ_FP)(a0)
-        lwc1    $f24, SC_FPREGS+((F24-F0)*REGSZ_FP)(a0)
-        lwc1    $f25, SC_FPREGS+((F25-F0)*REGSZ_FP)(a0)
-        lwc1    $f26, SC_FPREGS+((F26-F0)*REGSZ_FP)(a0)
-        lwc1    $f27, SC_FPREGS+((F27-F0)*REGSZ_FP)(a0)
-        lwc1    $f28, SC_FPREGS+((F28-F0)*REGSZ_FP)(a0)
-        lwc1    $f29, SC_FPREGS+((F29-F0)*REGSZ_FP)(a0)
-        lwc1    $f30, SC_FPREGS+((F30-F0)*REGSZ_FP)(a0)
-        lwc1    $f31, SC_FPREGS+((F31-F0)*REGSZ_FP)(a0)
+	l.d	$f21, SC_FPREGS+((F21-F0)*REGSZ_FP)(a0)
+	l.d	$f23, SC_FPREGS+((F23-F0)*REGSZ_FP)(a0)
+	l.d	$f25, SC_FPREGS+((F25-F0)*REGSZ_FP)(a0)
+	l.d	$f27, SC_FPREGS+((F27-F0)*REGSZ_FP)(a0)
+	l.d	$f29, SC_FPREGS+((F29-F0)*REGSZ_FP)(a0)
+	l.d	$f31, SC_FPREGS+((F31-F0)*REGSZ_FP)(a0)
 #endif
 #endif /* !SOFTFLOAT */
 	bne	a1, zero, 1f
diff --git a/libc/arch-mips/mips.mk b/libc/arch-mips/mips.mk
index 5705c8a..cb76985 100644
--- a/libc/arch-mips/mips.mk
+++ b/libc/arch-mips/mips.mk
@@ -47,11 +47,6 @@
     bionic/__strcat_chk.cpp \
 
 
-ifneq ($(ARCH_MIPS_HAS_FPU),true)
-libc_common_cflags_mips := \
-    -DSOFTFLOAT
-endif
-
 ##########################################
 ### CPU specific source files
 libc_bionic_src_files_mips += \
diff --git a/libc/arch-mips64/bionic/_setjmp.S b/libc/arch-mips64/bionic/_setjmp.S
index 4465cd2..d237e6d 100644
--- a/libc/arch-mips64/bionic/_setjmp.S
+++ b/libc/arch-mips64/bionic/_setjmp.S
@@ -44,17 +44,6 @@
 FRAMESZ= MKFSIZ(0,4)
 GPOFF= FRAMESZ-2*REGSZ
 
-#define FPREG64_S(FPR, OFF, BASE)       \
-        swc1    FPR, OFF(BASE)  ;       \
-        mfhc1   t0, FPR         ;       \
-        sw      t0, OFF+4(BASE) ;
-
-#define FPREG64_L(FPR, OFF, BASE)       \
-        lw      t0, OFF+4(BASE) ;       \
-        lw      t1, OFF(BASE)   ;       \
-        mtc1    t1, FPR         ;       \
-        mthc1   t0, FPR         ;       \
-
 LEAF(_setjmp, FRAMESZ)
 	PTR_SUBU sp, FRAMESZ
 	SETUP_GP64(GPOFF, _setjmp)
@@ -85,32 +74,19 @@
 	li	v0, 1				# be nice if we could tell
 	REG_S	v0, SC_FPUSED(a0)		# sc_fpused = 1
 	cfc1	v0, $31
+	s.d	$f20, SC_FPREGS+((F20-F0)*REGSZ_FP)(a0)
+	s.d	$f22, SC_FPREGS+((F22-F0)*REGSZ_FP)(a0)
+	s.d	$f24, SC_FPREGS+((F24-F0)*REGSZ_FP)(a0)
+	s.d	$f26, SC_FPREGS+((F26-F0)*REGSZ_FP)(a0)
+	s.d	$f28, SC_FPREGS+((F28-F0)*REGSZ_FP)(a0)
+	s.d	$f30, SC_FPREGS+((F30-F0)*REGSZ_FP)(a0)
 #if _MIPS_FPSET == 32
-        FPREG64_S($f20, SC_FPREGS+((F20-F0)*REGSZ_FP), a0)
-        FPREG64_S($f21, SC_FPREGS+((F21-F0)*REGSZ_FP), a0)
-        FPREG64_S($f22, SC_FPREGS+((F22-F0)*REGSZ_FP), a0)
-        FPREG64_S($f23, SC_FPREGS+((F23-F0)*REGSZ_FP), a0)
-        FPREG64_S($f24, SC_FPREGS+((F24-F0)*REGSZ_FP), a0)
-        FPREG64_S($f25, SC_FPREGS+((F25-F0)*REGSZ_FP), a0)
-        FPREG64_S($f26, SC_FPREGS+((F26-F0)*REGSZ_FP), a0)
-        FPREG64_S($f27, SC_FPREGS+((F27-F0)*REGSZ_FP), a0)
-        FPREG64_S($f28, SC_FPREGS+((F28-F0)*REGSZ_FP), a0)
-        FPREG64_S($f29, SC_FPREGS+((F29-F0)*REGSZ_FP), a0)
-        FPREG64_S($f30, SC_FPREGS+((F30-F0)*REGSZ_FP), a0)
-        FPREG64_S($f31, SC_FPREGS+((F31-F0)*REGSZ_FP), a0)
-#else
-        swc1    $f20, SC_FPREGS+((F20-F0)*REGSZ_FP)(a0)
-        swc1    $f21, SC_FPREGS+((F21-F0)*REGSZ_FP)(a0)
-        swc1    $f22, SC_FPREGS+((F22-F0)*REGSZ_FP)(a0)
-        swc1    $f23, SC_FPREGS+((F23-F0)*REGSZ_FP)(a0)
-        swc1    $f24, SC_FPREGS+((F24-F0)*REGSZ_FP)(a0)
-        swc1    $f25, SC_FPREGS+((F25-F0)*REGSZ_FP)(a0)
-        swc1    $f26, SC_FPREGS+((F26-F0)*REGSZ_FP)(a0)
-        swc1    $f27, SC_FPREGS+((F27-F0)*REGSZ_FP)(a0)
-        swc1    $f28, SC_FPREGS+((F28-F0)*REGSZ_FP)(a0)
-        swc1    $f29, SC_FPREGS+((F29-F0)*REGSZ_FP)(a0)
-        swc1    $f30, SC_FPREGS+((F30-F0)*REGSZ_FP)(a0)
-        swc1    $f31, SC_FPREGS+((F31-F0)*REGSZ_FP)(a0)
+	s.d	$f21, SC_FPREGS+((F21-F0)*REGSZ_FP)(a0)
+	s.d	$f23, SC_FPREGS+((F23-F0)*REGSZ_FP)(a0)
+	s.d	$f25, SC_FPREGS+((F25-F0)*REGSZ_FP)(a0)
+	s.d	$f27, SC_FPREGS+((F27-F0)*REGSZ_FP)(a0)
+	s.d	$f29, SC_FPREGS+((F29-F0)*REGSZ_FP)(a0)
+	s.d	$f31, SC_FPREGS+((F31-F0)*REGSZ_FP)(a0)
 #endif
 	REG_S	v0, SC_FPREGS+((FSR-F0)*REGSZ)(a0)
 #endif /* !SOFTFLOAT */
@@ -142,32 +118,19 @@
 	REG_L	sp, SC_REGS+SP*REGSZ(a0)
 #if !defined(SOFTFLOAT)
 	ctc1	v0, $31
+	l.d	$f20, SC_FPREGS+((F20-F0)*REGSZ_FP)(a0)
+	l.d	$f22, SC_FPREGS+((F22-F0)*REGSZ_FP)(a0)
+	l.d	$f24, SC_FPREGS+((F24-F0)*REGSZ_FP)(a0)
+	l.d	$f26, SC_FPREGS+((F26-F0)*REGSZ_FP)(a0)
+	l.d	$f28, SC_FPREGS+((F28-F0)*REGSZ_FP)(a0)
+	l.d	$f30, SC_FPREGS+((F30-F0)*REGSZ_FP)(a0)
 #if _MIPS_FPSET == 32
-        FPREG64_L($f20, SC_FPREGS+((F20-F0)*REGSZ_FP), a0)
-        FPREG64_L($f21, SC_FPREGS+((F21-F0)*REGSZ_FP), a0)
-        FPREG64_L($f22, SC_FPREGS+((F22-F0)*REGSZ_FP), a0)
-        FPREG64_L($f23, SC_FPREGS+((F23-F0)*REGSZ_FP), a0)
-        FPREG64_L($f24, SC_FPREGS+((F24-F0)*REGSZ_FP), a0)
-        FPREG64_L($f25, SC_FPREGS+((F25-F0)*REGSZ_FP), a0)
-        FPREG64_L($f26, SC_FPREGS+((F26-F0)*REGSZ_FP), a0)
-        FPREG64_L($f27, SC_FPREGS+((F27-F0)*REGSZ_FP), a0)
-        FPREG64_L($f28, SC_FPREGS+((F28-F0)*REGSZ_FP), a0)
-        FPREG64_L($f29, SC_FPREGS+((F29-F0)*REGSZ_FP), a0)
-        FPREG64_L($f30, SC_FPREGS+((F30-F0)*REGSZ_FP), a0)
-        FPREG64_L($f31, SC_FPREGS+((F31-F0)*REGSZ_FP), a0)
-#else
-        lwc1    $f20, SC_FPREGS+((F20-F0)*REGSZ_FP)(a0)
-        lwc1    $f21, SC_FPREGS+((F21-F0)*REGSZ_FP)(a0)
-        lwc1    $f22, SC_FPREGS+((F22-F0)*REGSZ_FP)(a0)
-        lwc1    $f23, SC_FPREGS+((F23-F0)*REGSZ_FP)(a0)
-        lwc1    $f24, SC_FPREGS+((F24-F0)*REGSZ_FP)(a0)
-        lwc1    $f25, SC_FPREGS+((F25-F0)*REGSZ_FP)(a0)
-        lwc1    $f26, SC_FPREGS+((F26-F0)*REGSZ_FP)(a0)
-        lwc1    $f27, SC_FPREGS+((F27-F0)*REGSZ_FP)(a0)
-        lwc1    $f28, SC_FPREGS+((F28-F0)*REGSZ_FP)(a0)
-        lwc1    $f29, SC_FPREGS+((F29-F0)*REGSZ_FP)(a0)
-        lwc1    $f30, SC_FPREGS+((F30-F0)*REGSZ_FP)(a0)
-        lwc1    $f31, SC_FPREGS+((F31-F0)*REGSZ_FP)(a0)
+	l.d	$f21, SC_FPREGS+((F21-F0)*REGSZ_FP)(a0)
+	l.d	$f23, SC_FPREGS+((F23-F0)*REGSZ_FP)(a0)
+	l.d	$f25, SC_FPREGS+((F25-F0)*REGSZ_FP)(a0)
+	l.d	$f27, SC_FPREGS+((F27-F0)*REGSZ_FP)(a0)
+	l.d	$f29, SC_FPREGS+((F29-F0)*REGSZ_FP)(a0)
+	l.d	$f31, SC_FPREGS+((F31-F0)*REGSZ_FP)(a0)
 #endif
 #endif /* !SOFTFLOAT */
 	bne	a1, zero, 1f
diff --git a/libc/arch-mips64/bionic/setjmp.S b/libc/arch-mips64/bionic/setjmp.S
index 2af1fbd..31786be 100644
--- a/libc/arch-mips64/bionic/setjmp.S
+++ b/libc/arch-mips64/bionic/setjmp.S
@@ -45,17 +45,6 @@
 GPOFF= FRAMESZ-2*REGSZ
 RAOFF= FRAMESZ-1*REGSZ
 
-#define FPREG64_S(FPR, OFF, BASE)       \
-        swc1    FPR, OFF(BASE)  ;       \
-        mfhc1   t0, FPR         ;       \
-        sw      t0, OFF+4(BASE) ;
-
-#define FPREG64_L(FPR, OFF, BASE)       \
-        lw      t0, OFF+4(BASE) ;       \
-        lw      t1, OFF(BASE)   ;       \
-        mtc1    t1, FPR         ;       \
-        mthc1   t0, FPR         ;       \
-
 NON_LEAF(setjmp, FRAMESZ, ra)
 	.mask	0x80000000, RAOFF
 	PTR_SUBU sp, FRAMESZ			# allocate stack frame
@@ -98,32 +87,19 @@
 	li	v0, 1				# be nice if we could tell
 	REG_S	v0, SC_FPUSED(a0)		# sc_fpused = 1
 	cfc1	v0, $31
+	s.d	$f20, SC_FPREGS+((F20-F0)*REGSZ_FP)(a0)
+	s.d	$f22, SC_FPREGS+((F22-F0)*REGSZ_FP)(a0)
+	s.d	$f24, SC_FPREGS+((F24-F0)*REGSZ_FP)(a0)
+	s.d	$f26, SC_FPREGS+((F26-F0)*REGSZ_FP)(a0)
+	s.d	$f28, SC_FPREGS+((F28-F0)*REGSZ_FP)(a0)
+	s.d	$f30, SC_FPREGS+((F30-F0)*REGSZ_FP)(a0)
 #if _MIPS_FPSET == 32
-        FPREG64_S($f20, SC_FPREGS+((F20-F0)*REGSZ_FP), a0)
-        FPREG64_S($f21, SC_FPREGS+((F21-F0)*REGSZ_FP), a0)
-        FPREG64_S($f22, SC_FPREGS+((F22-F0)*REGSZ_FP), a0)
-        FPREG64_S($f23, SC_FPREGS+((F23-F0)*REGSZ_FP), a0)
-        FPREG64_S($f24, SC_FPREGS+((F24-F0)*REGSZ_FP), a0)
-        FPREG64_S($f25, SC_FPREGS+((F25-F0)*REGSZ_FP), a0)
-        FPREG64_S($f26, SC_FPREGS+((F26-F0)*REGSZ_FP), a0)
-        FPREG64_S($f27, SC_FPREGS+((F27-F0)*REGSZ_FP), a0)
-        FPREG64_S($f28, SC_FPREGS+((F28-F0)*REGSZ_FP), a0)
-        FPREG64_S($f29, SC_FPREGS+((F29-F0)*REGSZ_FP), a0)
-        FPREG64_S($f30, SC_FPREGS+((F30-F0)*REGSZ_FP), a0)
-        FPREG64_S($f31, SC_FPREGS+((F31-F0)*REGSZ_FP), a0)
-#else
-        swc1    $f20, SC_FPREGS+((F20-F0)*REGSZ_FP)(a0)
-        swc1    $f21, SC_FPREGS+((F21-F0)*REGSZ_FP)(a0)
-        swc1    $f22, SC_FPREGS+((F22-F0)*REGSZ_FP)(a0)
-        swc1    $f23, SC_FPREGS+((F23-F0)*REGSZ_FP)(a0)
-        swc1    $f24, SC_FPREGS+((F24-F0)*REGSZ_FP)(a0)
-        swc1    $f25, SC_FPREGS+((F25-F0)*REGSZ_FP)(a0)
-        swc1    $f26, SC_FPREGS+((F26-F0)*REGSZ_FP)(a0)
-        swc1    $f27, SC_FPREGS+((F27-F0)*REGSZ_FP)(a0)
-        swc1    $f28, SC_FPREGS+((F28-F0)*REGSZ_FP)(a0)
-        swc1    $f29, SC_FPREGS+((F29-F0)*REGSZ_FP)(a0)
-        swc1    $f30, SC_FPREGS+((F30-F0)*REGSZ_FP)(a0)
-        swc1    $f31, SC_FPREGS+((F31-F0)*REGSZ_FP)(a0)
+	s.d	$f21, SC_FPREGS+((F21-F0)*REGSZ_FP)(a0)
+	s.d	$f23, SC_FPREGS+((F23-F0)*REGSZ_FP)(a0)
+	s.d	$f25, SC_FPREGS+((F25-F0)*REGSZ_FP)(a0)
+	s.d	$f27, SC_FPREGS+((F27-F0)*REGSZ_FP)(a0)
+	s.d	$f29, SC_FPREGS+((F29-F0)*REGSZ_FP)(a0)
+	s.d	$f31, SC_FPREGS+((F31-F0)*REGSZ_FP)(a0)
 #endif
 	REG_S	v0, SC_FPREGS+((FSR-F0)*REGSZ)(a0)
 #endif /* !SOFTFLOAT */
@@ -173,32 +149,19 @@
 #if !defined(SOFTFLOAT)
 	REG_L	v0, SC_FPREGS+((FSR-F0)*REGSZ)(a0)
 	ctc1	v0, $31
+	l.d	$f20, SC_FPREGS+((F20-F0)*REGSZ_FP)(a0)
+	l.d	$f22, SC_FPREGS+((F22-F0)*REGSZ_FP)(a0)
+	l.d	$f24, SC_FPREGS+((F24-F0)*REGSZ_FP)(a0)
+	l.d	$f26, SC_FPREGS+((F26-F0)*REGSZ_FP)(a0)
+	l.d	$f28, SC_FPREGS+((F28-F0)*REGSZ_FP)(a0)
+	l.d	$f30, SC_FPREGS+((F30-F0)*REGSZ_FP)(a0)
 #if _MIPS_FPSET == 32
-        FPREG64_L($f20, SC_FPREGS+((F20-F0)*REGSZ_FP), a0)
-        FPREG64_L($f21, SC_FPREGS+((F21-F0)*REGSZ_FP), a0)
-        FPREG64_L($f22, SC_FPREGS+((F22-F0)*REGSZ_FP), a0)
-        FPREG64_L($f23, SC_FPREGS+((F23-F0)*REGSZ_FP), a0)
-        FPREG64_L($f24, SC_FPREGS+((F24-F0)*REGSZ_FP), a0)
-        FPREG64_L($f25, SC_FPREGS+((F25-F0)*REGSZ_FP), a0)
-        FPREG64_L($f26, SC_FPREGS+((F26-F0)*REGSZ_FP), a0)
-        FPREG64_L($f27, SC_FPREGS+((F27-F0)*REGSZ_FP), a0)
-        FPREG64_L($f28, SC_FPREGS+((F28-F0)*REGSZ_FP), a0)
-        FPREG64_L($f29, SC_FPREGS+((F29-F0)*REGSZ_FP), a0)
-        FPREG64_L($f30, SC_FPREGS+((F30-F0)*REGSZ_FP), a0)
-        FPREG64_L($f31, SC_FPREGS+((F31-F0)*REGSZ_FP), a0)
-#else
-        lwc1    $f20, SC_FPREGS+((F20-F0)*REGSZ_FP)(a0)
-        lwc1    $f21, SC_FPREGS+((F21-F0)*REGSZ_FP)(a0)
-        lwc1    $f22, SC_FPREGS+((F22-F0)*REGSZ_FP)(a0)
-        lwc1    $f23, SC_FPREGS+((F23-F0)*REGSZ_FP)(a0)
-        lwc1    $f24, SC_FPREGS+((F24-F0)*REGSZ_FP)(a0)
-        lwc1    $f25, SC_FPREGS+((F25-F0)*REGSZ_FP)(a0)
-        lwc1    $f26, SC_FPREGS+((F26-F0)*REGSZ_FP)(a0)
-        lwc1    $f27, SC_FPREGS+((F27-F0)*REGSZ_FP)(a0)
-        lwc1    $f28, SC_FPREGS+((F28-F0)*REGSZ_FP)(a0)
-        lwc1    $f29, SC_FPREGS+((F29-F0)*REGSZ_FP)(a0)
-        lwc1    $f30, SC_FPREGS+((F30-F0)*REGSZ_FP)(a0)
-        lwc1    $f31, SC_FPREGS+((F31-F0)*REGSZ_FP)(a0)
+	l.d	$f21, SC_FPREGS+((F21-F0)*REGSZ_FP)(a0)
+	l.d	$f23, SC_FPREGS+((F23-F0)*REGSZ_FP)(a0)
+	l.d	$f25, SC_FPREGS+((F25-F0)*REGSZ_FP)(a0)
+	l.d	$f27, SC_FPREGS+((F27-F0)*REGSZ_FP)(a0)
+	l.d	$f29, SC_FPREGS+((F29-F0)*REGSZ_FP)(a0)
+	l.d	$f31, SC_FPREGS+((F31-F0)*REGSZ_FP)(a0)
 #endif
 #endif /* !SOFTFLOAT */
 	bne	a1, zero, 1f
diff --git a/libc/bionic/libc_logging.cpp b/libc/bionic/libc_logging.cpp
index d6fa1db..b57e242 100644
--- a/libc/bionic/libc_logging.cpp
+++ b/libc/bionic/libc_logging.cpp
@@ -230,6 +230,7 @@
 /* Perform formatted output to an output target 'o' */
 template <typename Out>
 static void out_vformat(Out& o, const char* format, va_list args) {
+    int caller_errno = errno;
     int nn = 0;
 
     for (;;) {
@@ -380,7 +381,7 @@
             buffer[1] = '\0';
         } else if (c == 'm') {
             // syslog-like %m for strerror(errno).
-            str = strerror(errno);
+            str = strerror(caller_errno);
         } else {
             __assert(__FILE__, __LINE__, "conversion specifier unsupported");
         }
diff --git a/libc/bionic/syslog.cpp b/libc/bionic/syslog.cpp
index 7e153eb..29f892a 100644
--- a/libc/bionic/syslog.cpp
+++ b/libc/bionic/syslog.cpp
@@ -14,9 +14,8 @@
  * limitations under the License.
  */
 
-#include <syslog.h>
-
 #include <stdlib.h>
+#include <syslog.h>
 
 #include "private/libc_logging.h"
 
@@ -24,6 +23,7 @@
 static int syslog_priority_mask = 0xff;
 
 void closelog() {
+  syslog_log_tag = NULL;
 }
 
 void openlog(const char* log_tag, int /*options*/, int /*facility*/) {
@@ -61,7 +61,7 @@
   // What's our Android log priority?
   priority &= LOG_PRIMASK;
   int android_log_priority;
-  if (priority < LOG_ERR) {
+  if (priority <= LOG_ERR) {
     android_log_priority = ANDROID_LOG_ERROR;
   } else if (priority == LOG_WARNING) {
     android_log_priority = ANDROID_LOG_WARN;
diff --git a/libc/include/syslog.h b/libc/include/syslog.h
index f396fec..cbceab2 100644
--- a/libc/include/syslog.h
+++ b/libc/include/syslog.h
@@ -35,45 +35,48 @@
 
 __BEGIN_DECLS
 
-#define LOG_EMERG	0
-#define LOG_ALERT	1
-#define LOG_CRIT	2
-#define LOG_ERR		3
-#define LOG_WARNING	4
-#define LOG_NOTICE	5
-#define LOG_INFO	6
-#define LOG_DEBUG	7
+/* Priorities are translated to Android log priorities as shown. */
+#define LOG_EMERG   0 /* ERROR */
+#define LOG_ALERT   1 /* ERROR */
+#define LOG_CRIT    2 /* ERROR */
+#define LOG_ERR     3 /* ERROR */
+#define LOG_WARNING 4 /* WARN */
+#define LOG_NOTICE  5 /* INFO */
+#define LOG_INFO    6 /* INFO */
+#define LOG_DEBUG   7 /* DEBUG */
 
-#define LOG_PRIMASK	7
-#define LOG_PRI(x)	((x) & LOG_PRIMASK)
+#define LOG_PRIMASK 7
+#define LOG_PRI(x) ((x) & LOG_PRIMASK)
 
-#define LOG_KERN	0000
-#define LOG_USER	0010
-#define LOG_MAIL	0020
-#define LOG_DAEMON	0030
-#define LOG_AUTH	0040
-#define LOG_SYSLOG	0050
-#define LOG_LPR		0060
-#define LOG_NEWS	0070
-#define LOG_UUCP	0100
-#define LOG_CRON	0110
-#define LOG_AUTHPRIV	0120
-#define LOG_FTP		0130
-#define LOG_LOCAL0	0200
-#define LOG_LOCAL1	0210
-#define LOG_LOCAL2	0220
-#define LOG_LOCAL3	0230
-#define LOG_LOCAL4	0240
-#define LOG_LOCAL5	0250
-#define LOG_LOCAL6	0260
-#define LOG_LOCAL7	0270
+/* Facilities are currently ignored on Android. */
+#define LOG_KERN     0000
+#define LOG_USER     0010
+#define LOG_MAIL     0020
+#define LOG_DAEMON   0030
+#define LOG_AUTH     0040
+#define LOG_SYSLOG   0050
+#define LOG_LPR      0060
+#define LOG_NEWS     0070
+#define LOG_UUCP     0100
+#define LOG_CRON     0110
+#define LOG_AUTHPRIV 0120
+#define LOG_FTP      0130
+#define LOG_LOCAL0   0200
+#define LOG_LOCAL1   0210
+#define LOG_LOCAL2   0220
+#define LOG_LOCAL3   0230
+#define LOG_LOCAL4   0240
+#define LOG_LOCAL5   0250
+#define LOG_LOCAL6   0260
+#define LOG_LOCAL7   0270
 
-#define LOG_FACMASK	01770
-#define LOG_FAC(x)	(((x) >> 3) & (LOG_FACMASK >> 3))
+#define LOG_FACMASK 01770
+#define LOG_FAC(x) (((x) >> 3) & (LOG_FACMASK >> 3))
 
 #define LOG_MASK(pri) (1 << (pri))
 #define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1)
 
+/* openlog(3) flags are currently ignored on Android. */
 #define LOG_PID    0x01
 #define LOG_CONS   0x02
 #define LOG_ODELAY 0x04
@@ -81,11 +84,11 @@
 #define LOG_NOWAIT 0x10
 #define LOG_PERROR 0x20
 
-extern void closelog(void);
-extern void openlog(const char*, int, int);
-extern int setlogmask(int);
-extern void syslog(int, const char*, ...) __printflike(2, 3);
-extern void vsyslog(int, const char*, va_list) __printflike(2, 0);
+void closelog(void);
+void openlog(const char*, int, int);
+int setlogmask(int);
+void syslog(int, const char*, ...) __printflike(2, 3);
+void vsyslog(int, const char*, va_list) __printflike(2, 0);
 
 __END_DECLS
 
diff --git a/linker/debugger.cpp b/linker/debugger.cpp
index 9ebb09b..079682c 100644
--- a/linker/debugger.cpp
+++ b/linker/debugger.cpp
@@ -206,6 +206,15 @@
 }
 
 static void send_debuggerd_packet(siginfo_t* info) {
+  if (prctl(PR_GET_DUMPABLE, 0, 0, 0, 0) == 0) {
+    // process has disabled core dumps and PTRACE_ATTACH, and does not want to be dumped.
+    // Honor that intention by not connecting to debuggerd and asking it
+    // to dump our internal state.
+    __libc_format_log(ANDROID_LOG_INFO, "libc",
+                      "Suppressing debuggerd output because prctl(PR_GET_DUMPABLE)==0");
+    return;
+  }
+
   int s = socket_abstract_client(DEBUGGER_SOCKET_NAME, SOCK_STREAM);
   if (s == -1) {
     __libc_format_log(ANDROID_LOG_FATAL, "libc", "Unable to open connection to debuggerd: %s",
diff --git a/tests/fortify_test.cpp b/tests/fortify_test.cpp
index 873c71e..352cac6 100644
--- a/tests/fortify_test.cpp
+++ b/tests/fortify_test.cpp
@@ -23,6 +23,7 @@
 #include <sys/socket.h>
 #include <malloc.h>
 #include <fcntl.h>
+#include <sys/prctl.h>
 
 // We have to say "DeathTest" here so gtest knows to run this test (which exits)
 // in its own process. Unfortunately, the C preprocessor doesn't give us an
@@ -32,6 +33,21 @@
 #define DEATHTEST_EVALUATOR(name) DEATHTEST_PASTER(name)
 #define DEATHTEST DEATHTEST_EVALUATOR(TEST_NAME)
 
+class DEATHTEST : public testing::Test {
+ protected:
+  virtual void SetUp() {
+    old_dumpable_ = prctl(PR_GET_DUMPABLE, 0, 0, 0, 0);
+    // Suppress debuggerd stack traces. Too slow.
+    prctl(PR_SET_DUMPABLE, 0, 0, 0, 0);
+  }
+
+  virtual void TearDown() {
+    prctl(PR_SET_DUMPABLE, old_dumpable_, 0, 0, 0, 0);
+  }
+ private:
+  int old_dumpable_;
+};
+
 #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE == 2
 struct foo {
   char empty[0];
@@ -43,7 +59,7 @@
 #ifndef __clang__
 // This test is disabled in clang because clang doesn't properly detect
 // this buffer overflow. TODO: Fix clang.
-TEST(DEATHTEST, stpncpy_fortified2) {
+TEST_F(DEATHTEST, stpncpy_fortified2) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   foo myfoo;
   int copy_amt = atoi("11");
@@ -55,7 +71,7 @@
 #ifndef __clang__
 // This test is disabled in clang because clang doesn't properly detect
 // this buffer overflow. TODO: Fix clang.
-TEST(DEATHTEST, stpncpy2_fortified2) {
+TEST_F(DEATHTEST, stpncpy2_fortified2) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   foo myfoo;
   memset(&myfoo, 0, sizeof(myfoo));
@@ -68,7 +84,7 @@
 #ifndef __clang__
 // This test is disabled in clang because clang doesn't properly detect
 // this buffer overflow. TODO: Fix clang.
-TEST(DEATHTEST, strncpy_fortified2) {
+TEST_F(DEATHTEST, strncpy_fortified2) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   foo myfoo;
   int copy_amt = atoi("11");
@@ -80,7 +96,7 @@
 #ifndef __clang__
 // This test is disabled in clang because clang doesn't properly detect
 // this buffer overflow. TODO: Fix clang.
-TEST(DEATHTEST, strncpy2_fortified2) {
+TEST_F(DEATHTEST, strncpy2_fortified2) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   foo myfoo;
   memset(&myfoo, 0, sizeof(myfoo));
@@ -93,7 +109,7 @@
 #ifndef __clang__
 // This test is disabled in clang because clang doesn't properly detect
 // this buffer overflow. TODO: Fix clang.
-TEST(DEATHTEST, sprintf_fortified2) {
+TEST_F(DEATHTEST, sprintf_fortified2) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   foo myfoo;
   char source_buf[15];
@@ -106,7 +122,7 @@
 #ifndef __clang__
 // This test is disabled in clang because clang doesn't properly detect
 // this buffer overflow. TODO: Fix clang.
-TEST(DEATHTEST, sprintf2_fortified2) {
+TEST_F(DEATHTEST, sprintf2_fortified2) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   foo myfoo;
   ASSERT_EXIT(sprintf(myfoo.a, "0123456789"),
@@ -128,12 +144,12 @@
   return result;
 }
 
-TEST(DEATHTEST, vsprintf_fortified2) {
+TEST_F(DEATHTEST, vsprintf_fortified2) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   ASSERT_EXIT(vsprintf_helper2("%s", "0123456789"), testing::KilledBySignal(SIGABRT), "");
 }
 
-TEST(DEATHTEST, vsprintf2_fortified2) {
+TEST_F(DEATHTEST, vsprintf2_fortified2) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   ASSERT_EXIT(vsprintf_helper2("0123456789"), testing::KilledBySignal(SIGABRT), "");
 }
@@ -154,12 +170,12 @@
   return result;
 }
 
-TEST(DEATHTEST, vsnprintf_fortified2) {
+TEST_F(DEATHTEST, vsnprintf_fortified2) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   ASSERT_EXIT(vsnprintf_helper2("%s", "0123456789"), testing::KilledBySignal(SIGABRT), "");
 }
 
-TEST(DEATHTEST, vsnprintf2_fortified2) {
+TEST_F(DEATHTEST, vsnprintf2_fortified2) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   ASSERT_EXIT(vsnprintf_helper2("0123456789"), testing::KilledBySignal(SIGABRT), "");
 }
@@ -169,7 +185,7 @@
 // zero sized target with "\0" source (should fail)
 // This test is disabled in clang because clang doesn't properly detect
 // this buffer overflow. TODO: Fix clang.
-TEST(DEATHTEST, stpcpy_fortified2) {
+TEST_F(DEATHTEST, stpcpy_fortified2) {
 #if defined(__BIONIC__)
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   foo myfoo;
@@ -187,7 +203,7 @@
 // zero sized target with "\0" source (should fail)
 // This test is disabled in clang because clang doesn't properly detect
 // this buffer overflow. TODO: Fix clang.
-TEST(DEATHTEST, strcpy_fortified2) {
+TEST_F(DEATHTEST, strcpy_fortified2) {
 #if defined(__BIONIC__)
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   foo myfoo;
@@ -205,7 +221,7 @@
 // zero sized target with longer source (should fail)
 // This test is disabled in clang because clang doesn't properly detect
 // this buffer overflow. TODO: Fix clang.
-TEST(DEATHTEST, strcpy2_fortified2) {
+TEST_F(DEATHTEST, strcpy2_fortified2) {
 #if defined(__BIONIC__)
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   foo myfoo;
@@ -223,7 +239,7 @@
 // one byte target with longer source (should fail)
 // This test is disabled in clang because clang doesn't properly detect
 // this buffer overflow. TODO: Fix clang.
-TEST(DEATHTEST, strcpy3_fortified2) {
+TEST_F(DEATHTEST, strcpy3_fortified2) {
 #if defined(__BIONIC__)
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   foo myfoo;
@@ -240,7 +256,7 @@
 #ifndef __clang__
 // This test is disabled in clang because clang doesn't properly detect
 // this buffer overflow. TODO: Fix clang.
-TEST(DEATHTEST, strchr_fortified2) {
+TEST_F(DEATHTEST, strchr_fortified2) {
 #if defined(__BIONIC__)
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   foo myfoo;
@@ -257,7 +273,7 @@
 #ifndef __clang__
 // This test is disabled in clang because clang doesn't properly detect
 // this buffer overflow. TODO: Fix clang.
-TEST(DEATHTEST, strrchr_fortified2) {
+TEST_F(DEATHTEST, strrchr_fortified2) {
 #if defined(__BIONIC__)
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   foo myfoo;
@@ -274,7 +290,7 @@
 #ifndef __clang__
 // This test is disabled in clang because clang doesn't properly detect
 // this buffer overflow. TODO: Fix clang.
-TEST(DEATHTEST, strlcpy_fortified2) {
+TEST_F(DEATHTEST, strlcpy_fortified2) {
 #if defined(__BIONIC__)
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   foo myfoo;
@@ -291,7 +307,7 @@
 #ifndef __clang__
 // This test is disabled in clang because clang doesn't properly detect
 // this buffer overflow. TODO: Fix clang.
-TEST(DEATHTEST, strlcat_fortified2) {
+TEST_F(DEATHTEST, strlcat_fortified2) {
 #if defined(__BIONIC__)
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   foo myfoo;
@@ -309,7 +325,7 @@
 #ifndef __clang__
 // This test is disabled in clang because clang doesn't properly detect
 // this buffer overflow. TODO: Fix clang.
-TEST(DEATHTEST, strncat_fortified2) {
+TEST_F(DEATHTEST, strncat_fortified2) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   foo myfoo;
   size_t n = atoi("10"); // avoid compiler optimizations
@@ -321,7 +337,7 @@
 #ifndef __clang__
 // This test is disabled in clang because clang doesn't properly detect
 // this buffer overflow. TODO: Fix clang.
-TEST(DEATHTEST, strncat2_fortified2) {
+TEST_F(DEATHTEST, strncat2_fortified2) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   foo myfoo;
   myfoo.a[0] = '\0';
@@ -330,7 +346,7 @@
 }
 #endif
 
-TEST(DEATHTEST, strncat3_fortified2) {
+TEST_F(DEATHTEST, strncat3_fortified2) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   foo myfoo;
   memcpy(myfoo.a, "0123456789", sizeof(myfoo.a)); // unterminated string
@@ -342,7 +358,7 @@
 #ifndef __clang__
 // This test is disabled in clang because clang doesn't properly detect
 // this buffer overflow. TODO: Fix clang.
-TEST(DEATHTEST, strcat_fortified2) {
+TEST_F(DEATHTEST, strcat_fortified2) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char src[11];
   strcpy(src, "0123456789");
@@ -352,7 +368,7 @@
 }
 #endif
 
-TEST(DEATHTEST, strcat2_fortified2) {
+TEST_F(DEATHTEST, strcat2_fortified2) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   foo myfoo;
   memcpy(myfoo.a, "0123456789", sizeof(myfoo.a)); // unterminated string
@@ -360,7 +376,7 @@
   ASSERT_EXIT(strcat(myfoo.b, myfoo.a), testing::KilledBySignal(SIGABRT), "");
 }
 
-TEST(DEATHTEST, snprintf_fortified2) {
+TEST_F(DEATHTEST, snprintf_fortified2) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   foo myfoo;
   strcpy(myfoo.a, "012345678");
@@ -368,7 +384,7 @@
   ASSERT_EXIT(snprintf(myfoo.b, n, "a%s", myfoo.a), testing::KilledBySignal(SIGABRT), "");
 }
 
-TEST(DEATHTEST, bzero_fortified2) {
+TEST_F(DEATHTEST, bzero_fortified2) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   foo myfoo;
   memcpy(myfoo.b, "0123456789", sizeof(myfoo.b));
@@ -379,7 +395,7 @@
 #endif /* defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE=2 */
 
 // multibyte target where we over fill (should fail)
-TEST(DEATHTEST, strcpy_fortified) {
+TEST_F(DEATHTEST, strcpy_fortified) {
 #if defined(__BIONIC__)
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char buf[10];
@@ -392,7 +408,7 @@
 }
 
 // zero sized target with "\0" source (should fail)
-TEST(DEATHTEST, strcpy2_fortified) {
+TEST_F(DEATHTEST, strcpy2_fortified) {
 #if defined(__BIONIC__)
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char buf[0];
@@ -405,7 +421,7 @@
 }
 
 // zero sized target with longer source (should fail)
-TEST(DEATHTEST, strcpy3_fortified) {
+TEST_F(DEATHTEST, strcpy3_fortified) {
 #if defined(__BIONIC__)
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char buf[0];
@@ -418,7 +434,7 @@
 }
 
 // one byte target with longer source (should fail)
-TEST(DEATHTEST, strcpy4_fortified) {
+TEST_F(DEATHTEST, strcpy4_fortified) {
 #if defined(__BIONIC__)
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char buf[1];
@@ -430,7 +446,7 @@
 #endif // __BIONIC__
 }
 
-TEST(DEATHTEST, strlen_fortified) {
+TEST_F(DEATHTEST, strlen_fortified) {
 #if defined(__BIONIC__)
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char buf[10];
@@ -441,7 +457,7 @@
 #endif // __BIONIC__
 }
 
-TEST(DEATHTEST, strchr_fortified) {
+TEST_F(DEATHTEST, strchr_fortified) {
 #if defined(__BIONIC__)
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char buf[10];
@@ -452,7 +468,7 @@
 #endif // __BIONIC__
 }
 
-TEST(DEATHTEST, strrchr_fortified) {
+TEST_F(DEATHTEST, strrchr_fortified) {
 #if defined(__BIONIC__)
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char buf[10];
@@ -463,7 +479,7 @@
 #endif // __BIONIC__
 }
 
-TEST(DEATHTEST, strlcpy_fortified) {
+TEST_F(DEATHTEST, strlcpy_fortified) {
 #if defined(__BIONIC__)
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char bufa[15];
@@ -476,7 +492,7 @@
 #endif // __BIONIC__
 }
 
-TEST(DEATHTEST, strlcat_fortified) {
+TEST_F(DEATHTEST, strlcat_fortified) {
 #if defined(__BIONIC__)
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char bufa[15];
@@ -490,7 +506,7 @@
 #endif // __BIONIC__
 }
 
-TEST(DEATHTEST, sprintf_fortified) {
+TEST_F(DEATHTEST, sprintf_fortified) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char buf[10];
   char source_buf[15];
@@ -501,7 +517,7 @@
 #ifndef __clang__
 // This test is disabled in clang because clang doesn't properly detect
 // this buffer overflow. TODO: Fix clang.
-TEST(DEATHTEST, sprintf_malloc_fortified) {
+TEST_F(DEATHTEST, sprintf_malloc_fortified) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char* buf = (char *) malloc(10);
   char source_buf[11];
@@ -511,7 +527,7 @@
 }
 #endif
 
-TEST(DEATHTEST, sprintf2_fortified) {
+TEST_F(DEATHTEST, sprintf2_fortified) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char buf[5];
   ASSERT_EXIT(sprintf(buf, "aaaaa"), testing::KilledBySignal(SIGABRT), "");
@@ -528,12 +544,12 @@
   return result;
 }
 
-TEST(DEATHTEST, vsprintf_fortified) {
+TEST_F(DEATHTEST, vsprintf_fortified) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   ASSERT_EXIT(vsprintf_helper("%s", "0123456789"), testing::KilledBySignal(SIGABRT), "");
 }
 
-TEST(DEATHTEST, vsprintf2_fortified) {
+TEST_F(DEATHTEST, vsprintf2_fortified) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   ASSERT_EXIT(vsprintf_helper("0123456789"), testing::KilledBySignal(SIGABRT), "");
 }
@@ -550,17 +566,17 @@
   return result;
 }
 
-TEST(DEATHTEST, vsnprintf_fortified) {
+TEST_F(DEATHTEST, vsnprintf_fortified) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   ASSERT_EXIT(vsnprintf_helper("%s", "0123456789"), testing::KilledBySignal(SIGABRT), "");
 }
 
-TEST(DEATHTEST, vsnprintf2_fortified) {
+TEST_F(DEATHTEST, vsnprintf2_fortified) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   ASSERT_EXIT(vsnprintf_helper("0123456789"), testing::KilledBySignal(SIGABRT), "");
 }
 
-TEST(DEATHTEST, strncat_fortified) {
+TEST_F(DEATHTEST, strncat_fortified) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char buf[10];
   size_t n = atoi("10"); // avoid compiler optimizations
@@ -568,7 +584,7 @@
   ASSERT_EXIT(strncat(buf, "9", n), testing::KilledBySignal(SIGABRT), "");
 }
 
-TEST(DEATHTEST, strncat2_fortified) {
+TEST_F(DEATHTEST, strncat2_fortified) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char buf[10];
   buf[0] = '\0';
@@ -576,7 +592,7 @@
   ASSERT_EXIT(strncat(buf, "0123456789", n), testing::KilledBySignal(SIGABRT), "");
 }
 
-TEST(DEATHTEST, strcat_fortified) {
+TEST_F(DEATHTEST, strcat_fortified) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char src[11];
   strcpy(src, "0123456789");
@@ -585,7 +601,7 @@
   ASSERT_EXIT(strcat(buf, src), testing::KilledBySignal(SIGABRT), "");
 }
 
-TEST(DEATHTEST, memmove_fortified) {
+TEST_F(DEATHTEST, memmove_fortified) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char buf[20];
   strcpy(buf, "0123456789");
@@ -593,7 +609,7 @@
   ASSERT_EXIT(memmove(buf + 11, buf, n), testing::KilledBySignal(SIGABRT), "");
 }
 
-TEST(DEATHTEST, memcpy_fortified) {
+TEST_F(DEATHTEST, memcpy_fortified) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char bufa[10];
   char bufb[10];
@@ -602,7 +618,7 @@
   ASSERT_EXIT(memcpy(bufb, bufa, n), testing::KilledBySignal(SIGABRT), "");
 }
 
-TEST(DEATHTEST, stpncpy_fortified) {
+TEST_F(DEATHTEST, stpncpy_fortified) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char bufa[15];
   char bufb[10];
@@ -611,7 +627,7 @@
   ASSERT_EXIT(stpncpy(bufb, bufa, n), testing::KilledBySignal(SIGABRT), "");
 }
 
-TEST(DEATHTEST, stpncpy2_fortified) {
+TEST_F(DEATHTEST, stpncpy2_fortified) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char dest[11];
   char src[10];
@@ -619,7 +635,7 @@
   ASSERT_EXIT(stpncpy(dest, src, sizeof(dest)), testing::KilledBySignal(SIGABRT), "");
 }
 
-TEST(DEATHTEST, strncpy_fortified) {
+TEST_F(DEATHTEST, strncpy_fortified) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char bufa[15];
   char bufb[10];
@@ -629,7 +645,7 @@
 }
 
 
-TEST(DEATHTEST, strncpy2_fortified) {
+TEST_F(DEATHTEST, strncpy2_fortified) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char dest[11];
   char src[10];
@@ -637,7 +653,7 @@
   ASSERT_EXIT(strncpy(dest, src, sizeof(dest)), testing::KilledBySignal(SIGABRT), "");
 }
 
-TEST(DEATHTEST, snprintf_fortified) {
+TEST_F(DEATHTEST, snprintf_fortified) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char bufa[15];
   char bufb[10];
@@ -646,7 +662,7 @@
   ASSERT_EXIT(snprintf(bufb, n, "%s", bufa), testing::KilledBySignal(SIGABRT), "");
 }
 
-TEST(DEATHTEST, bzero_fortified) {
+TEST_F(DEATHTEST, bzero_fortified) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char buf[10];
   memcpy(buf, "0123456789", sizeof(buf));
@@ -654,20 +670,20 @@
   ASSERT_EXIT(bzero(buf, n), testing::KilledBySignal(SIGABRT), "");
 }
 
-TEST(DEATHTEST, umask_fortified) {
+TEST_F(DEATHTEST, umask_fortified) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   mode_t mask = atoi("1023");  // 01777 in octal
   ASSERT_EXIT(umask(mask), testing::KilledBySignal(SIGABRT), "");
 }
 
-TEST(DEATHTEST, recv_fortified) {
+TEST_F(DEATHTEST, recv_fortified) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   size_t data_len = atoi("11"); // suppress compiler optimizations
   char buf[10];
   ASSERT_EXIT(recv(0, buf, data_len, 0), testing::KilledBySignal(SIGABRT), "");
 }
 
-TEST(DEATHTEST, FD_ISSET_fortified) {
+TEST_F(DEATHTEST, FD_ISSET_fortified) {
 #if defined(__BIONIC__) // glibc catches this at compile-time.
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   fd_set set;
@@ -676,7 +692,7 @@
 #endif
 }
 
-TEST(DEATHTEST, FD_ISSET_2_fortified) {
+TEST_F(DEATHTEST, FD_ISSET_2_fortified) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char buf[1];
   fd_set* set = (fd_set*) buf;
@@ -686,14 +702,14 @@
 // gtest's ASSERT_EXIT needs a valid expression, but glibc has a do-while macro.
 static void FD_ZERO_function(fd_set* s) { FD_ZERO(s); }
 
-TEST(DEATHTEST, FD_ZERO_fortified) {
+TEST_F(DEATHTEST, FD_ZERO_fortified) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char buf[1];
   fd_set* set = (fd_set*) buf;
   ASSERT_EXIT(FD_ZERO_function(set), testing::KilledBySignal(SIGABRT), "");
 }
 
-TEST(DEATHTEST, read_fortified) {
+TEST_F(DEATHTEST, read_fortified) {
   ::testing::FLAGS_gtest_death_test_style = "threadsafe";
   char buf[1];
   size_t ct = atoi("2"); // prevent optimizations