Android.mk revision 18a206c81d9743481e364384affd43306911283d
1LOCAL_PATH:= $(call my-dir) 2include $(CLEAR_VARS) 3 4LOCAL_SRC_FILES:= \ 5 arch/$(TARGET_ARCH)/begin.S \ 6 debugger.cpp \ 7 dlfcn.cpp \ 8 linker.cpp \ 9 linker_environ.cpp \ 10 linker_format.cpp \ 11 linker_phdr.cpp \ 12 rt.cpp 13 14LOCAL_LDFLAGS := -shared 15 16LOCAL_CFLAGS += -fno-stack-protector \ 17 -Wstrict-overflow=5 \ 18 -fvisibility=hidden \ 19 -Wall -Wextra 20 21# Set LINKER_DEBUG to either 1 or 0 22# 23LOCAL_CFLAGS += -DLINKER_DEBUG=0 24 25# We need to access Bionic private headers in the linker... 26LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/ 27 28# ...one of which is <private/bionic_tls.h>, for which we 29# need HAVE_ARM_TLS_REGISTER. 30ifeq ($(TARGET_ARCH)-$(ARCH_ARM_HAVE_TLS_REGISTER),arm-true) 31 LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER 32endif 33 34ifeq ($(TARGET_ARCH),arm) 35 LOCAL_CFLAGS += -DANDROID_ARM_LINKER 36endif 37 38ifeq ($(TARGET_ARCH),x86) 39 LOCAL_CFLAGS += -DANDROID_X86_LINKER 40endif 41 42ifeq ($(TARGET_ARCH),mips) 43 LOCAL_CFLAGS += -DANDROID_MIPS_LINKER 44endif 45 46LOCAL_MODULE:= linker 47LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 48 49LOCAL_STATIC_LIBRARIES := libc_nomalloc 50 51#LOCAL_FORCE_STATIC_EXECUTABLE := true # not necessary when not including BUILD_EXECUTABLE 52 53# 54# include $(BUILD_EXECUTABLE) 55# 56# Instead of including $(BUILD_EXECUTABLE), we execute the steps to create an executable by 57# hand, as we want to insert an extra step that is not supported by the build system, and 58# is probably specific the linker only, so there's no need to modify the build system for 59# the purpose. 60 61LOCAL_MODULE_CLASS := EXECUTABLES 62LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX) 63 64# we don't want crtbegin.o (because we have begin.o), so unset it 65# just for this module 66LOCAL_NO_CRT := true 67 68include $(BUILD_SYSTEM)/dynamic_binary.mk 69 70$(linked_module): $(TARGET_CRTBEGIN_STATIC_O) $(all_objects) $(all_libraries) $(TARGET_CRTEND_O) 71 $(transform-o-to-static-executable) 72 @echo "target PrefixSymbols: $(PRIVATE_MODULE) ($@)" 73 $(hide) $(TARGET_OBJCOPY) --prefix-symbols=__dl_ $@ 74 75# 76# end of BUILD_EXECUTABLE hack 77# 78