2009-03-04 04:28:35 +01:00
|
|
|
LOCAL_PATH:= $(call my-dir)
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
|
|
|
LOCAL_SRC_FILES:= \
|
|
|
|
arch/$(TARGET_ARCH)/begin.S \
|
|
|
|
linker.c \
|
2010-12-16 19:52:02 +01:00
|
|
|
linker_environ.c \
|
2010-01-20 21:36:51 +01:00
|
|
|
linker_format.c \
|
2012-06-19 11:21:29 +02:00
|
|
|
linker_phdr.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
rt.c \
|
|
|
|
dlfcn.c \
|
2011-07-17 21:32:43 +02:00
|
|
|
debugger.c
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2011-11-12 00:53:17 +01:00
|
|
|
LOCAL_LDFLAGS := -shared
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2012-04-04 19:18:27 +02:00
|
|
|
LOCAL_CFLAGS += -fno-stack-protector \
|
|
|
|
-Wstrict-overflow=5 \
|
2012-07-16 18:43:14 +02:00
|
|
|
-fvisibility=hidden \
|
2012-07-31 21:07:22 +02:00
|
|
|
-std=gnu99 \
|
|
|
|
-Wall -Wextra
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2010-01-20 21:36:51 +01:00
|
|
|
# Set LINKER_DEBUG to either 1 or 0
|
|
|
|
#
|
|
|
|
LOCAL_CFLAGS += -DLINKER_DEBUG=0
|
|
|
|
|
2009-03-04 04:28:35 +01:00
|
|
|
# we need to access the Bionic private header <bionic_tls.h>
|
2009-09-30 01:12:31 +02:00
|
|
|
# in the linker; duplicate the HAVE_ARM_TLS_REGISTER definition
|
|
|
|
# from the libc build
|
|
|
|
ifeq ($(TARGET_ARCH)-$(ARCH_ARM_HAVE_TLS_REGISTER),arm-true)
|
|
|
|
LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
|
|
|
|
endif
|
2012-06-20 08:35:51 +02:00
|
|
|
LOCAL_CFLAGS += \
|
|
|
|
-I$(LOCAL_PATH)/../libc/private \
|
|
|
|
-I$(LOCAL_PATH)/../libc/arch-$(TARGET_ARCH)/bionic
|
2009-03-04 04:28:35 +01:00
|
|
|
|
|
|
|
ifeq ($(TARGET_ARCH),arm)
|
2012-07-31 21:07:22 +02:00
|
|
|
LOCAL_CFLAGS += -DANDROID_ARM_LINKER
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(TARGET_ARCH),x86)
|
2009-03-04 04:28:35 +01:00
|
|
|
LOCAL_CFLAGS += -DANDROID_X86_LINKER
|
2012-07-31 21:07:22 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(TARGET_ARCH),mips)
|
|
|
|
LOCAL_CFLAGS += -DANDROID_MIPS_LINKER
|
2009-03-04 04:28:35 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
LOCAL_MODULE:= linker
|
|
|
|
|
2010-06-11 03:29:33 +02:00
|
|
|
LOCAL_STATIC_LIBRARIES := libc_nomalloc
|
2009-03-04 04:28:35 +01:00
|
|
|
|
|
|
|
#LOCAL_FORCE_STATIC_EXECUTABLE := true # not necessary when not including BUILD_EXECUTABLE
|
|
|
|
|
|
|
|
#
|
|
|
|
# include $(BUILD_EXECUTABLE)
|
|
|
|
#
|
|
|
|
# Instead of including $(BUILD_EXECUTABLE), we execute the steps to create an executable by
|
|
|
|
# hand, as we want to insert an extra step that is not supported by the build system, and
|
|
|
|
# is probably specific the linker only, so there's no need to modify the build system for
|
|
|
|
# the purpose.
|
|
|
|
|
|
|
|
LOCAL_MODULE_CLASS := EXECUTABLES
|
|
|
|
LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX)
|
|
|
|
|
2011-11-04 18:11:26 +01:00
|
|
|
# we don't want crtbegin.o (because we have begin.o), so unset it
|
|
|
|
# just for this module
|
|
|
|
LOCAL_NO_CRT := true
|
2009-03-04 04:28:35 +01:00
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/dynamic_binary.mk
|
|
|
|
|
|
|
|
$(linked_module): $(TARGET_CRTBEGIN_STATIC_O) $(all_objects) $(all_libraries) $(TARGET_CRTEND_O)
|
|
|
|
$(transform-o-to-static-executable)
|
|
|
|
@echo "target PrefixSymbols: $(PRIVATE_MODULE) ($@)"
|
|
|
|
$(hide) $(TARGET_OBJCOPY) --prefix-symbols=__dl_ $@
|
|
|
|
|
|
|
|
#
|
|
|
|
# end of BUILD_EXECUTABLE hack
|
|
|
|
#
|