2009-03-04 04:28:35 +01:00
|
|
|
LOCAL_PATH:= $(call my-dir)
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
2012-11-28 15:31:14 +01:00
|
|
|
ifeq ($(TARGET_ARCH),x86)
|
|
|
|
linker_begin_extension := c
|
|
|
|
else
|
|
|
|
linker_begin_extension := S
|
|
|
|
endif
|
|
|
|
|
2009-03-04 04:28:35 +01:00
|
|
|
LOCAL_SRC_FILES:= \
|
2012-12-19 00:57:55 +01:00
|
|
|
arch/$(TARGET_ARCH)/begin.$(linker_begin_extension) \
|
|
|
|
debugger.cpp \
|
|
|
|
dlfcn.cpp \
|
|
|
|
linker.cpp \
|
|
|
|
linker_environ.cpp \
|
|
|
|
linker_phdr.cpp \
|
2013-10-08 19:05:05 +02:00
|
|
|
rt.cpp \
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2013-01-17 01:43:15 +01:00
|
|
|
LOCAL_LDFLAGS := -shared -Wl,--exclude-libs,ALL
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2013-10-17 22:06:20 +02:00
|
|
|
LOCAL_CFLAGS += \
|
|
|
|
-fno-stack-protector \
|
|
|
|
-Wstrict-overflow=5 \
|
|
|
|
-fvisibility=hidden \
|
|
|
|
-Wall -Wextra -Werror \
|
|
|
|
|
|
|
|
LOCAL_CONLYFLAGS += \
|
|
|
|
-std=gnu99 \
|
|
|
|
|
|
|
|
LOCAL_CPPFLAGS += \
|
|
|
|
-std=gnu++11 \
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2013-02-13 06:56:42 +01:00
|
|
|
# We need to access Bionic private headers in the linker.
|
2012-08-04 01:49:39 +02:00
|
|
|
LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/
|
|
|
|
|
2013-10-10 16:19:31 +02:00
|
|
|
ifeq ($(TARGET_IS_64_BIT),true)
|
2013-10-08 19:05:05 +02:00
|
|
|
LOCAL_MODULE := linker64
|
|
|
|
else
|
|
|
|
LOCAL_MODULE := linker
|
|
|
|
endif
|
|
|
|
|
2012-08-13 23:06:05 +02:00
|
|
|
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
|
2009-03-04 04:28:35 +01:00
|
|
|
|
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
|
|
|
|
2012-08-11 23:23:19 +02:00
|
|
|
# TODO: split out the asflags.
|
|
|
|
LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
|
|
|
|
|
2009-03-04 04:28:35 +01:00
|
|
|
include $(BUILD_SYSTEM)/dynamic_binary.mk
|
|
|
|
|
2012-09-26 03:32:24 +02:00
|
|
|
# See build/core/executable.mk
|
|
|
|
$(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(TARGET_GLOBAL_LD_DIRS)
|
|
|
|
$(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(TARGET_GLOBAL_LDFLAGS)
|
|
|
|
$(linked_module): PRIVATE_TARGET_FDO_LIB := $(TARGET_FDO_LIB)
|
|
|
|
$(linked_module): PRIVATE_TARGET_LIBGCC := $(TARGET_LIBGCC)
|
|
|
|
$(linked_module): PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_CRTBEGIN_DYNAMIC_O)
|
|
|
|
$(linked_module): PRIVATE_TARGET_CRTBEGIN_STATIC_O := $(TARGET_CRTBEGIN_STATIC_O)
|
|
|
|
$(linked_module): PRIVATE_TARGET_CRTEND_O := $(TARGET_CRTEND_O)
|
2009-03-04 04:28:35 +01:00
|
|
|
$(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
|
|
|
|
#
|