Merge "gensyscalls.py: remove unused "decl"." into main
diff --git a/docs/32-bit-abi.md b/docs/32-bit-abi.md
index 7a96e2f..efc6815 100644
--- a/docs/32-bit-abi.md
+++ b/docs/32-bit-abi.md
@@ -66,8 +66,8 @@
## `sigset_t` is too small for real-time signals
On 32-bit Android, `sigset_t` is too small for ARM and x86. This means that
-there is no support for real-time signals in 32-bit code. Android P (API
-level 28) adds `sigset64_t` and a corresponding function for every function
+there is no support for real-time signals in 32-bit code.
+API level 28 adds `sigset64_t` and a corresponding function for every function
that takes a `sigset_t` (so `sigprocmask64` takes a `sigset64_t` where
`sigprocmask` takes a `sigset_t`).
diff --git a/docs/elf-tls.md b/docs/elf-tls.md
index 450f362..2e0b998 100644
--- a/docs/elf-tls.md
+++ b/docs/elf-tls.md
@@ -478,7 +478,7 @@
this.)
* On arm64, the primary TLS relocation (R_AARCH64_TLSDESC) is [confused with an obsolete
R_AARCH64_TLS_DTPREL32 relocation][R_AARCH64_TLS_DTPREL32] and is [quietly ignored].
- * Android P [added compatibility checks] for TLS symbols and `DT_TLSDESC_{GOT|PLT}` entries.
+ * API level 28 [added compatibility checks] for TLS symbols and `DT_TLSDESC_{GOT|PLT}` entries.
XXX: A dynamic executable using ELF TLS would have a PT_TLS segment and no other distinguishing
marks, so running it on an older platform would result in memory corruption. Should we add something
@@ -572,7 +572,7 @@
## Bionic Memory Layout Conflicts with Common TLS Layout
Bionic already allocates thread-specific data in a way that conflicts with TLS variants 1 and 2:
-
+
TLS variant 1 allocates everything after the TP to ELF TLS (except the first two words), and variant
2 allocates everything before the TP. Bionic currently allocates memory before and after the TP to
@@ -608,8 +608,8 @@
searching for its TP-relative offset, which it assumes is nonnegative:
* On arm32/arm64, it creates a pthread key, sets it to a magic value, then scans forward from
the thread pointer looking for it. [The scan count was bumped to 384 to fix a reported
- breakage happening with Android N.](https://go-review.googlesource.com/c/go/+/38636) (XXX: I
- suspect the actual platform breakage happened with Android M's [lock-free pthread key
+ breakage happening with API level 24.](https://go-review.googlesource.com/c/go/+/38636) (XXX: I
+ suspect the actual platform breakage happened with API level 23's [lock-free pthread key
work][bionic-lockfree-keys].)
* On x86/x86-64, it uses a fixed offset from the thread pointer (TP+0xf8 or TP+0x1d0) and
creates pthread keys until one of them hits the fixed offset.
@@ -803,7 +803,7 @@
key, but apps segfault. Perhaps the Go runtime expects its "g" variable to be zero-initialized ([one
example][go-tlsg-zero]). With this hack, it's never zero, but with its current allocation strategy,
it is typically zero. After [Bionic's pthread key system was rewritten to be
-lock-free][bionic-lockfree-keys] for Android M, though, it's not guaranteed, because a key could be
+lock-free][bionic-lockfree-keys] for API level 23, though, it's not guaranteed, because a key could be
recycled.
[go-tlsg-zero]: https://go.googlesource.com/go/+/5bc1fd42f6d185b8ff0201db09fb82886978908b/src/runtime/asm_arm64.s#980
diff --git a/libc/bionic/__bionic_get_shell_path.cpp b/libc/bionic/__bionic_get_shell_path.cpp
index 3ea256d..de79325 100644
--- a/libc/bionic/__bionic_get_shell_path.cpp
+++ b/libc/bionic/__bionic_get_shell_path.cpp
@@ -28,15 +28,15 @@
#include "private/__bionic_get_shell_path.h"
+#include <unistd.h>
+
const char* __bionic_get_shell_path() {
- // For the host Bionic, we use the standard /bin/sh.
- // Since P there's a /bin -> /system/bin symlink that means this will work
- // for the device too, but as long as the NDK supports earlier API levels,
- // we should probably make sure that this works in static binaries run on
- // those OS versions too.
-#if !defined(__ANDROID__)
- return "/bin/sh";
-#else
- return "/system/bin/sh";
-#endif
+ // Since API level 28 there's a /bin -> /system/bin symlink that means
+ // /bin/sh will work for the device too, but as long as the NDK supports
+ // earlier API levels, falling back to /system/bin/sh ensures that static
+ // binaries run on those OS versions too.
+ // This whole function can be removed and replaced by hard-coded /bin/sh
+ // when we no longer support anything below API level 28.
+ static bool have_bin_sh = !access("/bin/sh", F_OK);
+ return have_bin_sh ? "/bin/sh" : "/system/bin/sh";
}
diff --git a/libc/include/paths.h b/libc/include/paths.h
index cfbc5b3..7de9eaa 100644
--- a/libc/include/paths.h
+++ b/libc/include/paths.h
@@ -38,10 +38,8 @@
#include <sys/cdefs.h>
-#ifndef _PATH_BSHELL
/** Path to the default system shell. Historically the 'B' was to specify the Bourne shell. */
#define _PATH_BSHELL "/system/bin/sh"
-#endif
/** Path to the system console. */
#define _PATH_CONSOLE "/dev/console"
diff --git a/libc/malloc_debug/README.md b/libc/malloc_debug/README.md
index 750a469..badbc5a 100644
--- a/libc/malloc_debug/README.md
+++ b/libc/malloc_debug/README.md
@@ -4,7 +4,7 @@
Malloc debug is a method of debugging native memory problems. It can help
detect memory corruption, memory leaks, and use after free issues.
-This documentation describes how to enable this feature on Android N or later
+This documentation describes how to enable this feature on API level 24 or later
versions of the Android OS. (See the "Examples" section.)
The documentation for malloc debug on older versions of Android is
@@ -215,7 +215,7 @@
| bt\_sz | backtrace\_size |
### check\_unreachable\_on\_signal
-As of Android U, this option will trigger a check for unreachable memory
+As of API level 34, this option will trigger a check for unreachable memory
in a process. Specifically, if the signal SIGRTMAX - 16 (which is 48 on
Android devices). The best way to see the exact signal being used is to
enable the verbose option then look at the log for the message:
@@ -341,7 +341,7 @@
04-15 12:35:33.305 7412 7412 E malloc_debug: #03 pc 000a28a8 /system/lib/libc++.so
### log\_allocator\_stats\_on\_signal
-As of Android V, this option will trigger a call to:
+As of API level 35, this option will trigger a call to:
mallopt(M_LOG_STATS, 0);
@@ -497,13 +497,13 @@
detected when the process is exiting.
### verbose
-As of Android Q, all info messages will be turned off by default. For example,
-in Android P and older, enabling malloc debug would result in this message
+As of API level 29, all info messages will be turned off by default. For example,
+in API level 28 and older, enabling malloc debug would result in this message
in the log:
08-16 15:54:16.060 26947 26947 I libc : /system/bin/app_process64: malloc debug enabled
-In android Q, this message will not be displayed because these info messages
+In API level 29, this message will not be displayed because these info messages
slow down process start up. However, if you want to re-enable these messages,
add the verbose option. All of the "Run XXX" messages are also silenced unless
the verbose option is specified. This is an example of the type
@@ -614,7 +614,7 @@
There are now multiple versions of the file:
-Android P produces version v1.1 of the heap dump.
+API level 28 produces version v1.1 of the heap dump.
Android Native Heap Dump v1.1
@@ -624,7 +624,7 @@
NUM\_ALLOCATIONS value should be treated as always 1 no matter what is
actually present.
-Android Q introduces v1.2 of the heap dump. The new header looks like this:
+API level 29 introduces v1.2 of the heap dump. The new header looks like this:
Android Native Heap Dump v1.2
@@ -711,7 +711,7 @@
# export LIBC_DEBUG_MALLOC_ENABLE=1
# ls
-Enable malloc debug using an environment variable (Android O or later):
+Enable malloc debug using an environment variable (API level 26 or later):
adb shell
# export LIBC_DEBUG_MALLOC_OPTIONS=backtrace
@@ -733,7 +733,7 @@
App developers should check the NDK documentation about
[wrap.sh](https://developer.android.com/ndk/guides/wrap-script.html)
-for the best way to use malloc debug in Android O or later on non-rooted
+for the best way to use malloc debug in API level 26 or later on non-rooted
devices.
**NOTE**: Android 12 introduced a bug that can cause the wrap.\<APP\> property to
@@ -744,7 +744,7 @@
adb shell start
If you do have a rooted device, you can enable malloc debug for a specific
-program/application (Android O or later):
+program/application (API level 26 or later):
adb shell setprop wrap.<APP> '"LIBC_DEBUG_MALLOC_OPTIONS=backtrace logwrapper"'
@@ -753,7 +753,7 @@
adb shell setprop wrap.<APP> '"LIBC_DEBUG_MALLOC_OPTIONS=backtrace\ leak_track\ fill logwrapper"'
-For example, to enable malloc debug for the google search box (Android O or later):
+For example, to enable malloc debug for the google search box (API level 26 or later):
adb shell setprop wrap.com.google.android.googlequicksearchbox '"LIBC_DEBUG_MALLOC_OPTIONS=backtrace logwrapper"'
adb shell am force-stop com.google.android.googlequicksearchbox
diff --git a/libc/malloc_hooks/README.md b/libc/malloc_hooks/README.md
index 1747e8d..97ae9ce 100644
--- a/libc/malloc_hooks/README.md
+++ b/libc/malloc_hooks/README.md
@@ -2,7 +2,7 @@
============
Malloc hooks allows a program to intercept all allocation/free calls that
-happen during execution. It is only available in Android P and newer versions
+happen during execution. It is only available in API level 28 and newer versions
of the OS.
There are two ways to enable these hooks, set a special system
diff --git a/libc/platform/bionic/tls_defines.h b/libc/platform/bionic/tls_defines.h
index 06c6617..dd3563d 100644
--- a/libc/platform/bionic/tls_defines.h
+++ b/libc/platform/bionic/tls_defines.h
@@ -66,8 +66,8 @@
// - TLS_SLOT_BIONIC_TLS: Optimizes accesses to bionic_tls by one load versus
// finding it using __get_thread().
//
-// - TLS_SLOT_APP: Available for use by apps in Android Q and later. (This slot
-// was used for errno in P and earlier.)
+// - TLS_SLOT_APP: Available for use by apps in API level 29 and later.
+// (This slot was used for errno in API level 28 and earlier.)
//
// - TLS_SLOT_NATIVE_BRIDGE_GUEST_STATE: Pointer to the guest state for native
// bridge implementations. It is (to be) used by debuggerd to access this
diff --git a/libc/upstream-netbsd/android/include/netbsd-compat.h b/libc/upstream-netbsd/android/include/netbsd-compat.h
index a625f06..2c48b87 100644
--- a/libc/upstream-netbsd/android/include/netbsd-compat.h
+++ b/libc/upstream-netbsd/android/include/netbsd-compat.h
@@ -44,7 +44,3 @@
int reallocarr(void*, size_t, size_t);
#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
-
-/* Use appropriate shell depending on process's executable. */
-__LIBC_HIDDEN__ extern const char* __bionic_get_shell_path();
-#define _PATH_BSHELL __bionic_get_shell_path()
diff --git a/libc/upstream-openbsd/android/include/openbsd-compat.h b/libc/upstream-openbsd/android/include/openbsd-compat.h
index ac6840a..fa0831f 100644
--- a/libc/upstream-openbsd/android/include/openbsd-compat.h
+++ b/libc/upstream-openbsd/android/include/openbsd-compat.h
@@ -53,10 +53,6 @@
*/
#define _PATH_TMP "/data/local/tmp/"
-/* Use appropriate shell depending on process's executable. */
-__LIBC_HIDDEN__ extern const char* __bionic_get_shell_path();
-#define _PATH_BSHELL __bionic_get_shell_path()
-
__LIBC_HIDDEN__ extern char* __findenv(const char*, int, int*);
__LIBC_HIDDEN__ extern char* _mktemp(char*);
diff --git a/libm/Android.bp b/libm/Android.bp
index 69cfb14..86b32db 100644
--- a/libm/Android.bp
+++ b/libm/Android.bp
@@ -360,7 +360,8 @@
"upstream-freebsd/lib/msun/src/s_lrintf.c",
],
// The x86 ABI doesn't include this, which is needed for the
- // roundss/roundsd instructions that we've used since Android M.
+ // roundss/roundsd instructions that we've used since API level 23,
+ // originally by hand-written assembler but later via intrinsics.
cflags: ["-msse4.1"],
version_script: ":libm.x86.map",
},
diff --git a/linker/linker_phdr.cpp b/linker/linker_phdr.cpp
index e695efd..5967e2d 100644
--- a/linker/linker_phdr.cpp
+++ b/linker/linker_phdr.cpp
@@ -979,8 +979,8 @@
// Apps may rely on undefined behavior here on 4 KB systems,
// which is the norm before this change is introduced
if (kPageSize >= 16384 && min_align_ < kPageSize && !should_use_16kib_app_compat_) {
- DL_ERR("\"%s\" program alignment (%zu) cannot be smaller than system page size (%zu)",
- name_.c_str(), min_align_, kPageSize);
+ DL_ERR_AND_LOG("\"%s\" program alignment (%zu) cannot be smaller than system page size (%zu)",
+ name_.c_str(), min_align_, kPageSize);
return false;
}