Merge changes from topic "clang-r365631-switch-over"

* changes:
  Fix segment gap test
  stdatomic_test: always use bits/stdatomic.h
  Adapt tests due to the new Clang fortify-source warning
diff --git a/tests/Android.bp b/tests/Android.bp
index 42d280b..4477b52 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -286,6 +286,7 @@
         "-Wno-builtin-memcpy-chk-size",
         "-Wno-format-security",
         "-Wno-format-zero-length",
+        "-Wno-fortify-source",
         "-Wno-memset-transposed-args",
         "-Wno-strlcpy-strlcat-size",
         "-Wno-strncat-size",
diff --git a/tests/clang_fortify_tests.cpp b/tests/clang_fortify_tests.cpp
index 1b6b898..6923302 100644
--- a/tests/clang_fortify_tests.cpp
+++ b/tests/clang_fortify_tests.cpp
@@ -36,6 +36,11 @@
 // Similarly, there are a few overload tricks we have to emit errors. Ignore any notes from those.
 // expected-note@* 0+{{candidate function}}
 
+// FIXME(b/138701943): Silence warnings produced by -Wfortify-source since they're expected.
+// expected-warning@* 0+{{will always overflow}}
+// expected-warning@* 0+{{size argument is too large}}
+// expected-note@* 0+{{has been explicitly marked unavailable here}}
+
 #ifndef _FORTIFY_SOURCE
 #error "_FORTIFY_SOURCE must be defined"
 #endif
diff --git a/tests/libs/segment_gap_outer.lds b/tests/libs/segment_gap_outer.lds
index c2961b2..0f175af 100644
--- a/tests/libs/segment_gap_outer.lds
+++ b/tests/libs/segment_gap_outer.lds
@@ -1,15 +1,14 @@
 SECTIONS {
-  # This starts off fairly normal: rodata, text, data, relro, bss with
+  # This starts off fairly normal: rodata, text, dynamic, data, bss with
   # appropriate alignment between them.
   . = SIZEOF_HEADERS;
   .rodata : {}
   . = ALIGN(0x1000);
   .text : {}
   . = ALIGN(0x1000);
+  .dynamic : {}
+  . = ALIGN(0x1000);
   .data : {}
-  . = ALIGN(0x1000);
-  .data.rel.ro : {}
-  . = ALIGN(0x1000);
   .bss : {}
 
   # Now create the gap. We need a text segment first to prevent the linker from
diff --git a/tests/stdatomic_test.cpp b/tests/stdatomic_test.cpp
index a9665d1..9911d64 100644
--- a/tests/stdatomic_test.cpp
+++ b/tests/stdatomic_test.cpp
@@ -16,12 +16,9 @@
 
 #include <gtest/gtest.h>
 
-#if defined(__ANDROID__)
+// The real <stdatomic.h> checks for the availability of C++'s atomics and uses them if present. Since
+// we want to test the libc versions, we instead include <bits/stdatomic.h> where they're actually defined.
 #include <bits/stdatomic.h>
-#else
-#undef _USING_LIBCXX  //TODO(b/137876753): Remove this
-#include <stdatomic.h>
-#endif
 
 #include <pthread.h>
 #include <stdint.h>