blob: 98eceda14bd14e830e90ed4c16e646e3cdfe7f57 [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
The Android Open Source Projecte5cc1f32009-01-15 16:12:07 -080021# we need to access the Bionic private header <bionic_tls.h>
22# in the linker
23LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/private
24
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070025ifeq ($(TARGET_ARCH),arm)
26LOCAL_CFLAGS += -DANDROID_ARM_LINKER
27else
28 ifeq ($(TARGET_ARCH),x86)
29 LOCAL_CFLAGS += -DANDROID_X86_LINKER
30 else
31 $(error Unsupported TARGET_ARCH $(TARGET_ARCH))
32 endif
33endif
34
35LOCAL_MODULE:= linker
36
37LOCAL_STATIC_LIBRARIES := libcutils libc
38
39#LOCAL_FORCE_STATIC_EXECUTABLE := true # not necessary when not including BUILD_EXECUTABLE
40
41#
42# include $(BUILD_EXECUTABLE)
43#
44# Instead of including $(BUILD_EXECUTABLE), we execute the steps to create an executable by
45# hand, as we want to insert an extra step that is not supported by the build system, and
46# is probably specific the linker only, so there's no need to modify the build system for
47# the purpose.
48
49LOCAL_MODULE_CLASS := EXECUTABLES
50LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX)
51
52# Executables are not prelinked.
53LOCAL_PRELINK_MODULE := false
54
55include $(BUILD_SYSTEM)/dynamic_binary.mk
56
57$(linked_module): $(TARGET_CRTBEGIN_STATIC_O) $(all_objects) $(all_libraries) $(TARGET_CRTEND_O)
58 $(transform-o-to-static-executable)
59 @echo "target PrefixSymbols: $(PRIVATE_MODULE) ($@)"
60 $(hide) $(TARGET_OBJCOPY) --prefix-symbols=__dl_ $@
61
62#
63# end of BUILD_EXECUTABLE hack
64#
65
66# we don't want crtbegin.o (because we have begin.o), so unset it
67# just for this module
68$(LOCAL_BUILT_MODULE): TARGET_CRTBEGIN_STATIC_O :=
69# This line is not strictly necessary because the dynamic linker is built
70# as a static executable, but it won't hurt if in the future we start
71# building the linker as a dynamic one.
72$(LOCAL_BUILT_MODULE): TARGET_CRTBEGIN_DYNAMIC_O :=