Merge "Reland^2 "Also build the compile-time tests with _FORTIFY_SOURCE=3."" into main
diff --git a/docs/defines.md b/docs/defines.md
index 65cc873..be48ad8 100644
--- a/docs/defines.md
+++ b/docs/defines.md
@@ -21,6 +21,15 @@
Genuine cases are quite rare, and `__BIONIC__` is often more specific (but
remember that it is possible -- if unusual -- to use bionic on the host).
+## `ANDROID` (rarely useful)
+
+Not to be confused with `__ANDROID__`, the similar-looking but very different
+`ANDROID` is _not_ set by the toolchain or NDK build system. This is set by
+the AOSP build system for both device and host code. For that reason, it's
+not typically very useful except as a signal when patching third-party code ---
+but even then, you'd typically _not_ want this because it's true for both
+device and host.
+
## `__ANDROID_API__`
If your code can be built targeting a variety of different OS versions, use
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index 9bd35bb..a74a514 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -238,7 +238,7 @@
// As we move some FORTIFY checks to be always on, __bos needs to be
// always available.
#if defined(__BIONIC_FORTIFY)
-# if _FORTIFY_SOURCE == 2
+# if _FORTIFY_SOURCE > 1
# define __bos_level 1
# else
# define __bos_level 0
diff --git a/tests/fortify_test.cpp b/tests/fortify_test.cpp
index ee71f03..fd1680b 100644
--- a/tests/fortify_test.cpp
+++ b/tests/fortify_test.cpp
@@ -43,7 +43,7 @@
using DEATHTEST = SilentDeathTest;
-#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE == 2
+#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE >= 2
struct foo {
char empty[0];
char one[1];
diff --git a/tests/utils.h b/tests/utils.h
index 3b4f2a9..281e4fe 100644
--- a/tests/utils.h
+++ b/tests/utils.h
@@ -289,16 +289,6 @@
size_t start_count_ = CountOpenFds();
};
-static inline bool running_with_mte() {
-#ifdef __aarch64__
- int level = prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0);
- return level >= 0 && (level & PR_TAGGED_ADDR_ENABLE) &&
- (level & PR_MTE_TCF_MASK) != PR_MTE_TCF_NONE;
-#else
- return false;
-#endif
-}
-
bool IsLowRamDevice();
int64_t NanoTime();