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 \ |
| 6 | linker.c \ |
David 'Digit' Turner | be57559 | 2010-12-16 19:52:02 +0100 | [diff] [blame] | 7 | linker_environ.c \ |
David 'Digit' Turner | 5c73464 | 2010-01-20 12:36:51 -0800 | [diff] [blame] | 8 | linker_format.c \ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 9 | rt.c \ |
| 10 | dlfcn.c \ |
Shih-wei Liao | 48527c3 | 2011-07-17 12:32:43 -0700 | [diff] [blame] | 11 | debugger.c |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 12 | |
Nick Kralevich | 468319c | 2011-11-11 15:53:17 -0800 | [diff] [blame] | 13 | LOCAL_LDFLAGS := -shared |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 14 | |
Nick Kralevich | 3a7ea52 | 2012-04-04 10:18:27 -0700 | [diff] [blame^] | 15 | LOCAL_CFLAGS += -fno-stack-protector \ |
| 16 | -Wstrict-overflow=5 \ |
| 17 | -fvisibility=hidden |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 18 | |
David 'Digit' Turner | 5c73464 | 2010-01-20 12:36:51 -0800 | [diff] [blame] | 19 | # Set LINKER_DEBUG to either 1 or 0 |
| 20 | # |
| 21 | LOCAL_CFLAGS += -DLINKER_DEBUG=0 |
| 22 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 23 | # we need to access the Bionic private header <bionic_tls.h> |
Gary King | 278d157 | 2009-09-29 16:12:31 -0700 | [diff] [blame] | 24 | # in the linker; duplicate the HAVE_ARM_TLS_REGISTER definition |
| 25 | # from the libc build |
| 26 | ifeq ($(TARGET_ARCH)-$(ARCH_ARM_HAVE_TLS_REGISTER),arm-true) |
| 27 | LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER |
| 28 | endif |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 29 | LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/private |
| 30 | |
| 31 | ifeq ($(TARGET_ARCH),arm) |
| 32 | LOCAL_CFLAGS += -DANDROID_ARM_LINKER |
| 33 | else |
| 34 | ifeq ($(TARGET_ARCH),x86) |
| 35 | LOCAL_CFLAGS += -DANDROID_X86_LINKER |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 36 | endif |
| 37 | endif |
| 38 | |
| 39 | LOCAL_MODULE:= linker |
| 40 | |
David 'Digit' Turner | 8bff9a3 | 2010-06-10 18:29:33 -0700 | [diff] [blame] | 41 | LOCAL_STATIC_LIBRARIES := libc_nomalloc |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 42 | |
| 43 | #LOCAL_FORCE_STATIC_EXECUTABLE := true # not necessary when not including BUILD_EXECUTABLE |
| 44 | |
| 45 | # |
| 46 | # include $(BUILD_EXECUTABLE) |
| 47 | # |
| 48 | # Instead of including $(BUILD_EXECUTABLE), we execute the steps to create an executable by |
| 49 | # hand, as we want to insert an extra step that is not supported by the build system, and |
| 50 | # is probably specific the linker only, so there's no need to modify the build system for |
| 51 | # the purpose. |
| 52 | |
| 53 | LOCAL_MODULE_CLASS := EXECUTABLES |
| 54 | LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX) |
| 55 | |
Nick Kralevich | 7939908 | 2011-11-04 10:11:26 -0700 | [diff] [blame] | 56 | # we don't want crtbegin.o (because we have begin.o), so unset it |
| 57 | # just for this module |
| 58 | LOCAL_NO_CRT := true |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 59 | |
| 60 | include $(BUILD_SYSTEM)/dynamic_binary.mk |
| 61 | |
| 62 | $(linked_module): $(TARGET_CRTBEGIN_STATIC_O) $(all_objects) $(all_libraries) $(TARGET_CRTEND_O) |
| 63 | $(transform-o-to-static-executable) |
| 64 | @echo "target PrefixSymbols: $(PRIVATE_MODULE) ($@)" |
| 65 | $(hide) $(TARGET_OBJCOPY) --prefix-symbols=__dl_ $@ |
| 66 | |
| 67 | # |
| 68 | # end of BUILD_EXECUTABLE hack |
| 69 | # |