The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 1 | LOCAL_PATH:= $(call my-dir) |
| 2 | include $(CLEAR_VARS) |
| 3 | |
Pavel Chupin | 20c4a3a | 2012-11-28 18:31:14 +0400 | [diff] [blame] | 4 | ifeq ($(TARGET_ARCH),x86) |
| 5 | linker_begin_extension := c |
| 6 | else |
| 7 | linker_begin_extension := S |
| 8 | endif |
| 9 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 10 | LOCAL_SRC_FILES:= \ |
Elliott Hughes | e66190d | 2012-12-18 15:57:55 -0800 | [diff] [blame] | 11 | arch/$(TARGET_ARCH)/begin.$(linker_begin_extension) \ |
| 12 | debugger.cpp \ |
| 13 | dlfcn.cpp \ |
| 14 | linker.cpp \ |
| 15 | linker_environ.cpp \ |
Elliott Hughes | e66190d | 2012-12-18 15:57:55 -0800 | [diff] [blame] | 16 | linker_phdr.cpp \ |
Elliott Hughes | d7398f1 | 2013-10-08 10:05:05 -0700 | [diff] [blame] | 17 | rt.cpp \ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 18 | |
Nick Kralevich | d89ce40 | 2013-01-16 16:43:15 -0800 | [diff] [blame] | 19 | LOCAL_LDFLAGS := -shared -Wl,--exclude-libs,ALL |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 20 | |
Elliott Hughes | 2258347 | 2013-10-17 13:06:20 -0700 | [diff] [blame] | 21 | LOCAL_CFLAGS += \ |
| 22 | -fno-stack-protector \ |
| 23 | -Wstrict-overflow=5 \ |
| 24 | -fvisibility=hidden \ |
| 25 | -Wall -Wextra -Werror \ |
| 26 | |
| 27 | LOCAL_CONLYFLAGS += \ |
| 28 | -std=gnu99 \ |
| 29 | |
| 30 | LOCAL_CPPFLAGS += \ |
| 31 | -std=gnu++11 \ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 32 | |
Elliott Hughes | 91a9925 | 2013-02-12 21:56:42 -0800 | [diff] [blame] | 33 | # We need to access Bionic private headers in the linker. |
Elliott Hughes | 4688279 | 2012-08-03 16:49:39 -0700 | [diff] [blame] | 34 | LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/ |
| 35 | |
Marcus Oakland | e365f9d | 2013-10-10 15:19:31 +0100 | [diff] [blame] | 36 | ifeq ($(TARGET_IS_64_BIT),true) |
Elliott Hughes | d7398f1 | 2013-10-08 10:05:05 -0700 | [diff] [blame] | 37 | LOCAL_MODULE := linker64 |
| 38 | else |
| 39 | LOCAL_MODULE := linker |
| 40 | endif |
| 41 | |
Elliott Hughes | ae5c644 | 2012-08-13 14:06:05 -0700 | [diff] [blame] | 42 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 43 | |
David 'Digit' Turner | 8bff9a3 | 2010-06-10 18:29:33 -0700 | [diff] [blame] | 44 | LOCAL_STATIC_LIBRARIES := libc_nomalloc |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 45 | |
| 46 | #LOCAL_FORCE_STATIC_EXECUTABLE := true # not necessary when not including BUILD_EXECUTABLE |
| 47 | |
| 48 | # |
| 49 | # include $(BUILD_EXECUTABLE) |
| 50 | # |
| 51 | # Instead of including $(BUILD_EXECUTABLE), we execute the steps to create an executable by |
| 52 | # hand, as we want to insert an extra step that is not supported by the build system, and |
| 53 | # is probably specific the linker only, so there's no need to modify the build system for |
| 54 | # the purpose. |
| 55 | |
| 56 | LOCAL_MODULE_CLASS := EXECUTABLES |
| 57 | LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX) |
| 58 | |
Nick Kralevich | 7939908 | 2011-11-04 10:11:26 -0700 | [diff] [blame] | 59 | # we don't want crtbegin.o (because we have begin.o), so unset it |
| 60 | # just for this module |
| 61 | LOCAL_NO_CRT := true |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 62 | |
Ying Wang | c97c5fc | 2012-08-11 14:23:19 -0700 | [diff] [blame] | 63 | # TODO: split out the asflags. |
| 64 | LOCAL_ASFLAGS := $(LOCAL_CFLAGS) |
| 65 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 66 | include $(BUILD_SYSTEM)/dynamic_binary.mk |
| 67 | |
Ying Wang | f680b0f | 2012-09-25 18:32:24 -0700 | [diff] [blame] | 68 | # See build/core/executable.mk |
| 69 | $(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(TARGET_GLOBAL_LD_DIRS) |
| 70 | $(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(TARGET_GLOBAL_LDFLAGS) |
| 71 | $(linked_module): PRIVATE_TARGET_FDO_LIB := $(TARGET_FDO_LIB) |
| 72 | $(linked_module): PRIVATE_TARGET_LIBGCC := $(TARGET_LIBGCC) |
| 73 | $(linked_module): PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_CRTBEGIN_DYNAMIC_O) |
| 74 | $(linked_module): PRIVATE_TARGET_CRTBEGIN_STATIC_O := $(TARGET_CRTBEGIN_STATIC_O) |
| 75 | $(linked_module): PRIVATE_TARGET_CRTEND_O := $(TARGET_CRTEND_O) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 76 | $(linked_module): $(TARGET_CRTBEGIN_STATIC_O) $(all_objects) $(all_libraries) $(TARGET_CRTEND_O) |
| 77 | $(transform-o-to-static-executable) |
| 78 | @echo "target PrefixSymbols: $(PRIVATE_MODULE) ($@)" |
| 79 | $(hide) $(TARGET_OBJCOPY) --prefix-symbols=__dl_ $@ |
| 80 | |
| 81 | # |
| 82 | # end of BUILD_EXECUTABLE hack |
| 83 | # |