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