Merge "Fix misleading comment."
diff --git a/libc/Android.mk b/libc/Android.mk
index 1839d3d..330e517 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -1162,14 +1162,11 @@
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
LOCAL_SHARED_LIBRARIES := libc libdl
-ifeq ($(TARGET_ARCH),arm)
+LOCAL_CXX_STL := none
+LOCAL_SYSTEM_SHARED_LIBRARIES :=
# Only need this for arm since libc++ uses its own unwind code that
# doesn't mix with the other default unwind code.
-LOCAL_CXX_STL := libc++_static
-else
-LOCAL_CXX_STL := none
-endif
-LOCAL_SYSTEM_SHARED_LIBRARIES :=
+LOCAL_STATIC_LIBRARIES_arm := libunwind_llvm
LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
# Don't install on release build
diff --git a/libc/include/stdatomic.h b/libc/include/stdatomic.h
index bcea859..58cb1bc 100644
--- a/libc/include/stdatomic.h
+++ b/libc/include/stdatomic.h
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
-#if defined(__cplusplus) && defined(_USING_LIBCXX)
+#if defined(__cplusplus) && __cplusplus >= 201103L && defined(_USING_LIBCXX)
# ifdef __clang__
# if __has_feature(cxx_atomic)
# define _STDATOMIC_HAVE_ATOMIC
diff --git a/libm/Android.mk b/libm/Android.mk
index 69a17a1..0f63d7b 100644
--- a/libm/Android.mk
+++ b/libm/Android.mk
@@ -295,6 +295,7 @@
LOCAL_C_INCLUDES_mips64 := $(libm_ld_includes)
LOCAL_SRC_FILES_mips64 := mips/fenv.c $(libm_ld_src_files)
+LOCAL_CXX_STL := none
include $(BUILD_STATIC_LIBRARY)
#
@@ -312,6 +313,8 @@
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
+LOCAL_CXX_STL := none
+
# We'd really like to do this for all architectures, but since this wasn't done
# before, these symbols must continue to be exported on LP32 for binary
# compatibility.
diff --git a/linker/linker.cpp b/linker/linker.cpp
index fc46172..cd691af 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -1915,27 +1915,33 @@
// TODO: glibc dynamic linker uses this name for
// initial library lookup; consider doing the same here.
break;
+
case DT_HASH:
nbucket = reinterpret_cast<uint32_t*>(load_bias + d->d_un.d_ptr)[0];
nchain = reinterpret_cast<uint32_t*>(load_bias + d->d_un.d_ptr)[1];
bucket = reinterpret_cast<uint32_t*>(load_bias + d->d_un.d_ptr + 8);
chain = reinterpret_cast<uint32_t*>(load_bias + d->d_un.d_ptr + 8 + nbucket * 4);
break;
+
case DT_STRTAB:
strtab = reinterpret_cast<const char*>(load_bias + d->d_un.d_ptr);
break;
+
case DT_STRSZ:
strtab_size = d->d_un.d_val;
break;
+
case DT_SYMTAB:
symtab = reinterpret_cast<ElfW(Sym)*>(load_bias + d->d_un.d_ptr);
break;
+
case DT_SYMENT:
if (d->d_un.d_val != sizeof(ElfW(Sym))) {
DL_ERR("invalid DT_SYMENT: %zd", static_cast<size_t>(d->d_un.d_val));
return false;
}
break;
+
case DT_PLTREL:
#if defined(USE_RELA)
if (d->d_un.d_val != DT_RELA) {
@@ -1949,6 +1955,7 @@
}
#endif
break;
+
case DT_JMPREL:
#if defined(USE_RELA)
plt_rela = reinterpret_cast<ElfW(Rela)*>(load_bias + d->d_un.d_ptr);
@@ -1956,6 +1963,7 @@
plt_rel = reinterpret_cast<ElfW(Rel)*>(load_bias + d->d_un.d_ptr);
#endif
break;
+
case DT_PLTRELSZ:
#if defined(USE_RELA)
plt_rela_count = d->d_un.d_val / sizeof(ElfW(Rela));
@@ -1963,6 +1971,7 @@
plt_rel_count = d->d_un.d_val / sizeof(ElfW(Rel));
#endif
break;
+
case DT_PLTGOT:
#if defined(__mips__)
// Used by mips and mips64.
@@ -1970,6 +1979,7 @@
#endif
// Ignore for other platforms... (because RTLD_LAZY is not supported)
break;
+
case DT_DEBUG:
// Set the DT_DEBUG entry to the address of _r_debug for GDB
// if the dynamic table is writable
@@ -1987,21 +1997,26 @@
case DT_RELA:
rela = reinterpret_cast<ElfW(Rela)*>(load_bias + d->d_un.d_ptr);
break;
+
case DT_RELASZ:
rela_count = d->d_un.d_val / sizeof(ElfW(Rela));
break;
+
case DT_RELAENT:
if (d->d_un.d_val != sizeof(ElfW(Rela))) {
DL_ERR("invalid DT_RELAENT: %zd", static_cast<size_t>(d->d_un.d_val));
return false;
}
break;
+
+ // ignored (see DT_RELCOUNT comments for details)
case DT_RELACOUNT:
- // ignored (see DT_RELCOUNT comments for details)
break;
+
case DT_REL:
DL_ERR("unsupported DT_REL in \"%s\"", name);
return false;
+
case DT_RELSZ:
DL_ERR("unsupported DT_RELSZ in \"%s\"", name);
return false;
@@ -2009,21 +2024,24 @@
case DT_REL:
rel = reinterpret_cast<ElfW(Rel)*>(load_bias + d->d_un.d_ptr);
break;
+
case DT_RELSZ:
rel_count = d->d_un.d_val / sizeof(ElfW(Rel));
break;
+
case DT_RELENT:
if (d->d_un.d_val != sizeof(ElfW(Rel))) {
DL_ERR("invalid DT_RELENT: %zd", static_cast<size_t>(d->d_un.d_val));
return false;
}
break;
+
+ // "Indicates that all RELATIVE relocations have been concatenated together,
+ // and specifies the RELATIVE relocation count."
+ //
+ // TODO: Spec also mentions that this can be used to optimize relocation process;
+ // Not currently used by bionic linker - ignored.
case DT_RELCOUNT:
- // "Indicates that all RELATIVE relocations have been concatenated together,
- // and specifies the RELATIVE relocation count."
- //
- // TODO: Spec also mentions that this can be used to optimize relocation process;
- // Not currently used by bionic linker - ignored.
break;
case DT_RELA:
DL_ERR("unsupported DT_RELA in \"%s\"", name);
@@ -2033,31 +2051,39 @@
init_func = reinterpret_cast<linker_function_t>(load_bias + d->d_un.d_ptr);
DEBUG("%s constructors (DT_INIT) found at %p", name, init_func);
break;
+
case DT_FINI:
fini_func = reinterpret_cast<linker_function_t>(load_bias + d->d_un.d_ptr);
DEBUG("%s destructors (DT_FINI) found at %p", name, fini_func);
break;
+
case DT_INIT_ARRAY:
init_array = reinterpret_cast<linker_function_t*>(load_bias + d->d_un.d_ptr);
DEBUG("%s constructors (DT_INIT_ARRAY) found at %p", name, init_array);
break;
+
case DT_INIT_ARRAYSZ:
init_array_count = ((unsigned)d->d_un.d_val) / sizeof(ElfW(Addr));
break;
+
case DT_FINI_ARRAY:
fini_array = reinterpret_cast<linker_function_t*>(load_bias + d->d_un.d_ptr);
DEBUG("%s destructors (DT_FINI_ARRAY) found at %p", name, fini_array);
break;
+
case DT_FINI_ARRAYSZ:
fini_array_count = ((unsigned)d->d_un.d_val) / sizeof(ElfW(Addr));
break;
+
case DT_PREINIT_ARRAY:
preinit_array = reinterpret_cast<linker_function_t*>(load_bias + d->d_un.d_ptr);
DEBUG("%s constructors (DT_PREINIT_ARRAY) found at %p", name, preinit_array);
break;
+
case DT_PREINIT_ARRAYSZ:
preinit_array_count = ((unsigned)d->d_un.d_val) / sizeof(ElfW(Addr));
break;
+
case DT_TEXTREL:
#if defined(__LP64__)
DL_ERR("text relocations (DT_TEXTREL) found in 64-bit ELF file \"%s\"", name);
@@ -2066,12 +2092,15 @@
has_text_relocations = true;
break;
#endif
+
case DT_SYMBOLIC:
has_DT_SYMBOLIC = true;
break;
+
case DT_NEEDED:
++needed_count;
break;
+
case DT_FLAGS:
if (d->d_un.d_val & DF_TEXTREL) {
#if defined(__LP64__)
@@ -2085,6 +2114,7 @@
has_DT_SYMBOLIC = true;
}
break;
+
case DT_FLAGS_1:
if ((d->d_un.d_val & DF_1_GLOBAL) != 0) {
rtld_flags |= RTLD_GLOBAL;
@@ -2107,6 +2137,7 @@
*dp = &_r_debug;
}
break;
+
case DT_MIPS_RLD_VERSION:
case DT_MIPS_FLAGS:
case DT_MIPS_BASE_ADDRESS:
@@ -2125,10 +2156,14 @@
mips_gotsym = d->d_un.d_val;
break;
#endif
+ // Ignored: "Its use has been superseded by the DF_BIND_NOW flag"
+ case DT_BIND_NOW:
+ break;
+
+ // Ignore: bionic does not support symbol versioning...
case DT_VERSYM:
case DT_VERDEF:
case DT_VERDEFNUM:
- // Ignore: bionic does not support symbol versioning...
break;
default: