Merge "Fix memory leak in test util"
diff --git a/libc/Android.bp b/libc/Android.bp
index ad31192..f61cc46 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -1989,4 +1989,125 @@
     defaults: ["crt_defaults"],
 }
 
+// The following module lives in prebuilts/ndk because we need to preprocess the
+// headers to include ifdef guards for __ANDROID_API__. Update with
+// bionic/tools/update_headers.sh.
+// ndk_headers {
+//     name: "common_libc",
+//     from: "include",
+//     to: "",
+//     srcs: ["include/**/*.h"],
+// }
+
+ndk_headers {
+    name: "libc_linux",
+    from: "kernel/uapi/linux",
+    to: "linux",
+    srcs: ["kernel/uapi/linux/**/*.h"],
+}
+
+ndk_headers {
+    name: "libc_android",
+    from: "kernel/android/uapi/linux",
+    to: "linux",
+    srcs: ["kernel/android/uapi/linux/**/*.h"],
+}
+
+ndk_headers {
+    name: "libc_asm_generic",
+    from: "kernel/uapi/asm-generic",
+    to: "asm-generic",
+    srcs: ["kernel/uapi/asm-generic/**/*.h"],
+}
+
+ndk_headers {
+    name: "libc_asm_arm",
+    from: "kernel/uapi/asm-arm",
+    to: "arm-linux-androideabi",
+    srcs: ["kernel/uapi/asm-arm/**/*.h"],
+}
+
+ndk_headers {
+    name: "libc_asm_arm64",
+    from: "kernel/uapi/asm-arm64",
+    to: "aarch64-linux-android",
+    srcs: ["kernel/uapi/asm-arm64/**/*.h"],
+}
+
+ndk_headers {
+    name: "libc_asm_mips",
+    from: "kernel/uapi/asm-mips",
+    to: "mipsel-linux-android",
+    srcs: ["kernel/uapi/asm-mips/**/*.h"],
+}
+
+ndk_headers {
+    name: "libc_asm_mips64",
+    from: "kernel/uapi/asm-mips",
+    to: "mips64el-linux-android",
+    srcs: ["kernel/uapi/asm-mips/**/*.h"],
+}
+
+ndk_headers {
+    name: "libc_asm_x86",
+    from: "kernel/uapi/asm-x86",
+    to: "i686-linux-android",
+    srcs: ["kernel/uapi/asm-x86/**/*.h"],
+}
+
+ndk_headers {
+    name: "libc_asm_x86_64",
+    from: "kernel/uapi/asm-x86",
+    to: "x86_64-linux-android",
+    srcs: ["kernel/uapi/asm-x86/**/*.h"],
+}
+
+ndk_headers {
+    name: "libc_machine_arm",
+    from: "arch-arm/include",
+    to: "arm-linux-androideabi",
+    srcs: ["arch-arm/include/**/*.h"],
+}
+
+ndk_headers {
+    name: "libc_machine_arm64",
+    from: "arch-arm64/include",
+    to: "aarch64-linux-android",
+    srcs: ["arch-arm64/include/**/*.h"],
+}
+
+ndk_headers {
+    name: "libc_machine_mips",
+    from: "arch-mips/include",
+    to: "mipsel-linux-android",
+    srcs: ["arch-mips/include/**/*.h"],
+}
+
+ndk_headers {
+    name: "libc_machine_mips64",
+    from: "arch-mips/include",
+    to: "mips64el-linux-android",
+    srcs: ["arch-mips/include/**/*.h"],
+}
+
+ndk_headers {
+    name: "libc_machine_x86",
+    from: "arch-x86/include",
+    to: "i686-linux-android",
+    srcs: ["arch-x86/include/**/*.h"],
+}
+
+ndk_headers {
+    name: "libc_machine_x86_64",
+    from: "arch-x86_64/include",
+    to: "x86_64-linux-android",
+    srcs: ["arch-x86_64/include/**/*.h"],
+}
+
+ndk_library {
+    name: "libc.ndk",
+    symbol_file: "libc.map.txt",
+    first_version: "9",
+}
+
 subdirs = ["malloc_debug"]
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index ab8108a..4e7d8ba 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -209,7 +209,7 @@
 #if __ANDROID_API__ >= 21
 int getpagesize(void) __INTRODUCED_IN(21);
 #else
-__inline__ int getpagesize(void) {
+static __inline__ int getpagesize(void) {
   return sysconf(_SC_PAGESIZE);
 }
 #endif
diff --git a/libm/Android.bp b/libm/Android.bp
index 23b9d5e..64d281f 100644
--- a/libm/Android.bp
+++ b/libm/Android.bp
@@ -531,3 +531,9 @@
     },
     stl: "none",
 }
+
+ndk_library {
+    name: "libm.ndk",
+    symbol_file: "libm.map.txt",
+    first_version: "9",
+}
diff --git a/tools/versioner/src/versioner.cpp b/tools/versioner/src/versioner.cpp
index 432fd66..daf6f0b 100644
--- a/tools/versioner/src/versioner.cpp
+++ b/tools/versioner/src/versioner.cpp
@@ -77,6 +77,12 @@
     command.push_back("-D__ANDROID_API__="s + std::to_string(type.api_level));
     command.push_back("-D_FORTIFY_SOURCE=2");
     command.push_back("-D_GNU_SOURCE");
+    command.push_back("-Wall");
+    command.push_back("-Wextra");
+    command.push_back("-Werror");
+    command.push_back("-Wno-unused-macros");
+    command.push_back("-Wno-unused-function");
+    command.push_back("-Wno-unused-variable");
     command.push_back("-Wno-unknown-attributes");
     command.push_back("-Wno-pragma-once-outside-header");
     command.push_back("-target");