blob: 74c7453e69e64da16f62f7d686caf70fa263e513 [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001LOCAL_PATH:= $(call my-dir)
2include $(CLEAR_VARS)
3
4LOCAL_SRC_FILES:= \
5 arch/$(TARGET_ARCH)/begin.S \
6 linker.c \
David 'Digit' Turnerbe575592010-12-16 19:52:02 +01007 linker_environ.c \
David 'Digit' Turner5c734642010-01-20 12:36:51 -08008 linker_format.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08009 rt.c \
10 dlfcn.c \
Shih-wei Liao48527c32011-07-17 12:32:43 -070011 debugger.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080012
Nick Kralevich468319c2011-11-11 15:53:17 -080013LOCAL_LDFLAGS := -shared
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080014
Nick Kralevich468319c2011-11-11 15:53:17 -080015LOCAL_CFLAGS += -fno-stack-protector
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080016
David 'Digit' Turner5c734642010-01-20 12:36:51 -080017# Set LINKER_DEBUG to either 1 or 0
18#
19LOCAL_CFLAGS += -DLINKER_DEBUG=0
20
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080021# we need to access the Bionic private header <bionic_tls.h>
Gary King278d1572009-09-29 16:12:31 -070022# 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
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080027LOCAL_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 else
Shin-ichiro KAWASAKIad13c572009-11-06 10:36:37 +090035 ifeq ($(TARGET_ARCH),sh)
36 LOCAL_CFLAGS += -DANDROID_SH_LINKER
37 else
38 $(error Unsupported TARGET_ARCH $(TARGET_ARCH))
39 endif
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080040 endif
41endif
42
43LOCAL_MODULE:= linker
44
David 'Digit' Turner8bff9a32010-06-10 18:29:33 -070045LOCAL_STATIC_LIBRARIES := libc_nomalloc
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080046
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
Nick Kralevich79399082011-11-04 10:11:26 -070060# we don't want crtbegin.o (because we have begin.o), so unset it
61# just for this module
62LOCAL_NO_CRT := true
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080063
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#