Android.mk revision 1dc9e472e19acfe6dc7f41e429236e7eef7ceda1
1LOCAL_PATH:= $(call my-dir)
2include $(CLEAR_VARS)
3
4LOCAL_SRC_FILES:= \
5	arch/$(TARGET_ARCH)/begin.S \
6	linker.c \
7	rt.c \
8	dlfcn.c \
9	debugger.c \
10	ba.c
11
12LINKER_TEXT_BASE := 0xB0000100
13
14# The maximum size set aside for the linker, from
15# LINKER_TEXT_BASE rounded down to a megabyte.
16LINKER_AREA_SIZE := 0x01000000
17
18LOCAL_LDFLAGS := -Wl,-Ttext,$(LINKER_TEXT_BASE)
19
20LOCAL_CFLAGS += -DPRELINK
21LOCAL_CFLAGS += -DLINKER_TEXT_BASE=$(LINKER_TEXT_BASE)
22LOCAL_CFLAGS += -DLINKER_AREA_SIZE=$(LINKER_AREA_SIZE)
23
24# we need to access the Bionic private header <bionic_tls.h>
25# in the linker
26LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/private
27
28ifeq ($(TARGET_ARCH),arm)
29LOCAL_CFLAGS += -DANDROID_ARM_LINKER
30else
31  ifeq ($(TARGET_ARCH),x86)
32    LOCAL_CFLAGS += -DANDROID_X86_LINKER
33  else
34    $(error Unsupported TARGET_ARCH $(TARGET_ARCH))
35  endif
36endif
37
38LOCAL_MODULE:= linker
39
40LOCAL_STATIC_LIBRARIES := libcutils libc
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
52LOCAL_MODULE_CLASS := EXECUTABLES
53LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX)
54
55# Executables are not prelinked.
56LOCAL_PRELINK_MODULE := false
57
58include $(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 :=
76