Merge "Fix boost build with unified headers."
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index 936f3fd..5ff3c64 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -350,7 +350,5 @@
int __set_thread_area:set_thread_area(void*) x86
# vdso stuff.
-int clock_gettime(clockid_t, timespec*) mips,mips64
-int __clock_gettime:clock_gettime(clockid_t, timespec*) arm,arm64,x86,x86_64
-int gettimeofday(timeval*, timezone*) mips,mips64
-int __gettimeofday:gettimeofday(timeval*, timezone*) arm,arm64,x86,x86_64
+int __clock_gettime:clock_gettime(clockid_t, timespec*) all
+int __gettimeofday:gettimeofday(timeval*, timezone*) all
diff --git a/libc/arch-mips/syscalls/clock_gettime.S b/libc/arch-mips/syscalls/__clock_gettime.S
similarity index 86%
rename from libc/arch-mips/syscalls/clock_gettime.S
rename to libc/arch-mips/syscalls/__clock_gettime.S
index d227a06..6fad7e9 100644
--- a/libc/arch-mips/syscalls/clock_gettime.S
+++ b/libc/arch-mips/syscalls/__clock_gettime.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(clock_gettime)
+ENTRY(__clock_gettime)
.set noreorder
.cpload t9
li v0, __NR_clock_gettime
@@ -16,4 +16,4 @@
j t9
nop
.set reorder
-END(clock_gettime)
+END(__clock_gettime)
diff --git a/libc/arch-mips/syscalls/gettimeofday.S b/libc/arch-mips/syscalls/__gettimeofday.S
similarity index 86%
rename from libc/arch-mips/syscalls/gettimeofday.S
rename to libc/arch-mips/syscalls/__gettimeofday.S
index 672faa3..e8b9d6a 100644
--- a/libc/arch-mips/syscalls/gettimeofday.S
+++ b/libc/arch-mips/syscalls/__gettimeofday.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(gettimeofday)
+ENTRY(__gettimeofday)
.set noreorder
.cpload t9
li v0, __NR_gettimeofday
@@ -16,4 +16,4 @@
j t9
nop
.set reorder
-END(gettimeofday)
+END(__gettimeofday)
diff --git a/libc/arch-mips64/syscalls/clock_gettime.S b/libc/arch-mips64/syscalls/__clock_gettime.S
similarity index 84%
rename from libc/arch-mips64/syscalls/clock_gettime.S
rename to libc/arch-mips64/syscalls/__clock_gettime.S
index 0813560..3407122 100644
--- a/libc/arch-mips64/syscalls/clock_gettime.S
+++ b/libc/arch-mips64/syscalls/__clock_gettime.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(clock_gettime)
+ENTRY(__clock_gettime)
.set push
.set noreorder
li v0, __NR_clock_gettime
@@ -22,4 +22,5 @@
j t9
move ra, t0
.set pop
-END(clock_gettime)
+END(__clock_gettime)
+.hidden __clock_gettime
diff --git a/libc/arch-mips64/syscalls/gettimeofday.S b/libc/arch-mips64/syscalls/__gettimeofday.S
similarity index 84%
rename from libc/arch-mips64/syscalls/gettimeofday.S
rename to libc/arch-mips64/syscalls/__gettimeofday.S
index 3a6d417..2ac5e9b 100644
--- a/libc/arch-mips64/syscalls/gettimeofday.S
+++ b/libc/arch-mips64/syscalls/__gettimeofday.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(gettimeofday)
+ENTRY(__gettimeofday)
.set push
.set noreorder
li v0, __NR_gettimeofday
@@ -22,4 +22,5 @@
j t9
move ra, t0
.set pop
-END(gettimeofday)
+END(__gettimeofday)
+.hidden __gettimeofday
diff --git a/libc/bionic/vdso.cpp b/libc/bionic/vdso.cpp
index f3d95ca..dd4c070 100644
--- a/libc/bionic/vdso.cpp
+++ b/libc/bionic/vdso.cpp
@@ -17,8 +17,6 @@
#include "private/bionic_globals.h"
#include "private/bionic_vdso.h"
-#if defined(__aarch64__) || defined(__arm__) || defined(__i386__) || defined(__x86_64__)
-
#include <limits.h>
#include <link.h>
#include <string.h>
@@ -112,10 +110,3 @@
}
}
}
-
-#else
-
-void __libc_init_vdso(libc_globals*, KernelArgumentBlock&) {
-}
-
-#endif
diff --git a/libc/private/bionic_vdso.h b/libc/private/bionic_vdso.h
index 8fd0743..2d11cd6 100644
--- a/libc/private/bionic_vdso.h
+++ b/libc/private/bionic_vdso.h
@@ -34,7 +34,7 @@
#if defined(__aarch64__)
#define VDSO_CLOCK_GETTIME_SYMBOL "__kernel_clock_gettime"
#define VDSO_GETTIMEOFDAY_SYMBOL "__kernel_gettimeofday"
-#elif defined(__arm__) || defined(__i386__) || defined(__x86_64__)
+#else
#define VDSO_CLOCK_GETTIME_SYMBOL "__vdso_clock_gettime"
#define VDSO_GETTIMEOFDAY_SYMBOL "__vdso_gettimeofday"
#endif
diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp
index 6195d40..fde4717 100644
--- a/linker/dlfcn.cpp
+++ b/linker/dlfcn.cpp
@@ -322,7 +322,7 @@
static soinfo* __libdl_info = nullptr;
// This is used by the dynamic linker. Every process gets these symbols for free.
-soinfo* get_libdl_info(const char* linker_path) {
+soinfo* get_libdl_info(const char* linker_path, const link_map& linker_map) {
if (__libdl_info == nullptr) {
__libdl_info = new (__libdl_info_buf) soinfo(&g_default_namespace, linker_path, nullptr, 0, 0);
__libdl_info->flags_ |= FLAG_LINKED;
@@ -338,6 +338,9 @@
__libdl_info->soname_ = "ld-android.so";
__libdl_info->target_sdk_version_ = __ANDROID_API__;
__libdl_info->generate_handle();
+ __libdl_info->link_map_head.l_addr = linker_map.l_addr;
+ __libdl_info->link_map_head.l_name = linker_map.l_name;
+ __libdl_info->link_map_head.l_ld = linker_map.l_ld;
#if defined(__work_around_b_24465209__)
strlcpy(__libdl_info->old_name_, __libdl_info->soname_, sizeof(__libdl_info->old_name_));
#endif
diff --git a/linker/linker.h b/linker/linker.h
index ae1ae3c..43d345c 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -100,7 +100,7 @@
void count_relocation(RelocationKind kind);
-soinfo* get_libdl_info(const char* linker_path);
+soinfo* get_libdl_info(const char* linker_path, const link_map& linker_map);
soinfo* find_containing_library(const void* p);
diff --git a/linker/linker_main.cpp b/linker/linker_main.cpp
index 3d26e91..5dc215f 100644
--- a/linker/linker_main.cpp
+++ b/linker/linker_main.cpp
@@ -163,11 +163,11 @@
* relocate the offset of our exported 'rtld_db_dlactivity' symbol.
* Note that the linker shouldn't be on the soinfo list.
*/
-static void init_linker_info_for_gdb(ElfW(Addr) linker_base, char* linker_path) {
- static link_map linker_link_map_for_gdb;
+static link_map linker_link_map;
- linker_link_map_for_gdb.l_addr = linker_base;
- linker_link_map_for_gdb.l_name = linker_path;
+static void init_linker_info_for_gdb(ElfW(Addr) linker_base, char* linker_path) {
+ linker_link_map.l_addr = linker_base;
+ linker_link_map.l_name = linker_path;
/*
* Set the dynamic field in the link map otherwise gdb will complain with
@@ -178,9 +178,8 @@
ElfW(Ehdr)* elf_hdr = reinterpret_cast<ElfW(Ehdr)*>(linker_base);
ElfW(Phdr)* phdr = reinterpret_cast<ElfW(Phdr)*>(linker_base + elf_hdr->e_phoff);
phdr_table_get_dynamic_section(phdr, elf_hdr->e_phnum, linker_base,
- &linker_link_map_for_gdb.l_ld, nullptr);
+ &linker_link_map.l_ld, nullptr);
- insert_link_map_into_debug_map(&linker_link_map_for_gdb);
}
extern "C" int __system_properties_init(void);
@@ -210,7 +209,7 @@
* fixed it's own GOT. It is safe to make references to externs
* and other non-local data at this point.
*/
-static ElfW(Addr) __linker_init_post_relocation(KernelArgumentBlock& args, ElfW(Addr) linker_base) {
+static ElfW(Addr) __linker_init_post_relocation(KernelArgumentBlock& args) {
ProtectedDataGuard guard;
#if TIMING
@@ -288,7 +287,7 @@
map->l_addr = 0;
map->l_name = const_cast<char*>(executable_path);
insert_link_map_into_debug_map(map);
- init_linker_info_for_gdb(linker_base, kLinkerPath);
+ insert_link_map_into_debug_map(&linker_link_map);
// Extract information passed from the kernel.
si->phdr = reinterpret_cast<ElfW(Phdr)*>(args.getauxval(AT_PHDR));
@@ -554,16 +553,18 @@
exit(0);
}
+ init_linker_info_for_gdb(linker_addr, kLinkerPath);
+
// Initialize static variables. Note that in order to
// get correct libdl_info we need to call constructors
// before get_libdl_info().
- sonext = solist = get_libdl_info(kLinkerPath);
+ sonext = solist = get_libdl_info(kLinkerPath, linker_link_map);
g_default_namespace.add_soinfo(solist);
// We have successfully fixed our own relocations. It's safe to run
// the main part of the linker now.
args.abort_message_ptr = &g_abort_message;
- ElfW(Addr) start_address = __linker_init_post_relocation(args, linker_addr);
+ ElfW(Addr) start_address = __linker_init_post_relocation(args);
INFO("[ Jumping to _start (%p)... ]", reinterpret_cast<void*>(start_address));
diff --git a/linker/linker_soinfo.h b/linker/linker_soinfo.h
index 71eb543..29b5c2b 100644
--- a/linker/linker_soinfo.h
+++ b/linker/linker_soinfo.h
@@ -337,7 +337,7 @@
android_namespace_list_t secondary_namespaces_;
uintptr_t handle_;
- friend soinfo* get_libdl_info(const char* linker_path);
+ friend soinfo* get_libdl_info(const char* linker_path, const link_map& linker_map);
};
// This function is used by dlvsym() to calculate hash of sym_ver
diff --git a/tests/link_test.cpp b/tests/link_test.cpp
index ac3ccb9..a5430a9 100644
--- a/tests/link_test.cpp
+++ b/tests/link_test.cpp
@@ -46,9 +46,6 @@
void DoChecks(dl_phdr_info* info, size_t s) {
ASSERT_EQ(sizeof(dl_phdr_info), s);
- // TODO: why does the entry for the main executable have a null dlpi_addr and no name anyway?
- if (++count == 1 && info->dlpi_addr == 0) return;
-
ASSERT_TRUE(info->dlpi_name != nullptr);
// Find the first PT_LOAD program header so we can find the ELF header.