Enable libc/libdl/libm/linker for host bionic

Disables debuggerd integration unless building for android.

Bug: 31559095
Test: Diff out/soong/build.ninja before/after, only change is moving
      linker's libdebuggerd_client static lib to the beginning of the
      list.
Test: lunch aosp_arm64-eng; mmma -j bionic
Change-Id: I62e725f7a9b98b7fe31637d0a835fd5846b0aff0
This commit is contained in:
Dan Willemsen 2016-11-28 17:02:25 -08:00
parent 11b362d284
commit 7ec52b12ef
6 changed files with 22 additions and 3 deletions

View File

@ -55,6 +55,7 @@ libc_common_flags = [
// ========================================================
cc_defaults {
name: "libc_defaults",
defaults: ["linux_bionic_supported"],
cflags: libc_common_flags,
asflags: libc_common_flags,
conlyflags: ["-std=gnu99"],
@ -1770,6 +1771,7 @@ cc_library {
cc_defaults {
name: "crt_defaults",
defaults: ["linux_bionic_supported"],
no_default_compiler_flags: true,

View File

@ -134,8 +134,10 @@ static const char in6_loopback[] = {
};
#endif
#if defined(__ANDROID__)
// This should be synchronized to ResponseCode.h
static const int DnsProxyQueryResult = 222;
#endif
static const struct afd {
int a_af;
@ -399,6 +401,7 @@ bool readBE32(FILE* fp, int32_t* result) {
return true;
}
#if defined(__ANDROID__)
// Returns 0 on success, else returns on error.
static int
android_getaddrinfo_proxy(
@ -555,6 +558,7 @@ exit:
}
return EAI_NODATA;
}
#endif
int
getaddrinfo(const char *hostname, const char *servname,

View File

@ -2,6 +2,9 @@
// libdl
//
cc_library {
name: "libdl",
defaults: ["linux_bionic_supported"],
// NOTE: --exclude-libs=libgcc.a makes sure that any symbols libdl.so pulls from
// libgcc.a are made static to libdl.so. This in turn ensures that libraries that
@ -46,8 +49,6 @@ cc_library {
],
stl: "none",
name: "libdl",
// NOTE: libdl needs __aeabi_unwind_cpp_pr0 from libgcc.a but libgcc.a needs a
// few symbols from libc. Using --no-undefined here results in having to link
// against libc creating a circular dependency which is removed and we end up

View File

@ -5,6 +5,7 @@ bionic_coverage = false
//
cc_library {
name: "libm",
defaults: ["linux_bionic_supported"],
srcs: [
"upstream-freebsd/lib/msun/bsdsrc/b_exp.c",

View File

@ -1,6 +1,7 @@
cc_library_static {
name: "liblinker_malloc",
clang: true,
defaults: ["linux_bionic_supported"],
srcs: [
"linker_allocator.cpp",
@ -13,6 +14,7 @@ cc_library_static {
cc_binary {
clang: true,
defaults: ["linux_bionic_supported"],
srcs: [
"dlfcn.cpp",
@ -112,7 +114,6 @@ cc_binary {
"libbase",
"libz",
"liblog",
"libdebuggerd_client",
// Important: The liblinker_malloc should be the last library in the list
// to overwrite any other malloc implementations by other static libraries.
@ -131,9 +132,15 @@ cc_binary {
},
},
target: {
android: {
static_libs: ["libdebuggerd_client"],
},
android64: {
cflags: ["-DTARGET_IS_64_BIT"],
},
linux_bionic: {
cflags: ["-DTARGET_IS_64_BIT"],
},
},
compile_multilib: "both",

View File

@ -40,7 +40,9 @@
#include "android-base/strings.h"
#include "android-base/stringprintf.h"
#ifdef __ANDROID__
#include "debuggerd/client.h"
#endif
#include <vector>
@ -217,6 +219,7 @@ static ElfW(Addr) __linker_init_post_relocation(KernelArgumentBlock& args, ElfW(
__system_properties_init(); // may use 'environ'
// Register the debuggerd signal handler.
#ifdef __ANDROID__
debuggerd_callbacks_t callbacks = {
.get_abort_message = []() {
return g_abort_message;
@ -224,6 +227,7 @@ static ElfW(Addr) __linker_init_post_relocation(KernelArgumentBlock& args, ElfW(
.post_dump = &notify_gdb_of_libraries,
};
debuggerd_init(&callbacks);
#endif
g_linker_logger.ResetState();