Merge "fdsan: add documentation."
diff --git a/libc/arch-arm64/bionic/setjmp.S b/libc/arch-arm64/bionic/setjmp.S
index ee618b1..5e62c28 100644
--- a/libc/arch-arm64/bionic/setjmp.S
+++ b/libc/arch-arm64/bionic/setjmp.S
@@ -191,6 +191,28 @@
bne __bionic_setjmp_checksum_mismatch
#endif
+#if __has_feature(hwaddress_sanitizer)
+ stp x0, x30, [sp, #-16]!
+ .cfi_adjust_cfa_offset 16
+ .cfi_rel_offset x0, 0
+ .cfi_rel_offset x30, 8
+ mov x19, x1 // Save 'value'.
+
+ // load and unmangle destination SP
+ ldr x2, [x0, #(_JB_SIGFLAG * 8)]
+ bic x2, x2, #1
+ ldr x0, [x0, #(_JB_X30_SP * 8 + 8)]
+ eor x0, x0, x2
+ bl __hwasan_handle_longjmp
+
+ mov x1, x19 // Restore 'value'.
+ // Restore original x0 and lr.
+ ldp x0, x30, [sp], #16
+ .cfi_adjust_cfa_offset -16
+ .cfi_restore x0
+ .cfi_restore x30
+#endif
+
// Do we need to restore the signal mask?
ldr x2, [x0, #(_JB_SIGFLAG * 8)]
tbz w2, #0, 1f
diff --git a/libm/Android.bp b/libm/Android.bp
index c0862c8..3b88fa3 100644
--- a/libm/Android.bp
+++ b/libm/Android.bp
@@ -315,8 +315,6 @@
"upstream-freebsd/lib/msun/src/s_llrintf.c",
"upstream-freebsd/lib/msun/src/s_lrint.c",
"upstream-freebsd/lib/msun/src/s_lrintf.c",
- "upstream-freebsd/lib/msun/src/s_nearbyintf.c",
- "upstream-freebsd/lib/msun/src/s_nearbyint.c",
"upstream-freebsd/lib/msun/src/s_rint.c",
"upstream-freebsd/lib/msun/src/s_rintf.c",
"upstream-freebsd/lib/msun/src/s_round.c",
diff --git a/libm/builtins.cpp b/libm/builtins.cpp
index 515b68a..2ea6305 100644
--- a/libm/builtins.cpp
+++ b/libm/builtins.cpp
@@ -57,12 +57,4 @@
float roundf(float x) { return __builtin_roundf(x); }
double round(double x) { return __builtin_round(x); }
-
-float nearbyintf(float x) { return __builtin_nearbyintf(x); }
-double nearbyint(double x) { return __builtin_nearbyint(x); }
-// msun s_nearbyint.c defines all floating-point version, so we need to
-// redefine the long double one here. For aarch64, clang/compiler-rt
-// soft-float routines does not use single/double floating-point operation,
-// so it should be safe to call rintl directly.
-long double nearbyintl(long double x) { return rintl(x); }
#endif