linker_cflags = [ "-fno-stack-protector", "-Wstrict-overflow=5", "-fvisibility=hidden", "-Wall", "-Wextra", "-Wunused", "-Werror", ] cc_binary { srcs: [ "debugger.cpp", "dlfcn.cpp", "linker.cpp", "linker_allocator.cpp", "linker_block_allocator.cpp", "linker_environ.cpp", "linker_libc_support.c", "linker_memory.cpp", "linker_phdr.cpp", "rt.cpp", ], arch: { arm: { srcs: ["arch/arm/begin.S"], }, arm64: { srcs: ["arch/arm64/begin.S"], }, x86: { srcs: ["arch/x86/begin.c"], }, x86_64: { srcs: ["arch/x86_64/begin.S"], }, mips: { srcs: [ "arch/mips/begin.S", "linker_mips.cpp", ], }, mips64: { srcs: [ "arch/mips64/begin.S", "linker_mips.cpp", ], }, }, // -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: linker_cflags, // TODO: split out the asflags. asflags: linker_cflags, target: { android64: { cflags: ["-DTARGET_IS_64_BIT"], }, }, // We need to access Bionic private headers in the linker. local_include_dirs: ["../libc/"], conlyflags: ["-std=gnu99"], cppflags: [ "-std=gnu++11", "-Wold-style-cast", ], // we don't want crtbegin.o (because we have begin.o), so unset it // just for this module nocrt: true, static_libs: [ "libc_nomalloc", "libziparchive", "libutils", "libz", "liblog", ], static_executable: true, name: "linker", multilib: { lib32: { stem: "linker", }, lib64: { stem: "linker64", }, }, compile_multilib: "both", // Leave the symbols in the shared library so that stack unwinders can // produce meaningful name resolution. strip: "keep_symbols", // 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_", } subdirs = ["tests"]