Android.mk revision 9ec0f03a0d0b17bbb94ac0b9fef6add28a133c3a
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	rt.c \
10	dlfcn.c \
11	debugger.c
12
13LOCAL_LDFLAGS := -shared
14
15LOCAL_CFLAGS += -fno-stack-protector -Wstrict-overflow=5
16
17# Set LINKER_DEBUG to either 1 or 0
18#
19LOCAL_CFLAGS += -DLINKER_DEBUG=0
20
21# we need to access the Bionic private header <bionic_tls.h>
22# in the linker; duplicate the HAVE_ARM_TLS_REGISTER definition
23# from the libc build
24ifeq ($(TARGET_ARCH)-$(ARCH_ARM_HAVE_TLS_REGISTER),arm-true)
25    LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
26endif
27LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/private
28
29ifeq ($(TARGET_ARCH),arm)
30LOCAL_CFLAGS += -DANDROID_ARM_LINKER
31else
32  ifeq ($(TARGET_ARCH),x86)
33    LOCAL_CFLAGS += -DANDROID_X86_LINKER
34  endif
35endif
36
37LOCAL_MODULE:= linker
38
39LOCAL_STATIC_LIBRARIES := libc_nomalloc
40
41#LOCAL_FORCE_STATIC_EXECUTABLE := true # not necessary when not including BUILD_EXECUTABLE
42
43#
44# include $(BUILD_EXECUTABLE)
45#
46# Instead of including $(BUILD_EXECUTABLE), we execute the steps to create an executable by
47# hand, as we want to insert an extra step that is not supported by the build system, and
48# is probably specific the linker only, so there's no need to modify the build system for
49# the purpose.
50
51LOCAL_MODULE_CLASS := EXECUTABLES
52LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX)
53
54# we don't want crtbegin.o (because we have begin.o), so unset it
55# just for this module
56LOCAL_NO_CRT := true
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