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 \ |
| 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 | |
Nick Kralevich | 3a7ea52 | 2012-04-04 10:18:27 -0700 | [diff] [blame] | 21 | LOCAL_CFLAGS += -fno-stack-protector \ |
| 22 | -Wstrict-overflow=5 \ |
Elliott Hughes | 856512e | 2012-07-16 09:43:14 -0700 | [diff] [blame] | 23 | -fvisibility=hidden \ |
Elliott Hughes | e66190d | 2012-12-18 15:57:55 -0800 | [diff] [blame] | 24 | -Wall -Wextra -Werror |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 25 | |
Elliott Hughes | 91a9925 | 2013-02-12 21:56:42 -0800 | [diff] [blame] | 26 | # We need to access Bionic private headers in the linker. |
Elliott Hughes | 4688279 | 2012-08-03 16:49:39 -0700 | [diff] [blame] | 27 | LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/ |
| 28 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 29 | ifeq ($(TARGET_ARCH),arm) |
Raghu Gandham | d7daacb | 2012-07-31 12:07:22 -0700 | [diff] [blame] | 30 | LOCAL_CFLAGS += -DANDROID_ARM_LINKER |
| 31 | endif |
| 32 | |
| 33 | ifeq ($(TARGET_ARCH),x86) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 34 | LOCAL_CFLAGS += -DANDROID_X86_LINKER |
Raghu Gandham | d7daacb | 2012-07-31 12:07:22 -0700 | [diff] [blame] | 35 | endif |
| 36 | |
| 37 | ifeq ($(TARGET_ARCH),mips) |
| 38 | LOCAL_CFLAGS += -DANDROID_MIPS_LINKER |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 39 | endif |
| 40 | |
| 41 | LOCAL_MODULE:= linker |
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 | |
| 63 | include $(BUILD_SYSTEM)/dynamic_binary.mk |
| 64 | |
Ying Wang | b04598a | 2012-09-25 18:32:24 -0700 | [diff] [blame] | 65 | # See build/core/executable.mk |
| 66 | $(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(TARGET_GLOBAL_LD_DIRS) |
| 67 | $(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(TARGET_GLOBAL_LDFLAGS) |
| 68 | $(linked_module): PRIVATE_TARGET_FDO_LIB := $(TARGET_FDO_LIB) |
| 69 | $(linked_module): PRIVATE_TARGET_LIBGCC := $(TARGET_LIBGCC) |
| 70 | $(linked_module): PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_CRTBEGIN_DYNAMIC_O) |
| 71 | $(linked_module): PRIVATE_TARGET_CRTBEGIN_STATIC_O := $(TARGET_CRTBEGIN_STATIC_O) |
| 72 | $(linked_module): PRIVATE_TARGET_CRTEND_O := $(TARGET_CRTEND_O) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 73 | $(linked_module): $(TARGET_CRTBEGIN_STATIC_O) $(all_objects) $(all_libraries) $(TARGET_CRTEND_O) |
| 74 | $(transform-o-to-static-executable) |
| 75 | @echo "target PrefixSymbols: $(PRIVATE_MODULE) ($@)" |
| 76 | $(hide) $(TARGET_OBJCOPY) --prefix-symbols=__dl_ $@ |
| 77 | |
| 78 | # |
| 79 | # end of BUILD_EXECUTABLE hack |
| 80 | # |