blob: cc7fadf816f959fa62032656dabfb1bff5b0225d [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
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 \
Dmitriy Ivanov1649e7e2015-01-22 16:04:25 -080038 -Wold-style-cast \
Colin Cross406a75d2014-03-27 10:45:57 -070039
Christopher Ferris151da682015-01-19 11:16:52 -080040ifeq ($(TARGET_IS_64_BIT),true)
41LOCAL_CPPFLAGS += -DTARGET_IS_64_BIT
42endif
43
Colin Cross406a75d2014-03-27 10:45:57 -070044# We need to access Bionic private headers in the linker.
45LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/
46
47# we don't want crtbegin.o (because we have begin.o), so unset it
48# just for this module
49LOCAL_NO_CRT := true
50# TODO: split out the asflags.
51LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
52
Ying Wangf9e147b2014-09-05 15:42:12 -070053LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Colin Cross406a75d2014-03-27 10:45:57 -070054
55LOCAL_STATIC_LIBRARIES := libc_nomalloc
56
Ying Wangf9e147b2014-09-05 15:42:12 -070057LOCAL_FORCE_STATIC_EXECUTABLE := true
Colin Cross406a75d2014-03-27 10:45:57 -070058
59LOCAL_MODULE := linker
60LOCAL_MODULE_STEM_32 := linker
61LOCAL_MODULE_STEM_64 := linker64
62LOCAL_MULTILIB := both
63
Dmitriy Ivanovad5e8b52014-08-14 15:46:36 -070064# Leave the symbols in the shared library so that stack unwinders can produce
65# meaningful name resolution.
66LOCAL_STRIP_MODULE := keep_symbols
67
Ying Wangf9e147b2014-09-05 15:42:12 -070068# Insert an extra objcopy step to add prefix to symbols.
69# Note we are using "=" instead of ":=" to defer the evaluation,
70# because LOCAL_2ND_ARCH_VAR_PREFIX or linked_module isn't set properly yet at this point.
71LOCAL_POST_LINK_CMD = $(hide) $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJCOPY) \
72 --prefix-symbols=__dl_ $(linked_module)
73
74include $(BUILD_EXECUTABLE)
Dmitriy Ivanovd597d262014-05-05 16:49:04 -070075
76include $(call first-makefiles-under,$(LOCAL_PATH))