OSDN Git Service

Merge commit 'f9f41d0dfdac6deb819f0cc0cb0270f504dbd4ed' into manualmergeDroiddoc
[android-x86/build.git] / core / combo / linux-arm.mk
1 # Configuration for Linux on ARM.
2 # Included by combo/select.make
3
4 # You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
5 ifeq ($(strip $($(combo_target)TOOLS_PREFIX)),)
6 $(combo_target)TOOLS_PREFIX := \
7         prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-eabi-4.2.1/bin/arm-eabi-
8 endif
9
10 $(combo_target)CC := $($(combo_target)TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
11 $(combo_target)CXX := $($(combo_target)TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX)
12 $(combo_target)AR := $($(combo_target)TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
13 $(combo_target)OBJCOPY := $($(combo_target)TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
14 $(combo_target)LD := $($(combo_target)TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
15
16 $(combo_target)NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
17
18 TARGET_arm_CFLAGS :=    -O2 \
19                         -fomit-frame-pointer \
20                         -fstrict-aliasing    \
21                         -funswitch-loops     \
22                         -finline-limit=300
23
24 TARGET_thumb_CFLAGS :=  -mthumb \
25                         -Os \
26                         -fomit-frame-pointer \
27                         -fno-strict-aliasing \
28                         -finline-limit=64
29
30 # Set FORCE_ARM_DEBUGGING to "true" in your buildspec.mk
31 # or in your environment to force a full arm build, even for
32 # files that are normally built as thumb; this can make
33 # gdb debugging easier.  Don't forget to do a clean build.
34 #
35 # NOTE: if you try to build a -O0 build with thumb, several
36 # of the libraries (libpv, libwebcore, libkjs) need to be built
37 # with -mlong-calls.  When built at -O0, those libraries are
38 # too big for a thumb "BL <label>" to go from one end to the other.
39 ifeq ($(FORCE_ARM_DEBUGGING),true)
40   TARGET_arm_CFLAGS += -fno-omit-frame-pointer
41   TARGET_thumb_CFLAGS += -marm -fno-omit-frame-pointer
42 endif
43
44 ## on some hosts, the target cross-compiler is not available so do not run this command
45 ifneq ($(wildcard $($(combo_target)CC)),)
46 $(combo_target)LIBGCC := $(shell $($(combo_target)CC) -mthumb-interwork -print-libgcc-file-name)
47 endif
48
49 $(combo_target)GLOBAL_CFLAGS += \
50                         -march=armv5te -mtune=xscale \
51                         -msoft-float -fpic \
52                         -mthumb-interwork \
53                         -ffunction-sections \
54                         -funwind-tables \
55                         -fstack-protector \
56                         -fno-short-enums \
57                         -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ \
58                         -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ \
59                         -include $(call select-android-config-h,linux-arm)
60
61 $(combo_target)GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden
62
63 $(combo_target)RELEASE_CFLAGS := \
64                         -DSK_RELEASE -DNDEBUG \
65                         -g \
66                         -Wstrict-aliasing=2 \
67                         -finline-functions \
68                         -fno-inline-functions-called-once \
69                         -fgcse-after-reload \
70                         -frerun-cse-after-loop \
71                         -frename-registers
72
73 libc_root := bionic/libc
74 libm_root := bionic/libm
75 libstdc++_root := bionic/libstdc++
76 libthread_db_root := bionic/libthread_db
77
78 # unless CUSTOM_KERNEL_HEADERS is defined, we're going to use
79 # symlinks located in out/ to point to the appropriate kernel
80 # headers. see 'config/kernel_headers.make' for more details
81 #
82 ifneq ($(CUSTOM_KERNEL_HEADERS),)
83     KERNEL_HEADERS_COMMON := $(CUSTOM_KERNEL_HEADERS)
84     KERNEL_HEADERS_ARCH   := $(CUSTOM_KERNEL_HEADERS)
85 else
86     KERNEL_HEADERS_COMMON := $(libc_root)/kernel/common
87     KERNEL_HEADERS_ARCH   := $(libc_root)/kernel/arch-$(TARGET_ARCH)
88 endif
89 KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
90
91 $(combo_target)C_INCLUDES := \
92         $(libc_root)/arch-arm/include \
93         $(libc_root)/include \
94         $(libstdc++_root)/include \
95         $(KERNEL_HEADERS) \
96         $(libm_root)/include \
97         $(libm_root)/include/arch/arm \
98         $(libthread_db_root)/include
99
100 TARGET_CRTBEGIN_STATIC_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o
101 TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_dynamic.o
102 TARGET_CRTEND_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_android.o
103
104 TARGET_STRIP_MODULE:=true
105
106 $(combo_target)DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
107
108 $(combo_target)CUSTOM_LD_COMMAND := true
109 define transform-o-to-shared-lib-inner
110 $(TARGET_CXX) \
111         -nostdlib -Wl,-soname,$(notdir $@) -Wl,-T,$(BUILD_SYSTEM)/armelf.xsc \
112         -Wl,--gc-sections \
113         -Wl,-shared,-Bsymbolic \
114         $(TARGET_GLOBAL_LD_DIRS) \
115         $(PRIVATE_ALL_OBJECTS) \
116         -Wl,--whole-archive \
117         $(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
118         -Wl,--no-whole-archive \
119         $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
120         $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
121         -o $@ \
122         $(PRIVATE_LDFLAGS) \
123         $(TARGET_LIBGCC)
124 endef
125
126 define transform-o-to-executable-inner
127 $(TARGET_CXX) -nostdlib -Bdynamic -Wl,-T,$(BUILD_SYSTEM)/armelf.x \
128         -Wl,-dynamic-linker,/system/bin/linker \
129     -Wl,--gc-sections \
130         -Wl,-z,nocopyreloc \
131         -o $@ \
132         $(TARGET_GLOBAL_LD_DIRS) \
133         -Wl,-rpath-link=$(TARGET_OUT_INTERMEDIATE_LIBRARIES) \
134         $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
135         $(TARGET_CRTBEGIN_DYNAMIC_O) \
136         $(PRIVATE_ALL_OBJECTS) \
137         $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
138         $(PRIVATE_LDFLAGS) \
139         $(TARGET_LIBGCC) \
140         $(TARGET_CRTEND_O)
141 endef
142
143 define transform-o-to-static-executable-inner
144 $(TARGET_CXX) -nostdlib -Bstatic -Wl,-T,$(BUILD_SYSTEM)/armelf.x \
145     -Wl,--gc-sections \
146         -o $@ \
147         $(TARGET_GLOBAL_LD_DIRS) \
148         $(TARGET_CRTBEGIN_STATIC_O) \
149         $(PRIVATE_LDFLAGS) \
150         $(PRIVATE_ALL_OBJECTS) \
151         $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
152         $(TARGET_LIBGCC) \
153         $(TARGET_CRTEND_O)
154 endef