Merge "Revert "Add 64-bit slm optimized strlcpy and srlcat.""
diff --git a/libc/bionic/fortify.cpp b/libc/bionic/fortify.cpp
index 944cfca..3bd9e68 100644
--- a/libc/bionic/fortify.cpp
+++ b/libc/bionic/fortify.cpp
@@ -80,17 +80,17 @@
int __FD_ISSET_chk(int fd, const fd_set* set, size_t set_size) {
__check_fd_set("FD_ISSET", fd, set_size);
- return FD_ISSET(fd, set);
+ return __FD_ISSET(fd, set);
}
void __FD_CLR_chk(int fd, fd_set* set, size_t set_size) {
__check_fd_set("FD_CLR", fd, set_size);
- FD_CLR(fd, set);
+ __FD_CLR(fd, set);
}
void __FD_SET_chk(int fd, fd_set* set, size_t set_size) {
__check_fd_set("FD_SET", fd, set_size);
- FD_SET(fd, set);
+ __FD_SET(fd, set);
}
char* __fgets_chk(char* dst, int supplied_size, FILE* stream, size_t dst_len_from_compiler) {
diff --git a/libc/bionic/sched_cpucount.c b/libc/bionic/sched_cpucount.c
index 2ea1d3f..6f66589 100644
--- a/libc/bionic/sched_cpucount.c
+++ b/libc/bionic/sched_cpucount.c
@@ -28,7 +28,7 @@
#define _GNU_SOURCE 1
#include <sched.h>
-int __sched_cpucount(size_t setsize, cpu_set_t* set) {
+int __sched_cpucount(size_t setsize, const cpu_set_t* set) {
int nn = 0;
int nn_max = setsize / sizeof(__CPU_BITTYPE);
int count = 0;
diff --git a/libc/include/android/dlext.h b/libc/include/android/dlext.h
index 2b4169e..d0200c4 100644
--- a/libc/include/android/dlext.h
+++ b/libc/include/android/dlext.h
@@ -24,6 +24,11 @@
#include <sys/types.h> /* for off64_t */
/**
+ * @addtogroup libdl Dynamic Linker
+ * @{
+ */
+
+/**
* \file
* Advanced dynamic library opening support. Most users will want to use
* the standard [dlopen(3)](http://man7.org/linux/man-pages/man3/dlopen.3.html)
@@ -179,4 +184,6 @@
__END_DECLS
+/** @} */
+
#endif
diff --git a/libc/include/sched.h b/libc/include/sched.h
index de6969f8..1f50366 100644
--- a/libc/include/sched.h
+++ b/libc/include/sched.h
@@ -143,7 +143,7 @@
#define CPU_COUNT_S(setsize, set) __sched_cpucount((setsize), (set))
-int __sched_cpucount(size_t __set_size, cpu_set_t* __set) __INTRODUCED_IN(12);
+int __sched_cpucount(size_t __set_size, const cpu_set_t* __set) __INTRODUCED_IN(12);
#endif /* __USE_GNU */
diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h
index ef97538..6888e8c 100644
--- a/libc/include/stdlib.h
+++ b/libc/include/stdlib.h
@@ -77,7 +77,7 @@
unsigned long strtoul(const char* __s, char** __end_ptr, int __base);
unsigned long long strtoull(const char* __s, char** __end_ptr, int __base);
-int posix_memalign(void** __memptr, size_t __alignment, size_t __size) __INTRODUCED_IN(16);
+int posix_memalign(void** __memptr, size_t __alignment, size_t __size) __INTRODUCED_IN(17);
void* aligned_alloc(size_t __alignment, size_t __size) __INTRODUCED_IN(28);
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index 5760689..201f40a 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -289,14 +289,22 @@
# endif
#endif
+// As we move some FORTIFY checks to be always on, __bos needs to be
+// always available.
#if defined(__BIONIC_FORTIFY)
# if _FORTIFY_SOURCE == 2
# define __bos_level 1
# else
# define __bos_level 0
# endif
-# define __bosn(s, n) __builtin_object_size((s), (n))
-# define __bos(s) __bosn((s), __bos_level)
+#else
+# define __bos_level 0
+#endif
+
+#define __bosn(s, n) __builtin_object_size((s), (n))
+#define __bos(s) __bosn((s), __bos_level)
+
+#if defined(__BIONIC_FORTIFY)
# define __bos0(s) __bosn((s), 0)
# if defined(__clang__)
# define __pass_object_size_n(n) __attribute__((pass_object_size(n)))
diff --git a/libc/include/sys/select.h b/libc/include/sys/select.h
index 603a5a6..e58df21 100644
--- a/libc/include/sys/select.h
+++ b/libc/include/sys/select.h
@@ -63,15 +63,20 @@
void __FD_SET_chk(int, fd_set*, size_t) __INTRODUCED_IN(21);
int __FD_ISSET_chk(int, const fd_set*, size_t) __INTRODUCED_IN(21);
-#if defined(__BIONIC_FORTIFY) && __ANDROID_API__ >= __ANDROID_API_L__
+#define __FD_CLR(fd, set) (__FDS_BITS(fd_set*,set)[__FDELT(fd)] &= ~__FDMASK(fd))
+#define __FD_SET(fd, set) (__FDS_BITS(fd_set*,set)[__FDELT(fd)] |= __FDMASK(fd))
+#define __FD_ISSET(fd, set) ((__FDS_BITS(const fd_set*,set)[__FDELT(fd)] & __FDMASK(fd)) != 0)
+
+
+#if __ANDROID_API__ >= __ANDROID_API_L__
#define FD_CLR(fd, set) __FD_CLR_chk(fd, set, __bos(set))
#define FD_SET(fd, set) __FD_SET_chk(fd, set, __bos(set))
#define FD_ISSET(fd, set) __FD_ISSET_chk(fd, set, __bos(set))
#else
-#define FD_CLR(fd, set) (__FDS_BITS(fd_set*,set)[__FDELT(fd)] &= ~__FDMASK(fd))
-#define FD_SET(fd, set) (__FDS_BITS(fd_set*,set)[__FDELT(fd)] |= __FDMASK(fd))
-#define FD_ISSET(fd, set) ((__FDS_BITS(const fd_set*,set)[__FDELT(fd)] & __FDMASK(fd)) != 0)
-#endif /* defined(__BIONIC_FORTIFY) && __ANDROID_API >= 21 */
+#define FD_CLR(fd, set) __FD_CLR(fd, set)
+#define FD_SET(fd, set) __FD_SET(fd, set)
+#define FD_ISSET(fd, set) __FD_ISSET(fd, set)
+#endif /* __ANDROID_API >= 21 */
int select(int __fd_count, fd_set* __read_fds, fd_set* __write_fds, fd_set* __exception_fds, struct timeval* __timeout);
int pselect(int __fd_count, fd_set* __read_fds, fd_set* __write_fds, fd_set* __exception_fds, const struct timespec* __timeout, const sigset_t* __mask);
diff --git a/libc/libc.arm.map b/libc/libc.arm.map
index 56e4189..ee05b16 100644
--- a/libc/libc.arm.map
+++ b/libc/libc.arm.map
@@ -710,7 +710,7 @@
posix_fallocate; # introduced=21
posix_fallocate64; # introduced=21
posix_madvise; # introduced=23
- posix_memalign; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
+ posix_memalign; # introduced=17
posix_openpt; # introduced=21
ppoll; # introduced=21
prctl;
diff --git a/libc/libc.arm64.map b/libc/libc.arm64.map
index 880ed80..5e6f991 100644
--- a/libc/libc.arm64.map
+++ b/libc/libc.arm64.map
@@ -656,7 +656,7 @@
posix_fallocate; # introduced=21
posix_fallocate64; # introduced=21
posix_madvise; # introduced=23
- posix_memalign; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
+ posix_memalign; # introduced=17
posix_openpt; # introduced=21
ppoll; # introduced=21
prctl;
diff --git a/libc/libc.map.txt b/libc/libc.map.txt
index b787ea5..6bbffba 100644
--- a/libc/libc.map.txt
+++ b/libc/libc.map.txt
@@ -734,7 +734,7 @@
posix_fallocate; # introduced=21
posix_fallocate64; # introduced=21
posix_madvise; # introduced=23
- posix_memalign; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
+ posix_memalign; # introduced=17
posix_openpt; # introduced=21
ppoll; # introduced=21
prctl;
diff --git a/libc/libc.mips.map b/libc/libc.mips.map
index ec3fe3a..cdba570 100644
--- a/libc/libc.mips.map
+++ b/libc/libc.mips.map
@@ -708,7 +708,7 @@
posix_fallocate; # introduced=21
posix_fallocate64; # introduced=21
posix_madvise; # introduced=23
- posix_memalign; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
+ posix_memalign; # introduced=17
posix_openpt; # introduced=21
ppoll; # introduced=21
prctl;
diff --git a/libc/libc.mips64.map b/libc/libc.mips64.map
index 880ed80..5e6f991 100644
--- a/libc/libc.mips64.map
+++ b/libc/libc.mips64.map
@@ -656,7 +656,7 @@
posix_fallocate; # introduced=21
posix_fallocate64; # introduced=21
posix_madvise; # introduced=23
- posix_memalign; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
+ posix_memalign; # introduced=17
posix_openpt; # introduced=21
ppoll; # introduced=21
prctl;
diff --git a/libc/libc.x86.map b/libc/libc.x86.map
index 9407b58..5cb0cf4 100644
--- a/libc/libc.x86.map
+++ b/libc/libc.x86.map
@@ -706,7 +706,7 @@
posix_fallocate; # introduced=21
posix_fallocate64; # introduced=21
posix_madvise; # introduced=23
- posix_memalign; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
+ posix_memalign; # introduced=17
posix_openpt; # introduced=21
ppoll; # introduced=21
prctl;
diff --git a/libc/libc.x86_64.map b/libc/libc.x86_64.map
index 880ed80..5e6f991 100644
--- a/libc/libc.x86_64.map
+++ b/libc/libc.x86_64.map
@@ -656,7 +656,7 @@
posix_fallocate; # introduced=21
posix_fallocate64; # introduced=21
posix_madvise; # introduced=23
- posix_memalign; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
+ posix_memalign; # introduced=17
posix_openpt; # introduced=21
ppoll; # introduced=21
prctl;
diff --git a/libc/malloc_debug/Android.bp b/libc/malloc_debug/Android.bp
index 899987c..1a79802 100644
--- a/libc/malloc_debug/Android.bp
+++ b/libc/malloc_debug/Android.bp
@@ -61,6 +61,11 @@
},
},
+ // Clang lld link flags do not work with special link rules
+ // for libunwind_llvm yet. Linked aosp_arm-eng image failed to
+ // boot up in the emulator. http://b/78118944.
+ use_clang_lld: false,
+
static_libs: [
"libasync_safe",
"libbase",
diff --git a/linker/Android.bp b/linker/Android.bp
index 7877a37..5afe939 100644
--- a/linker/Android.bp
+++ b/linker/Android.bp
@@ -140,6 +140,10 @@
"-Wl,-soname,ld-android.so",
],
+ // lld bug: https://bugs.llvm.org/show_bug.cgi?id=36295
+ // error: symbol __aeabi_*@@LIBC_N has undefined version LIBC_N
+ use_clang_lld: false,
+
cflags: [
"-fno-stack-protector",
"-Wstrict-overflow=5",
diff --git a/tests/libs/Android.bp b/tests/libs/Android.bp
index ae5f78a..c1f1590 100644
--- a/tests/libs/Android.bp
+++ b/tests/libs/Android.bp
@@ -47,6 +47,7 @@
defaults: ["bionic_testlib_defaults"],
srcs: ["elf_tls_test_library.cpp"],
cflags: ["-fno-emulated-tls"],
+ allow_undefined_symbols: true, // __tls_get_addr is undefined.
}
// -----------------------------------------------------------------------------