1 LOCAL_PATH := $(call my-dir)
3 include $(CLEAR_VARS)
5 LOCAL_SRC_FILES:= \
6 debugger.cpp \
7 dlfcn.cpp \
8 linker.cpp \
9 linker_allocator.cpp \
10 linker_environ.cpp \
11 linker_libc_support.c \
12 linker_phdr.cpp \
13 rt.cpp \
15 LOCAL_SRC_FILES_arm := arch/arm/begin.S
16 LOCAL_SRC_FILES_arm64 := arch/arm64/begin.S
17 LOCAL_SRC_FILES_x86 := arch/x86/begin.c
18 LOCAL_SRC_FILES_x86_64 := arch/x86_64/begin.S
19 LOCAL_SRC_FILES_mips := arch/mips/begin.S
20 LOCAL_SRC_FILES_mips64 := arch/mips64/begin.S
22 LOCAL_LDFLAGS := \
23 -shared \
24 -Wl,-Bsymbolic \
25 -Wl,--exclude-libs,ALL \
27 LOCAL_CFLAGS += \
28 -fno-stack-protector \
29 -Wstrict-overflow=5 \
30 -fvisibility=hidden \
31 -Wall -Wextra -Wunused -Werror \
33 LOCAL_CONLYFLAGS += \
34 -std=gnu99 \
36 LOCAL_CPPFLAGS += \
37 -std=gnu++11 \
39 # We need to access Bionic private headers in the linker.
40 LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/
42 # we don't want crtbegin.o (because we have begin.o), so unset it
43 # just for this module
44 LOCAL_NO_CRT := true
45 # TODO: split out the asflags.
46 LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
48 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
50 LOCAL_STATIC_LIBRARIES := libc_nomalloc
52 LOCAL_FORCE_STATIC_EXECUTABLE := true
54 LOCAL_MODULE := linker
55 LOCAL_MODULE_STEM_32 := linker
56 LOCAL_MODULE_STEM_64 := linker64
57 LOCAL_MULTILIB := both
59 # Leave the symbols in the shared library so that stack unwinders can produce
60 # meaningful name resolution.
61 LOCAL_STRIP_MODULE := keep_symbols
63 # Insert an extra objcopy step to add prefix to symbols.
64 # Note we are using "=" instead of ":=" to defer the evaluation,
65 # because LOCAL_2ND_ARCH_VAR_PREFIX or linked_module isn't set properly yet at this point.
66 LOCAL_POST_LINK_CMD = $(hide) $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJCOPY) \
67 --prefix-symbols=__dl_ $(linked_module)
69 include $(BUILD_EXECUTABLE)
71 include $(call first-makefiles-under,$(LOCAL_PATH))