Android.mk revision c1bd559d5b0fdcc25db2b6ae2705914103b24699
1LOCAL_PATH:= $(call my-dir)
2include $(CLEAR_VARS)
3
4LOCAL_SRC_FILES:= \
5	arch/$(TARGET_ARCH)/begin.S \
6	linker.c \
7	linker_environ.c \
8	linker_format.c \
9	linker_phdr.c \
10	rt.c \
11	dlfcn.c \
12	debugger.c
13
14LOCAL_LDFLAGS := -shared
15
16LOCAL_CFLAGS += -fno-stack-protector \
17        -Wstrict-overflow=5 \
18        -fvisibility=hidden
19
20# Set LINKER_DEBUG to either 1 or 0
21#
22LOCAL_CFLAGS += -DLINKER_DEBUG=0
23
24# we need to access the Bionic private header <bionic_tls.h>
25# in the linker; duplicate the HAVE_ARM_TLS_REGISTER definition
26# from the libc build
27ifeq ($(TARGET_ARCH)-$(ARCH_ARM_HAVE_TLS_REGISTER),arm-true)
28    LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
29endif
30LOCAL_CFLAGS += \
31    -I$(LOCAL_PATH)/../libc/private \
32    -I$(LOCAL_PATH)/../libc/arch-$(TARGET_ARCH)/bionic
33
34ifeq ($(TARGET_ARCH),arm)
35LOCAL_CFLAGS += -DANDROID_ARM_LINKER
36else
37  ifeq ($(TARGET_ARCH),x86)
38    LOCAL_CFLAGS += -DANDROID_X86_LINKER
39  endif
40endif
41
42LOCAL_MODULE:= linker
43
44LOCAL_STATIC_LIBRARIES := libc_nomalloc
45
46#LOCAL_FORCE_STATIC_EXECUTABLE := true # not necessary when not including BUILD_EXECUTABLE
47
48#
49# include $(BUILD_EXECUTABLE)
50#
51# Instead of including $(BUILD_EXECUTABLE), we execute the steps to create an executable by
52# hand, as we want to insert an extra step that is not supported by the build system, and
53# is probably specific the linker only, so there's no need to modify the build system for
54# the purpose.
55
56LOCAL_MODULE_CLASS := EXECUTABLES
57LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX)
58
59# we don't want crtbegin.o (because we have begin.o), so unset it
60# just for this module
61LOCAL_NO_CRT := true
62
63include $(BUILD_SYSTEM)/dynamic_binary.mk
64
65$(linked_module): $(TARGET_CRTBEGIN_STATIC_O) $(all_objects) $(all_libraries) $(TARGET_CRTEND_O)
66	$(transform-o-to-static-executable)
67	@echo "target PrefixSymbols: $(PRIVATE_MODULE) ($@)"
68	$(hide) $(TARGET_OBJCOPY) --prefix-symbols=__dl_ $@
69
70#
71# end of BUILD_EXECUTABLE hack
72#
73