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 | |
| 4 | LOCAL_SRC_FILES:= \ |
| 5 | arch/$(TARGET_ARCH)/begin.S \ |
Elliott Hughes | 4688279 | 2012-08-03 16:49:39 -0700 | [diff] [blame] | 6 | debugger.c \ |
| 7 | dlfcn.c \ |
| 8 | linker.cpp \ |
David 'Digit' Turner | be57559 | 2010-12-16 19:52:02 +0100 | [diff] [blame] | 9 | linker_environ.c \ |
David 'Digit' Turner | 5c73464 | 2010-01-20 12:36:51 -0800 | [diff] [blame] | 10 | linker_format.c \ |
David 'Digit' Turner | c1bd559 | 2012-06-19 11:21:29 +0200 | [diff] [blame] | 11 | linker_phdr.c \ |
Elliott Hughes | 4688279 | 2012-08-03 16:49:39 -0700 | [diff] [blame] | 12 | rt.c |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 13 | |
Nick Kralevich | 468319c | 2011-11-11 15:53:17 -0800 | [diff] [blame] | 14 | LOCAL_LDFLAGS := -shared |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 15 | |
Nick Kralevich | 3a7ea52 | 2012-04-04 10:18:27 -0700 | [diff] [blame] | 16 | LOCAL_CFLAGS += -fno-stack-protector \ |
| 17 | -Wstrict-overflow=5 \ |
Elliott Hughes | 856512e | 2012-07-16 09:43:14 -0700 | [diff] [blame] | 18 | -fvisibility=hidden \ |
Raghu Gandham | d7daacb | 2012-07-31 12:07:22 -0700 | [diff] [blame] | 19 | -std=gnu99 \ |
| 20 | -Wall -Wextra |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 21 | |
David 'Digit' Turner | 5c73464 | 2010-01-20 12:36:51 -0800 | [diff] [blame] | 22 | # Set LINKER_DEBUG to either 1 or 0 |
| 23 | # |
| 24 | LOCAL_CFLAGS += -DLINKER_DEBUG=0 |
| 25 | |
Elliott Hughes | 4688279 | 2012-08-03 16:49:39 -0700 | [diff] [blame] | 26 | # We need to access Bionic private headers in the linker... |
| 27 | LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/ |
| 28 | |
| 29 | # ...one of which is <private/bionic_tls.h>, for which we |
| 30 | # need HAVE_ARM_TLS_REGISTER. |
Gary King | 278d157 | 2009-09-29 16:12:31 -0700 | [diff] [blame] | 31 | ifeq ($(TARGET_ARCH)-$(ARCH_ARM_HAVE_TLS_REGISTER),arm-true) |
| 32 | LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER |
| 33 | endif |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 34 | |
| 35 | ifeq ($(TARGET_ARCH),arm) |
Raghu Gandham | d7daacb | 2012-07-31 12:07:22 -0700 | [diff] [blame] | 36 | LOCAL_CFLAGS += -DANDROID_ARM_LINKER |
| 37 | endif |
| 38 | |
| 39 | ifeq ($(TARGET_ARCH),x86) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 40 | LOCAL_CFLAGS += -DANDROID_X86_LINKER |
Raghu Gandham | d7daacb | 2012-07-31 12:07:22 -0700 | [diff] [blame] | 41 | endif |
| 42 | |
| 43 | ifeq ($(TARGET_ARCH),mips) |
| 44 | LOCAL_CFLAGS += -DANDROID_MIPS_LINKER |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 45 | endif |
| 46 | |
| 47 | LOCAL_MODULE:= linker |
| 48 | |
David 'Digit' Turner | 8bff9a3 | 2010-06-10 18:29:33 -0700 | [diff] [blame] | 49 | LOCAL_STATIC_LIBRARIES := libc_nomalloc |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 50 | |
| 51 | #LOCAL_FORCE_STATIC_EXECUTABLE := true # not necessary when not including BUILD_EXECUTABLE |
| 52 | |
| 53 | # |
| 54 | # include $(BUILD_EXECUTABLE) |
| 55 | # |
| 56 | # Instead of including $(BUILD_EXECUTABLE), we execute the steps to create an executable by |
| 57 | # hand, as we want to insert an extra step that is not supported by the build system, and |
| 58 | # is probably specific the linker only, so there's no need to modify the build system for |
| 59 | # the purpose. |
| 60 | |
| 61 | LOCAL_MODULE_CLASS := EXECUTABLES |
| 62 | LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX) |
| 63 | |
Nick Kralevich | 7939908 | 2011-11-04 10:11:26 -0700 | [diff] [blame] | 64 | # we don't want crtbegin.o (because we have begin.o), so unset it |
| 65 | # just for this module |
| 66 | LOCAL_NO_CRT := true |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 67 | |
Ying Wang | c97c5fc | 2012-08-11 14:23:19 -0700 | [diff] [blame^] | 68 | # TODO: split out the asflags. |
| 69 | LOCAL_ASFLAGS := $(LOCAL_CFLAGS) |
| 70 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 71 | include $(BUILD_SYSTEM)/dynamic_binary.mk |
| 72 | |
| 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 | # |