Merge changes Ia08e1b5c,I60e589dd,Ib7edb665,Ibf1bf5ec,Ibd623857
* changes:
Handle R_GENERIC_TLS_TPREL relocations
Avoid a dlopen abort on an invalid TLS alignment
Initialize static TLS memory using module list
Record TLS modules and layout static TLS memory
StaticTlsLayout: add exe/tcb and solib layout
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index e9d0e4b..a919a79 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -280,7 +280,7 @@
*/
# define __BIONIC_FORTIFY_VARIADIC static __inline__
/* Error functions don't have bodies, so they can just be static. */
-# define __BIONIC_ERROR_FUNCTION_VISIBILITY static
+# define __BIONIC_ERROR_FUNCTION_VISIBILITY static __attribute__((unused))
#else
/* Further increase sharing for some inline functions */
# define __pass_object_size_n(n)
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 00bd08c..6687d23 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -603,6 +603,9 @@
}
void set_fd(int fd, bool assume_ownership) {
+ if (fd_ != -1 && close_fd_) {
+ close(fd_);
+ }
fd_ = fd;
close_fd_ = assume_ownership;
}
diff --git a/tests/grp_pwd_test.cpp b/tests/grp_pwd_test.cpp
index ca34205..4b207b6 100644
--- a/tests/grp_pwd_test.cpp
+++ b/tests/grp_pwd_test.cpp
@@ -198,7 +198,7 @@
}
TEST(pwd, getpwnam_app_id_u0_i1) {
- check_get_passwd("u0_i1", 99001, TYPE_APP);
+ check_get_passwd("u0_i1", 90001, TYPE_APP);
}
TEST(pwd, getpwnam_app_id_u1_root) {
@@ -218,9 +218,8 @@
}
TEST(pwd, getpwnam_app_id_u1_i0) {
- check_get_passwd("u1_i0", 199000, TYPE_APP);
+ check_get_passwd("u1_i0", 190000, TYPE_APP);
}
-
#if defined(__BIONIC__)
template <typename T>
static void expect_ids(const T& ids) {
@@ -464,7 +463,7 @@
}
TEST(grp, getgrnam_app_id_u0_i1) {
- check_get_group("u0_i1", 99001);
+ check_get_group("u0_i1", 90001);
}
TEST(grp, getgrnam_app_id_u1_root) {
@@ -484,7 +483,7 @@
}
TEST(grp, getgrnam_app_id_u1_i0) {
- check_get_group("u1_i0", 199000);
+ check_get_group("u1_i0", 190000);
}
TEST(grp, getgrnam_r_reentrancy) {
diff --git a/tests/time_test.cpp b/tests/time_test.cpp
index 4ec5976..50830ee 100644
--- a/tests/time_test.cpp
+++ b/tests/time_test.cpp
@@ -607,9 +607,9 @@
ts2.tv_nsec += NS_PER_S;
}
- // Should be less than (a very generous, to try to avoid flakiness) 1000000ns.
+ // To try to avoid flakiness we'll accept answers within 10,000,000ns (0.01s).
ASSERT_EQ(0, ts2.tv_sec);
- ASSERT_LT(ts2.tv_nsec, 1000000);
+ ASSERT_LT(ts2.tv_nsec, 10'000'000);
}
TEST(time, clock_gettime_CLOCK_REALTIME) {