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 \ |
| 7 | rt.c \ |
| 8 | dlfcn.c \ |
| 9 | debugger.c \ |
| 10 | ba.c |
| 11 | |
| 12 | LINKER_TEXT_BASE := 0xB0000100 |
| 13 | |
| 14 | # The maximum size set aside for the linker, from |
| 15 | # LINKER_TEXT_BASE rounded down to a megabyte. |
| 16 | LINKER_AREA_SIZE := 0x01000000 |
| 17 | |
| 18 | LOCAL_LDFLAGS := -Wl,-Ttext,$(LINKER_TEXT_BASE) |
| 19 | |
| 20 | LOCAL_CFLAGS += -DPRELINK |
| 21 | LOCAL_CFLAGS += -DLINKER_TEXT_BASE=$(LINKER_TEXT_BASE) |
| 22 | LOCAL_CFLAGS += -DLINKER_AREA_SIZE=$(LINKER_AREA_SIZE) |
| 23 | |
| 24 | # we need to access the Bionic private header <bionic_tls.h> |
| 25 | # in the linker |
| 26 | LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/private |
| 27 | |
| 28 | ifeq ($(TARGET_ARCH),arm) |
| 29 | LOCAL_CFLAGS += -DANDROID_ARM_LINKER |
| 30 | else |
| 31 | ifeq ($(TARGET_ARCH),x86) |
| 32 | LOCAL_CFLAGS += -DANDROID_X86_LINKER |
| 33 | else |
| 34 | $(error Unsupported TARGET_ARCH $(TARGET_ARCH)) |
| 35 | endif |
| 36 | endif |
| 37 | |
| 38 | LOCAL_MODULE:= linker |
| 39 | |
Dima Zavin | 2e85579 | 2009-05-20 18:28:09 -0700 | [diff] [blame^] | 40 | LOCAL_STATIC_LIBRARIES := libcutils libc_nomalloc |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 41 | |
| 42 | #LOCAL_FORCE_STATIC_EXECUTABLE := true # not necessary when not including BUILD_EXECUTABLE |
| 43 | |
| 44 | # |
| 45 | # include $(BUILD_EXECUTABLE) |
| 46 | # |
| 47 | # Instead of including $(BUILD_EXECUTABLE), we execute the steps to create an executable by |
| 48 | # hand, as we want to insert an extra step that is not supported by the build system, and |
| 49 | # is probably specific the linker only, so there's no need to modify the build system for |
| 50 | # the purpose. |
| 51 | |
| 52 | LOCAL_MODULE_CLASS := EXECUTABLES |
| 53 | LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX) |
| 54 | |
| 55 | # Executables are not prelinked. |
| 56 | LOCAL_PRELINK_MODULE := false |
| 57 | |
| 58 | include $(BUILD_SYSTEM)/dynamic_binary.mk |
| 59 | |
| 60 | $(linked_module): $(TARGET_CRTBEGIN_STATIC_O) $(all_objects) $(all_libraries) $(TARGET_CRTEND_O) |
| 61 | $(transform-o-to-static-executable) |
| 62 | @echo "target PrefixSymbols: $(PRIVATE_MODULE) ($@)" |
| 63 | $(hide) $(TARGET_OBJCOPY) --prefix-symbols=__dl_ $@ |
| 64 | |
| 65 | # |
| 66 | # end of BUILD_EXECUTABLE hack |
| 67 | # |
| 68 | |
| 69 | # we don't want crtbegin.o (because we have begin.o), so unset it |
| 70 | # just for this module |
| 71 | $(LOCAL_BUILT_MODULE): TARGET_CRTBEGIN_STATIC_O := |
| 72 | # This line is not strictly necessary because the dynamic linker is built |
| 73 | # as a static executable, but it won't hurt if in the future we start |
| 74 | # building the linker as a dynamic one. |
| 75 | $(LOCAL_BUILT_MODULE): TARGET_CRTBEGIN_DYNAMIC_O := |