Android.mk revision fba76918950962438ed40f78365947bf9927b24c
1# 2# Copyright (C) 2012 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16# 17 18LOCAL_PATH := $(call my-dir) 19 20# The following list contains platform-independent functionalities. 21# 22# Skip apple_versioning.c since it is unused. 23# Skip atomic.c since it needs to be built separately according to the docs. 24# Skip clear_cache.c since it redefines a system function on Android. 25# Skip gcc_personality_v0.c since it depends on libunwind. 26libcompiler_rt_common_SRC_FILES := \ 27 lib/absvdi2.c \ 28 lib/absvsi2.c \ 29 lib/absvti2.c \ 30 lib/adddf3.c \ 31 lib/addsf3.c \ 32 lib/addvdi3.c \ 33 lib/addvsi3.c \ 34 lib/addvti3.c \ 35 lib/ashldi3.c \ 36 lib/ashlti3.c \ 37 lib/ashrdi3.c \ 38 lib/ashrti3.c \ 39 lib/clzdi2.c \ 40 lib/clzsi2.c \ 41 lib/clzti2.c \ 42 lib/cmpdi2.c \ 43 lib/cmpti2.c \ 44 lib/comparedf2.c \ 45 lib/comparesf2.c \ 46 lib/ctzdi2.c \ 47 lib/ctzsi2.c \ 48 lib/ctzti2.c \ 49 lib/divdc3.c \ 50 lib/divdf3.c \ 51 lib/divdi3.c \ 52 lib/divmoddi4.c \ 53 lib/divmodsi4.c \ 54 lib/divsc3.c \ 55 lib/divsf3.c \ 56 lib/divsi3.c \ 57 lib/divti3.c \ 58 lib/divxc3.c \ 59 lib/enable_execute_stack.c \ 60 lib/eprintf.c \ 61 lib/extendsfdf2.c \ 62 lib/ffsdi2.c \ 63 lib/ffsti2.c \ 64 lib/fixdfdi.c \ 65 lib/fixdfsi.c \ 66 lib/fixdfti.c \ 67 lib/fixsfdi.c \ 68 lib/fixsfsi.c \ 69 lib/fixsfti.c \ 70 lib/fixunsdfdi.c \ 71 lib/fixunsdfsi.c \ 72 lib/fixunsdfti.c \ 73 lib/fixunssfdi.c \ 74 lib/fixunssfsi.c \ 75 lib/fixunssfti.c \ 76 lib/fixunsxfdi.c \ 77 lib/fixunsxfsi.c \ 78 lib/fixunsxfti.c \ 79 lib/fixxfdi.c \ 80 lib/fixxfti.c \ 81 lib/floatdidf.c \ 82 lib/floatdisf.c \ 83 lib/floatdixf.c \ 84 lib/floatsidf.c \ 85 lib/floatsisf.c \ 86 lib/floattidf.c \ 87 lib/floattisf.c \ 88 lib/floattixf.c \ 89 lib/floatundidf.c \ 90 lib/floatundisf.c \ 91 lib/floatundixf.c \ 92 lib/floatunsidf.c \ 93 lib/floatunsisf.c \ 94 lib/floatuntidf.c \ 95 lib/floatuntisf.c \ 96 lib/floatuntixf.c \ 97 lib/int_util.c \ 98 lib/lshrdi3.c \ 99 lib/lshrti3.c \ 100 lib/moddi3.c \ 101 lib/modsi3.c \ 102 lib/modti3.c \ 103 lib/muldc3.c \ 104 lib/muldf3.c \ 105 lib/muldi3.c \ 106 lib/mulodi4.c \ 107 lib/mulosi4.c \ 108 lib/muloti4.c \ 109 lib/mulsc3.c \ 110 lib/mulsf3.c \ 111 lib/multi3.c \ 112 lib/mulvdi3.c \ 113 lib/mulvsi3.c \ 114 lib/mulvti3.c \ 115 lib/mulxc3.c \ 116 lib/negdf2.c \ 117 lib/negdi2.c \ 118 lib/negsf2.c \ 119 lib/negti2.c \ 120 lib/negvdi2.c \ 121 lib/negvsi2.c \ 122 lib/negvti2.c \ 123 lib/paritydi2.c \ 124 lib/paritysi2.c \ 125 lib/parityti2.c \ 126 lib/popcountdi2.c \ 127 lib/popcountsi2.c \ 128 lib/popcountti2.c \ 129 lib/powidf2.c \ 130 lib/powisf2.c \ 131 lib/powitf2.c \ 132 lib/powixf2.c \ 133 lib/subdf3.c \ 134 lib/subsf3.c \ 135 lib/subvdi3.c \ 136 lib/subvsi3.c \ 137 lib/subvti3.c \ 138 lib/trampoline_setup.c \ 139 lib/truncdfsf2.c \ 140 lib/ucmpdi2.c \ 141 lib/ucmpti2.c \ 142 lib/udivdi3.c \ 143 lib/udivmoddi4.c \ 144 lib/udivmodsi4.c \ 145 lib/udivmodti4.c \ 146 lib/udivsi3.c \ 147 lib/udivti3.c \ 148 lib/umoddi3.c \ 149 lib/umodsi3.c \ 150 lib/umodti3.c 151 152# ARM-specific runtimes 153libcompiler_rt_arm_SRC_FILES := \ 154 lib/arm/aeabi_idivmod.S \ 155 lib/arm/aeabi_ldivmod.S \ 156 lib/arm/aeabi_memcmp.S \ 157 lib/arm/aeabi_memcpy.S \ 158 lib/arm/aeabi_memmove.S \ 159 lib/arm/aeabi_memset.S \ 160 lib/arm/aeabi_uidivmod.S \ 161 lib/arm/aeabi_uldivmod.S 162 163# ARM-specific runtimes implemented in VFP 164libcompiler_rt_arm_vfp_SRC_FILES := \ 165 lib/arm/adddf3vfp.S \ 166 lib/arm/addsf3vfp.S \ 167 lib/arm/comparesf2.S \ 168 lib/arm/divdf3vfp.S \ 169 lib/arm/divmodsi4.S \ 170 lib/arm/divsf3vfp.S \ 171 lib/arm/divsi3.S \ 172 lib/arm/eqdf2vfp.S \ 173 lib/arm/eqsf2vfp.S \ 174 lib/arm/extendsfdf2vfp.S \ 175 lib/arm/fixdfsivfp.S \ 176 lib/arm/fixsfsivfp.S \ 177 lib/arm/fixunsdfsivfp.S \ 178 lib/arm/fixunssfsivfp.S \ 179 lib/arm/floatsidfvfp.S \ 180 lib/arm/floatsisfvfp.S \ 181 lib/arm/floatunssidfvfp.S \ 182 lib/arm/floatunssisfvfp.S \ 183 lib/arm/gedf2vfp.S \ 184 lib/arm/gesf2vfp.S \ 185 lib/arm/gtdf2vfp.S \ 186 lib/arm/gtsf2vfp.S \ 187 lib/arm/ledf2vfp.S \ 188 lib/arm/lesf2vfp.S \ 189 lib/arm/ltdf2vfp.S \ 190 lib/arm/ltsf2vfp.S \ 191 lib/arm/modsi3.S \ 192 lib/arm/muldf3vfp.S \ 193 lib/arm/mulsf3vfp.S \ 194 lib/arm/nedf2vfp.S \ 195 lib/arm/negdf2vfp.S \ 196 lib/arm/negsf2vfp.S \ 197 lib/arm/nesf2vfp.S \ 198 lib/arm/subdf3vfp.S \ 199 lib/arm/subsf3vfp.S \ 200 lib/arm/truncdfsf2vfp.S \ 201 lib/arm/udivmodsi4.S \ 202 lib/arm/udivsi3.S \ 203 lib/arm/umodsi3.S \ 204 lib/arm/unorddf2vfp.S \ 205 lib/arm/unordsf2vfp.S 206 207# MIPS-specific runtimes 208libcompiler_rt_mips_SRC_FILES := # nothing to add 209 210# X86-specific runtimes 211# 212# We don't support x86-64 right now 213libcompiler_rt_x86_SRC_FILES := \ 214 lib/i386/ashldi3.S \ 215 lib/i386/ashrdi3.S \ 216 lib/i386/divdi3.S \ 217 lib/i386/floatdidf.S \ 218 lib/i386/floatdisf.S \ 219 lib/i386/floatdixf.S \ 220 lib/i386/floatundidf.S \ 221 lib/i386/floatundisf.S \ 222 lib/i386/floatundixf.S \ 223 lib/i386/lshrdi3.S \ 224 lib/i386/moddi3.S \ 225 lib/i386/muldi3.S \ 226 lib/i386/udivdi3.S \ 227 lib/i386/umoddi3.S 228 229# The following list contains functions that are not available in libgcc.a, so 230# we potentially need them when using a Clang-built component (e.g., -ftrapv 231# with 64-bit integer multiplies. See http://llvm.org/bugs/show_bug.cgi?id=14469.) 232libcompiler_rt_extras_SRC_FILES := \ 233 lib/mulodi4.c 234 235# $(1): arch 236define get-libcompiler-rt-source-files 237 $(if $(findstring $(1),arm),$(call get-libcompiler-rt-arm-source-files), 238 $(if $(findstring $(1),mips),$(call get-libcompiler-rt-mips-source-files), 239 $(if $(findstring $(1),x86),$(call get-libcompiler-rt-x86-source-files), 240 $(error Unsupported ARCH $(1))))) 241endef 242 243# $(1): source list 244# $(2): arch 245# 246# If lib/<arch>/X.S is included in the source list, we should filter out lib/X.c 247# in the result source list (i.e., use the one optimized for the arch.) Otherwise 248# there'll be multiple definitions for one symbol. 249define filter-libcompiler-rt-common-source-files 250 $(filter-out $(patsubst lib/$(2)/%.S,lib/%.c,$(filter %.S,$(1))),$(1)) 251endef 252 253define get-libcompiler-rt-arm-source-files 254 $(call filter-libcompiler-rt-common-source-files, 255 $(libcompiler_rt_common_SRC_FILES) 256 $(libcompiler_rt_arm_SRC_FILES) 257 $(if $(findstring $(ARCH_ARM_HAVE_VFP),true),$(libcompiler_rt_arm_vfp_SRC_FILES),),arm) 258endef 259 260define get-libcompiler-rt-mips-source-files 261 $(call filter-libcompiler-rt-common-source-files, 262 $(libcompiler_rt_common_SRC_FILES) 263 $(libcompiler_rt_mips_SRC_FILES),mips) 264endef 265 266define get-libcompiler-rt-x86-source-files 267 $(call filter-libcompiler-rt-common-source-files, 268 $(libcompiler_rt_common_SRC_FILES) 269 $(libcompiler_rt_x86_SRC_FILES),i386) 270endef 271 272# $(1): target or host 273# $(2): static or shared 274define build-libcompiler-rt 275 ifneq ($(1),target) 276 ifneq ($(1),host) 277 $$(error expected target or host for argument 1, received $(1)) 278 endif 279 endif 280 ifneq ($(2),static) 281 ifneq ($(2),shared) 282 $$(error expected static or shared for argument 2, received $(2)) 283 endif 284 endif 285 286 target_or_host := $(1) 287 static_or_shared := $(2) 288 289 arch := 290 ifeq ($$(target_or_host),target) 291 arch := $(TARGET_ARCH) 292 else 293 arch := $(HOST_ARCH) 294 endif 295 296 include $(CLEAR_VARS) 297 298 LOCAL_MODULE := libcompiler_rt 299 LOCAL_MODULE_TAGS := optional 300 301 ifeq ($$(static_or_shared),static) 302 LOCAL_MODULE_CLASS := STATIC_LIBRARIES 303 else 304 LOCAL_MODULE_CLASS := SHARED_LIBRARIES 305 endif 306 307 # TODO: Fix -integrated-as 308 # LOCAL_CFLAGS := -integrated-as 309 310 # Add -D__ARM_EABI__ for ARM 311 ifeq ($$(arch),arm) 312 LOCAL_CFLAGS += -D__ARM_EABI__ 313 endif 314 315 # Use Clang to compile libcompiler_rt 316 LOCAL_CLANG := true 317 LOCAL_SRC_FILES := $$(call get-libcompiler-rt-source-files,$$(arch)) 318 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 319 320 ifeq ($$(target_or_host),target) 321 ifeq ($$(static_or_shared),static) 322 include $(BUILD_STATIC_LIBRARY) 323 else 324 include $(BUILD_SHARED_LIBRARY) 325 endif 326 else 327 LOCAL_IS_HOST_MODULE := true 328 ifeq ($$(static_or_shared),static) 329 include $(BUILD_HOST_STATIC_LIBRARY) 330 else 331 include $(BUILD_HOST_SHARED_LIBRARY) 332 endif 333 endif 334endef 335 336#===================================================================== 337# Device Static Library: libcompiler_rt-extras 338#===================================================================== 339 340include $(CLEAR_VARS) 341 342LOCAL_MODULE := libcompiler_rt-extras 343LOCAL_MODULE_TAGS := optional 344LOCAL_MODULE_CLASS := STATIC_LIBRARIES 345LOCAL_CLANG := true 346LOCAL_SRC_FILES := $(libcompiler_rt_extras_SRC_FILES) 347LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 348 349include $(BUILD_STATIC_LIBRARY) 350 351#===================================================================== 352# Device Static Library: libcompiler_rt 353#===================================================================== 354$(eval $(call build-libcompiler-rt,target,static)) 355 356#===================================================================== 357# Device Shared Library: libcompiler_rt 358#===================================================================== 359$(eval $(call build-libcompiler-rt,target,shared)) 360 361# Build ASan 362include $(LOCAL_PATH)/lib/asan/Android.mk 363