Android.mk revision 856512ea9c933c5fe0fff14ee123496730df6b19
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        -std=gnu99
20
21# Set LINKER_DEBUG to either 1 or 0
22#
23LOCAL_CFLAGS += -DLINKER_DEBUG=0
24
25# we need to access the Bionic private header <bionic_tls.h>
26# in the linker; duplicate the HAVE_ARM_TLS_REGISTER definition
27# from the libc build
28ifeq ($(TARGET_ARCH)-$(ARCH_ARM_HAVE_TLS_REGISTER),arm-true)
29    LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
30endif
31LOCAL_CFLAGS += \
32    -I$(LOCAL_PATH)/../libc/private \
33    -I$(LOCAL_PATH)/../libc/arch-$(TARGET_ARCH)/bionic
34
35ifeq ($(TARGET_ARCH),arm)
36LOCAL_CFLAGS += -DANDROID_ARM_LINKER
37else
38  ifeq ($(TARGET_ARCH),x86)
39    LOCAL_CFLAGS += -DANDROID_X86_LINKER
40  endif
41endif
42
43LOCAL_MODULE:= linker
44
45LOCAL_STATIC_LIBRARIES := libc_nomalloc
46
47#LOCAL_FORCE_STATIC_EXECUTABLE := true # not necessary when not including BUILD_EXECUTABLE
48
49#
50# include $(BUILD_EXECUTABLE)
51#
52# Instead of including $(BUILD_EXECUTABLE), we execute the steps to create an executable by
53# hand, as we want to insert an extra step that is not supported by the build system, and
54# is probably specific the linker only, so there's no need to modify the build system for
55# the purpose.
56
57LOCAL_MODULE_CLASS := EXECUTABLES
58LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX)
59
60# we don't want crtbegin.o (because we have begin.o), so unset it
61# just for this module
62LOCAL_NO_CRT := true
63
64include $(BUILD_SYSTEM)/dynamic_binary.mk
65
66$(linked_module): $(TARGET_CRTBEGIN_STATIC_O) $(all_objects) $(all_libraries) $(TARGET_CRTEND_O)
67	$(transform-o-to-static-executable)
68	@echo "target PrefixSymbols: $(PRIVATE_MODULE) ($@)"
69	$(hide) $(TARGET_OBJCOPY) --prefix-symbols=__dl_ $@
70
71#
72# end of BUILD_EXECUTABLE hack
73#
74