blob: 0383e7b7e395213e311109a107d4abeee0761d81 [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
Chih-Hung Hsieh6f96d582014-12-18 17:10:56 -080022# GNU assembler aborted with clang's output for linker.cpp:
23# Assertion failure in get_line_subseg at
24# /s/ndk-toolchain/src/build/../binutils/binutils-2.24/gas/dwarf2dbg.c line 271.
25ifeq ($(TARGET_ARCH),mips)
26 LOCAL_CLANG_CFLAGS += -integrated-as
27endif
28
Colin Cross406a75d2014-03-27 10:45:57 -070029LOCAL_LDFLAGS := \
30 -shared \
31 -Wl,-Bsymbolic \
32 -Wl,--exclude-libs,ALL \
33
34LOCAL_CFLAGS += \
35 -fno-stack-protector \
36 -Wstrict-overflow=5 \
37 -fvisibility=hidden \
Elliott Hughesd2867962014-06-03 15:22:34 -070038 -Wall -Wextra -Wunused -Werror \
Colin Cross406a75d2014-03-27 10:45:57 -070039
40LOCAL_CONLYFLAGS += \
41 -std=gnu99 \
42
43LOCAL_CPPFLAGS += \
44 -std=gnu++11 \
45
46# 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))