Elliott Hughes | 88b44fe | 2014-04-01 11:41:36 -0700 | [diff] [blame] | 1 | LOCAL_PATH := $(call my-dir) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 2 | |
Colin Cross | 406a75d | 2014-03-27 10:45:57 -0700 | [diff] [blame] | 3 | include $(CLEAR_VARS) |
Colin Cross | 36ee4ab | 2014-02-12 21:58:47 -0800 | [diff] [blame] | 4 | |
Colin Cross | 406a75d | 2014-03-27 10:45:57 -0700 | [diff] [blame] | 5 | LOCAL_SRC_FILES:= \ |
| 6 | debugger.cpp \ |
| 7 | dlfcn.cpp \ |
| 8 | linker.cpp \ |
Dmitriy Ivanov | d597d26 | 2014-05-05 16:49:04 -0700 | [diff] [blame] | 9 | linker_allocator.cpp \ |
Colin Cross | 406a75d | 2014-03-27 10:45:57 -0700 | [diff] [blame] | 10 | linker_environ.cpp \ |
Dmitriy Ivanov | 1424140 | 2014-08-26 14:16:52 -0700 | [diff] [blame] | 11 | linker_libc_support.c \ |
Colin Cross | 406a75d | 2014-03-27 10:45:57 -0700 | [diff] [blame] | 12 | linker_phdr.cpp \ |
| 13 | rt.cpp \ |
| 14 | |
| 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 |
Chris Dearman | 9d98ee1 | 2014-06-12 17:49:04 -0700 | [diff] [blame] | 20 | LOCAL_SRC_FILES_mips64 := arch/mips64/begin.S |
Colin Cross | 406a75d | 2014-03-27 10:45:57 -0700 | [diff] [blame] | 21 | |
| 22 | LOCAL_LDFLAGS := \ |
| 23 | -shared \ |
| 24 | -Wl,-Bsymbolic \ |
| 25 | -Wl,--exclude-libs,ALL \ |
| 26 | |
| 27 | LOCAL_CFLAGS += \ |
| 28 | -fno-stack-protector \ |
| 29 | -Wstrict-overflow=5 \ |
| 30 | -fvisibility=hidden \ |
Elliott Hughes | d286796 | 2014-06-03 15:22:34 -0700 | [diff] [blame] | 31 | -Wall -Wextra -Wunused -Werror \ |
Colin Cross | 406a75d | 2014-03-27 10:45:57 -0700 | [diff] [blame] | 32 | |
| 33 | LOCAL_CONLYFLAGS += \ |
| 34 | -std=gnu99 \ |
| 35 | |
| 36 | LOCAL_CPPFLAGS += \ |
| 37 | -std=gnu++11 \ |
| 38 | |
| 39 | # We need to access Bionic private headers in the linker. |
| 40 | LOCAL_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 |
| 44 | LOCAL_NO_CRT := true |
| 45 | # TODO: split out the asflags. |
| 46 | LOCAL_ASFLAGS := $(LOCAL_CFLAGS) |
| 47 | |
Ying Wang | f9e147b | 2014-09-05 15:42:12 -0700 | [diff] [blame] | 48 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Colin Cross | 406a75d | 2014-03-27 10:45:57 -0700 | [diff] [blame] | 49 | |
| 50 | LOCAL_STATIC_LIBRARIES := libc_nomalloc |
| 51 | |
Ying Wang | f9e147b | 2014-09-05 15:42:12 -0700 | [diff] [blame] | 52 | LOCAL_FORCE_STATIC_EXECUTABLE := true |
Colin Cross | 406a75d | 2014-03-27 10:45:57 -0700 | [diff] [blame] | 53 | |
| 54 | LOCAL_MODULE := linker |
| 55 | LOCAL_MODULE_STEM_32 := linker |
| 56 | LOCAL_MODULE_STEM_64 := linker64 |
| 57 | LOCAL_MULTILIB := both |
| 58 | |
Dmitriy Ivanov | ad5e8b5 | 2014-08-14 15:46:36 -0700 | [diff] [blame] | 59 | # Leave the symbols in the shared library so that stack unwinders can produce |
| 60 | # meaningful name resolution. |
| 61 | LOCAL_STRIP_MODULE := keep_symbols |
| 62 | |
Ying Wang | f9e147b | 2014-09-05 15:42:12 -0700 | [diff] [blame] | 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) |
| 68 | |
| 69 | include $(BUILD_EXECUTABLE) |
Dmitriy Ivanov | d597d26 | 2014-05-05 16:49:04 -0700 | [diff] [blame] | 70 | |
| 71 | include $(call first-makefiles-under,$(LOCAL_PATH)) |