blob: d6e0095757d0df30255b8f9f86d9984e0d3d261f [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
19LOCAL_SRC_FILES_mips := arch/mips/begin.S
Chris Dearman9d98ee12014-06-12 17:49:04 -070020LOCAL_SRC_FILES_mips64 := arch/mips64/begin.S
Colin Cross406a75d2014-03-27 10:45:57 -070021
22LOCAL_LDFLAGS := \
23 -shared \
24 -Wl,-Bsymbolic \
25 -Wl,--exclude-libs,ALL \
26
27LOCAL_CFLAGS += \
28 -fno-stack-protector \
29 -Wstrict-overflow=5 \
30 -fvisibility=hidden \
Elliott Hughesd2867962014-06-03 15:22:34 -070031 -Wall -Wextra -Wunused -Werror \
Colin Cross406a75d2014-03-27 10:45:57 -070032
33LOCAL_CONLYFLAGS += \
34 -std=gnu99 \
35
36LOCAL_CPPFLAGS += \
37 -std=gnu++11 \
38
39# We need to access Bionic private headers in the linker.
40LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/
41
42# we don't want crtbegin.o (because we have begin.o), so unset it
43# just for this module
44LOCAL_NO_CRT := true
45# TODO: split out the asflags.
46LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
47
Ying Wangf9e147b2014-09-05 15:42:12 -070048LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Colin Cross406a75d2014-03-27 10:45:57 -070049
50LOCAL_STATIC_LIBRARIES := libc_nomalloc
51
Ying Wangf9e147b2014-09-05 15:42:12 -070052LOCAL_FORCE_STATIC_EXECUTABLE := true
Colin Cross406a75d2014-03-27 10:45:57 -070053
54LOCAL_MODULE := linker
55LOCAL_MODULE_STEM_32 := linker
56LOCAL_MODULE_STEM_64 := linker64
57LOCAL_MULTILIB := both
58
Dmitriy Ivanovad5e8b52014-08-14 15:46:36 -070059# Leave the symbols in the shared library so that stack unwinders can produce
60# meaningful name resolution.
61LOCAL_STRIP_MODULE := keep_symbols
62
Ying Wangf9e147b2014-09-05 15:42:12 -070063# 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.
66LOCAL_POST_LINK_CMD = $(hide) $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJCOPY) \
67 --prefix-symbols=__dl_ $(linked_module)
68
69include $(BUILD_EXECUTABLE)
Dmitriy Ivanovd597d262014-05-05 16:49:04 -070070
71include $(call first-makefiles-under,$(LOCAL_PATH))