Android.mk revision c97c5fc7880267fd835d22946a920bf370461cf2
1LOCAL_PATH:= $(call my-dir) 2include $(CLEAR_VARS) 3 4LOCAL_SRC_FILES:= \ 5 arch/$(TARGET_ARCH)/begin.S \ 6 debugger.c \ 7 dlfcn.c \ 8 linker.cpp \ 9 linker_environ.c \ 10 linker_format.c \ 11 linker_phdr.c \ 12 rt.c 13 14LOCAL_LDFLAGS := -shared 15 16LOCAL_CFLAGS += -fno-stack-protector \ 17 -Wstrict-overflow=5 \ 18 -fvisibility=hidden \ 19 -std=gnu99 \ 20 -Wall -Wextra 21 22# Set LINKER_DEBUG to either 1 or 0 23# 24LOCAL_CFLAGS += -DLINKER_DEBUG=0 25 26# We need to access Bionic private headers in the linker... 27LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/ 28 29# ...one of which is <private/bionic_tls.h>, for which we 30# need HAVE_ARM_TLS_REGISTER. 31ifeq ($(TARGET_ARCH)-$(ARCH_ARM_HAVE_TLS_REGISTER),arm-true) 32 LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER 33endif 34 35ifeq ($(TARGET_ARCH),arm) 36 LOCAL_CFLAGS += -DANDROID_ARM_LINKER 37endif 38 39ifeq ($(TARGET_ARCH),x86) 40 LOCAL_CFLAGS += -DANDROID_X86_LINKER 41endif 42 43ifeq ($(TARGET_ARCH),mips) 44 LOCAL_CFLAGS += -DANDROID_MIPS_LINKER 45endif 46 47LOCAL_MODULE:= linker 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 68# TODO: split out the asflags. 69LOCAL_ASFLAGS := $(LOCAL_CFLAGS) 70 71include $(BUILD_SYSTEM)/dynamic_binary.mk 72 73$(linked_module): $(TARGET_CRTBEGIN_STATIC_O) $(all_objects) $(all_libraries) $(TARGET_CRTEND_O) 74 $(transform-o-to-static-executable) 75 @echo "target PrefixSymbols: $(PRIVATE_MODULE) ($@)" 76 $(hide) $(TARGET_OBJCOPY) --prefix-symbols=__dl_ $@ 77 78# 79# end of BUILD_EXECUTABLE hack 80# 81