blob: 989b0d2bff29ad310f13ccfab66953530c4a69d6 [file] [log] [blame]
Elliott Hughes88b44fe2014-04-01 11:41:36 -07001LOCAL_PATH := $(call my-dir)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08002
Colin Cross406a75d2014-03-27 10:45:57 -07003include $(CLEAR_VARS)
Colin Cross36ee4ab2014-02-12 21:58:47 -08004
Colin Cross406a75d2014-03-27 10:45:57 -07005LOCAL_SRC_FILES:= \
6 debugger.cpp \
7 dlfcn.cpp \
8 linker.cpp \
Dmitriy Ivanovd597d262014-05-05 16:49:04 -07009 linker_allocator.cpp \
Colin Cross406a75d2014-03-27 10:45:57 -070010 linker_environ.cpp \
Dmitriy Ivanov14241402014-08-26 14:16:52 -070011 linker_libc_support.c \
Colin Cross406a75d2014-03-27 10:45:57 -070012 linker_phdr.cpp \
13 rt.cpp \
14
15LOCAL_SRC_FILES_arm := arch/arm/begin.S
16LOCAL_SRC_FILES_arm64 := arch/arm64/begin.S
17LOCAL_SRC_FILES_x86 := arch/x86/begin.c
18LOCAL_SRC_FILES_x86_64 := arch/x86_64/begin.S
Dmitriy Ivanov114ff692015-01-14 11:36:38 -080019LOCAL_SRC_FILES_mips := arch/mips/begin.S linker_mips.cpp
20LOCAL_SRC_FILES_mips64 := arch/mips64/begin.S linker_mips.cpp
Colin Cross406a75d2014-03-27 10:45:57 -070021
Chih-Hung Hsieh306ea7e2015-01-22 14:05:15 -080022# -shared is used to overwrite the -Bstatic and -static
23# flags triggered by LOCAL_FORCE_STATIC_EXECUTABLE.
24# This dynamic linker is actually a shared object linked with static libraries.
Colin Cross406a75d2014-03-27 10:45:57 -070025LOCAL_LDFLAGS := \
26 -shared \
27 -Wl,-Bsymbolic \
28 -Wl,--exclude-libs,ALL \
29
30LOCAL_CFLAGS += \
31 -fno-stack-protector \
32 -Wstrict-overflow=5 \
33 -fvisibility=hidden \
Elliott Hughesd2867962014-06-03 15:22:34 -070034 -Wall -Wextra -Wunused -Werror \
Colin Cross406a75d2014-03-27 10:45:57 -070035
36LOCAL_CONLYFLAGS += \
37 -std=gnu99 \
38
39LOCAL_CPPFLAGS += \
40 -std=gnu++11 \
41
Christopher Ferris151da682015-01-19 11:16:52 -080042ifeq ($(TARGET_IS_64_BIT),true)
43LOCAL_CPPFLAGS += -DTARGET_IS_64_BIT
44endif
45
Colin Cross406a75d2014-03-27 10:45:57 -070046# We need to access Bionic private headers in the linker.
47LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/
48
49# we don't want crtbegin.o (because we have begin.o), so unset it
50# just for this module
51LOCAL_NO_CRT := true
52# TODO: split out the asflags.
53LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
54
Ying Wangf9e147b2014-09-05 15:42:12 -070055LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Colin Cross406a75d2014-03-27 10:45:57 -070056
57LOCAL_STATIC_LIBRARIES := libc_nomalloc
58
Ying Wangf9e147b2014-09-05 15:42:12 -070059LOCAL_FORCE_STATIC_EXECUTABLE := true
Colin Cross406a75d2014-03-27 10:45:57 -070060
61LOCAL_MODULE := linker
62LOCAL_MODULE_STEM_32 := linker
63LOCAL_MODULE_STEM_64 := linker64
64LOCAL_MULTILIB := both
65
Dmitriy Ivanovad5e8b52014-08-14 15:46:36 -070066# Leave the symbols in the shared library so that stack unwinders can produce
67# meaningful name resolution.
68LOCAL_STRIP_MODULE := keep_symbols
69
Ying Wangf9e147b2014-09-05 15:42:12 -070070# Insert an extra objcopy step to add prefix to symbols.
71# Note we are using "=" instead of ":=" to defer the evaluation,
72# because LOCAL_2ND_ARCH_VAR_PREFIX or linked_module isn't set properly yet at this point.
73LOCAL_POST_LINK_CMD = $(hide) $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJCOPY) \
74 --prefix-symbols=__dl_ $(linked_module)
75
76include $(BUILD_EXECUTABLE)
Dmitriy Ivanovd597d262014-05-05 16:49:04 -070077
78include $(call first-makefiles-under,$(LOCAL_PATH))