2016-07-15 01:05:46 +02:00
|
|
|
cc_library_static {
|
|
|
|
name: "liblinker_malloc",
|
2016-11-29 02:02:25 +01:00
|
|
|
defaults: ["linux_bionic_supported"],
|
2016-07-15 01:05:46 +02:00
|
|
|
|
|
|
|
srcs: [
|
|
|
|
"linker_allocator.cpp",
|
|
|
|
"linker_memory.cpp",
|
|
|
|
],
|
|
|
|
|
|
|
|
// We need to access Bionic private headers in the linker.
|
|
|
|
include_dirs: ["bionic/libc"],
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_binary {
|
2016-11-29 02:02:25 +01:00
|
|
|
defaults: ["linux_bionic_supported"],
|
2016-07-15 01:05:46 +02:00
|
|
|
srcs: [
|
|
|
|
"dlfcn.cpp",
|
|
|
|
"linker.cpp",
|
|
|
|
"linker_block_allocator.cpp",
|
2016-07-21 20:33:40 +02:00
|
|
|
"linker_dlwarning.cpp",
|
2016-07-06 22:20:59 +02:00
|
|
|
"linker_cfi.cpp",
|
2016-07-15 01:05:46 +02:00
|
|
|
"linker_gdb_support.cpp",
|
2016-08-04 20:50:36 +02:00
|
|
|
"linker_globals.cpp",
|
2016-07-15 01:05:46 +02:00
|
|
|
"linker_libc_support.c",
|
2017-01-27 01:52:59 +01:00
|
|
|
"linker_libcxx_support.cpp",
|
2016-09-09 19:00:39 +02:00
|
|
|
"linker_main.cpp",
|
2016-08-04 01:00:10 +02:00
|
|
|
"linker_namespaces.cpp",
|
2016-07-15 01:05:46 +02:00
|
|
|
"linker_logger.cpp",
|
|
|
|
"linker_mapped_file_fragment.cpp",
|
|
|
|
"linker_phdr.cpp",
|
|
|
|
"linker_sdk_versions.cpp",
|
2016-08-04 20:50:36 +02:00
|
|
|
"linker_soinfo.cpp",
|
2016-07-15 01:05:46 +02:00
|
|
|
"linker_utils.cpp",
|
|
|
|
"rt.cpp",
|
|
|
|
],
|
|
|
|
|
|
|
|
arch: {
|
|
|
|
arm: {
|
|
|
|
srcs: ["arch/arm/begin.S"],
|
|
|
|
|
|
|
|
cflags: ["-D__work_around_b_24465209__"],
|
2017-02-23 20:53:43 +01:00
|
|
|
ldflags: ["-Wl,-dynamic-linker,/system/bin/linker"],
|
2016-07-15 01:05:46 +02:00
|
|
|
},
|
|
|
|
arm64: {
|
|
|
|
srcs: ["arch/arm64/begin.S"],
|
2017-02-23 20:53:43 +01:00
|
|
|
ldflags: ["-Wl,-dynamic-linker,/system/bin/linker64"],
|
2016-07-15 01:05:46 +02:00
|
|
|
},
|
|
|
|
x86: {
|
|
|
|
srcs: ["arch/x86/begin.c"],
|
|
|
|
|
|
|
|
cflags: ["-D__work_around_b_24465209__"],
|
2017-02-23 20:53:43 +01:00
|
|
|
ldflags: ["-Wl,-dynamic-linker,/system/bin/linker"],
|
2016-07-15 01:05:46 +02:00
|
|
|
},
|
|
|
|
x86_64: {
|
|
|
|
srcs: ["arch/x86_64/begin.S"],
|
2017-02-23 20:53:43 +01:00
|
|
|
ldflags: ["-Wl,-dynamic-linker,/system/bin/linker64"],
|
2016-07-15 01:05:46 +02:00
|
|
|
},
|
|
|
|
mips: {
|
|
|
|
srcs: [
|
|
|
|
"arch/mips/begin.S",
|
|
|
|
"linker_mips.cpp",
|
|
|
|
],
|
2017-02-23 20:53:43 +01:00
|
|
|
ldflags: ["-Wl,-dynamic-linker,/system/bin/linker"],
|
2016-07-15 01:05:46 +02:00
|
|
|
},
|
|
|
|
mips64: {
|
|
|
|
srcs: [
|
|
|
|
"arch/mips64/begin.S",
|
|
|
|
"linker_mips.cpp",
|
|
|
|
],
|
2017-02-23 20:53:43 +01:00
|
|
|
ldflags: ["-Wl,-dynamic-linker,/system/bin/linker64"],
|
2016-07-15 01:05:46 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// We need to access Bionic private headers in the linker.
|
|
|
|
include_dirs: ["bionic/libc"],
|
|
|
|
|
|
|
|
// -shared is used to overwrite the -Bstatic and -static
|
|
|
|
// flags triggered by LOCAL_FORCE_STATIC_EXECUTABLE.
|
|
|
|
// This dynamic linker is actually a shared object linked with static libraries.
|
|
|
|
ldflags: [
|
|
|
|
"-shared",
|
|
|
|
"-Wl,-Bsymbolic",
|
|
|
|
"-Wl,--exclude-libs,ALL",
|
|
|
|
],
|
|
|
|
|
|
|
|
cflags: [
|
|
|
|
"-fno-stack-protector",
|
|
|
|
"-Wstrict-overflow=5",
|
|
|
|
"-fvisibility=hidden",
|
|
|
|
"-Wall",
|
|
|
|
"-Wextra",
|
|
|
|
"-Wunused",
|
|
|
|
"-Werror",
|
|
|
|
],
|
|
|
|
|
|
|
|
// TODO: split out the asflags.
|
|
|
|
asflags: [
|
|
|
|
"-fno-stack-protector",
|
|
|
|
"-Wstrict-overflow=5",
|
|
|
|
"-fvisibility=hidden",
|
|
|
|
"-Wall",
|
|
|
|
"-Wextra",
|
|
|
|
"-Wunused",
|
|
|
|
"-Werror",
|
|
|
|
],
|
|
|
|
|
|
|
|
cppflags: ["-Wold-style-cast"],
|
|
|
|
|
2016-12-06 20:10:09 +01:00
|
|
|
// we are going to link libc++_static manually because
|
|
|
|
// when stl is not set to "none" build system adds libdl
|
|
|
|
// to the list of static libraries which needs to be
|
|
|
|
// avoided in the case of building loader.
|
|
|
|
stl: "none",
|
|
|
|
|
2016-07-15 01:05:46 +02:00
|
|
|
// we don't want crtbegin.o (because we have begin.o), so unset it
|
|
|
|
// just for this module
|
|
|
|
nocrt: true,
|
|
|
|
|
|
|
|
static_libs: [
|
|
|
|
"libc_nomalloc",
|
2017-01-27 01:52:59 +01:00
|
|
|
"libm",
|
2016-07-15 01:05:46 +02:00
|
|
|
"libziparchive",
|
|
|
|
"libutils",
|
|
|
|
"libbase",
|
|
|
|
"libz",
|
2017-02-09 02:27:20 +01:00
|
|
|
|
|
|
|
"libdebuggerd_handler_core",
|
|
|
|
"libdebuggerd_handler_fallback",
|
|
|
|
"libdebuggerd",
|
|
|
|
"libbacktrace",
|
|
|
|
"libunwind",
|
|
|
|
"liblzma",
|
|
|
|
"libcutils",
|
|
|
|
|
2016-07-15 01:05:46 +02:00
|
|
|
"liblog",
|
2016-12-06 20:10:09 +01:00
|
|
|
"libc++_static",
|
2016-07-15 01:05:46 +02:00
|
|
|
|
|
|
|
// Important: The liblinker_malloc should be the last library in the list
|
|
|
|
// to overwrite any other malloc implementations by other static libraries.
|
|
|
|
"liblinker_malloc"
|
|
|
|
],
|
|
|
|
static_executable: true,
|
|
|
|
|
|
|
|
name: "linker",
|
2016-12-08 18:57:35 +01:00
|
|
|
symlinks: ["linker_asan"],
|
2016-07-15 01:05:46 +02:00
|
|
|
multilib: {
|
|
|
|
lib64: {
|
|
|
|
suffix: "64",
|
2016-12-08 18:57:35 +01:00
|
|
|
},
|
2016-07-15 01:05:46 +02:00
|
|
|
},
|
|
|
|
target: {
|
2016-11-29 02:02:25 +01:00
|
|
|
android: {
|
|
|
|
static_libs: ["libdebuggerd_client"],
|
|
|
|
},
|
2016-07-15 01:05:46 +02:00
|
|
|
android64: {
|
|
|
|
cflags: ["-DTARGET_IS_64_BIT"],
|
|
|
|
},
|
2016-11-29 02:02:25 +01:00
|
|
|
linux_bionic: {
|
|
|
|
cflags: ["-DTARGET_IS_64_BIT"],
|
|
|
|
},
|
2016-07-15 01:05:46 +02:00
|
|
|
},
|
|
|
|
compile_multilib: "both",
|
|
|
|
|
|
|
|
// Leave the symbols in the shared library so that stack unwinders can produce
|
|
|
|
// meaningful name resolution.
|
|
|
|
strip: {
|
|
|
|
keep_symbols: true,
|
|
|
|
},
|
|
|
|
|
|
|
|
// Insert an extra objcopy step to add prefix to symbols. This is needed to prevent gdb
|
|
|
|
// looking up symbols in the linker by mistake.
|
|
|
|
prefix_symbols: "__dl_",
|
|
|
|
}
|