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
18//=====================================================================
19// Static Library: libcompiler_rt-extras
20//=====================================================================
21
22cc_library_static {
23    name: "libcompiler_rt-extras",
24    host_supported: true,
25    static_ndk_lib: true,
26    vendor_available: true,
27    sdk_version: "minimum",
28    // The following list contains functions that are not available in libgcc.a, so
29    // we potentially need them when using a Clang-built component (e.g., -ftrapv
30    // with 64-bit integer multiplies. See http://llvm.org/bugs/show_bug.cgi?id=14469.)
31    srcs: ["lib/builtins/mulodi4.c"],
32    sanitize: {
33        never: true,
34    },
35    stl: "none",
36
37    cflags: [
38        "-Wno-unused-parameter",
39        "-Wno-visibility",
40        "-Wno-incompatible-pointer-types",
41        "-Werror",
42    ],
43
44    arch: {
45        mips: {
46            srcs: ["lib/builtins/clear_cache.c"],
47        },
48        mips64: {
49            srcs: ["lib/builtins/clear_cache.c"],
50        },
51        // Clang generates call to __unorddf2 builtin when compiling s_fmal.c
52        // in bionic.  Generate this builtin from compiler-rt for arm64 and
53        // x86_64 (where the corresponding libgcc does not have this builtin.
54        arm64: {
55            srcs: ["lib/builtins/comparedf2.c"],
56        },
57        x86_64: {
58            srcs: ["lib/builtins/comparedf2.c"],
59        },
60    },
61
62    target: {
63        linux_bionic: {
64            enabled: true,
65        },
66        windows: {
67            enabled: true,
68        },
69    },
70}
71
72//=====================================================================
73// Device and Host Static Library: libcompiler_rt
74//=====================================================================
75
76cc_library {
77    name: "libcompiler_rt",
78    vendor_available: false,
79    vndk: {
80        enabled: true,
81        support_system_process: true,
82    },
83    host_supported: true,
84    // The following list contains platform-independent functionalities.
85    //
86    // Skip apple_versioning.c since it is unused.
87    // Skip atomic.c since it needs to be built separately according to the docs.
88    srcs: [
89        "lib/builtins/enable_execute_stack.c",
90        "lib/builtins/absvdi2.c",
91        "lib/builtins/absvsi2.c",
92        "lib/builtins/absvti2.c",
93        "lib/builtins/adddf3.c",
94        "lib/builtins/addsf3.c",
95        "lib/builtins/addtf3.c",
96        "lib/builtins/addvdi3.c",
97        "lib/builtins/addvsi3.c",
98        "lib/builtins/addvti3.c",
99        "lib/builtins/ashldi3.c",
100        "lib/builtins/ashlti3.c",
101        "lib/builtins/ashrdi3.c",
102        "lib/builtins/ashrti3.c",
103        "lib/builtins/clear_cache.c",
104        "lib/builtins/clzdi2.c",
105        "lib/builtins/clzsi2.c",
106        "lib/builtins/clzti2.c",
107        "lib/builtins/cmpdi2.c",
108        "lib/builtins/cmpti2.c",
109        "lib/builtins/comparedf2.c",
110        "lib/builtins/comparesf2.c",
111        "lib/builtins/comparetf2.c",
112        "lib/builtins/ctzdi2.c",
113        "lib/builtins/ctzsi2.c",
114        "lib/builtins/ctzti2.c",
115        "lib/builtins/divdc3.c",
116        "lib/builtins/divdf3.c",
117        "lib/builtins/divdi3.c",
118        "lib/builtins/divmoddi4.c",
119        "lib/builtins/divmodsi4.c",
120        "lib/builtins/divsc3.c",
121        "lib/builtins/divsf3.c",
122        "lib/builtins/divsi3.c",
123        "lib/builtins/divtf3.c",
124        "lib/builtins/divti3.c",
125        "lib/builtins/divxc3.c",
126        "lib/builtins/eprintf.c",
127        "lib/builtins/extenddftf2.c",
128        "lib/builtins/extendhfsf2.c",
129        "lib/builtins/extendsfdf2.c",
130        "lib/builtins/extendsftf2.c",
131        "lib/builtins/ffsdi2.c",
132        "lib/builtins/ffsti2.c",
133        "lib/builtins/fixdfdi.c",
134        "lib/builtins/fixdfsi.c",
135        "lib/builtins/fixdfti.c",
136        "lib/builtins/fixsfdi.c",
137        "lib/builtins/fixsfsi.c",
138        "lib/builtins/fixsfti.c",
139        "lib/builtins/fixtfdi.c",
140        "lib/builtins/fixtfsi.c",
141        "lib/builtins/fixtfti.c",
142        "lib/builtins/fixunsdfdi.c",
143        "lib/builtins/fixunsdfsi.c",
144        "lib/builtins/fixunsdfti.c",
145        "lib/builtins/fixunssfdi.c",
146        "lib/builtins/fixunssfsi.c",
147        "lib/builtins/fixunssfti.c",
148        "lib/builtins/fixunstfdi.c",
149        "lib/builtins/fixunstfsi.c",
150        "lib/builtins/fixunstfti.c",
151        "lib/builtins/fixunsxfdi.c",
152        "lib/builtins/fixunsxfsi.c",
153        "lib/builtins/fixunsxfti.c",
154        "lib/builtins/fixxfdi.c",
155        "lib/builtins/fixxfti.c",
156        "lib/builtins/floatdidf.c",
157        "lib/builtins/floatdisf.c",
158        "lib/builtins/floatdixf.c",
159        "lib/builtins/floatsidf.c",
160        "lib/builtins/floatsisf.c",
161        "lib/builtins/floatsitf.c",
162        "lib/builtins/floattidf.c",
163        "lib/builtins/floattisf.c",
164        "lib/builtins/floattixf.c",
165        "lib/builtins/floatundidf.c",
166        "lib/builtins/floatundisf.c",
167        "lib/builtins/floatundixf.c",
168        "lib/builtins/floatunsidf.c",
169        "lib/builtins/floatunsisf.c",
170        "lib/builtins/floatunsitf.c",
171        "lib/builtins/floatuntidf.c",
172        "lib/builtins/floatuntisf.c",
173        "lib/builtins/floatuntixf.c",
174        "lib/builtins/gcc_personality_v0.c",
175        "lib/builtins/int_util.c",
176        "lib/builtins/lshrdi3.c",
177        "lib/builtins/lshrti3.c",
178        "lib/builtins/moddi3.c",
179        "lib/builtins/modsi3.c",
180        "lib/builtins/modti3.c",
181        "lib/builtins/muldc3.c",
182        "lib/builtins/muldf3.c",
183        "lib/builtins/muldi3.c",
184        "lib/builtins/mulodi4.c",
185        "lib/builtins/mulosi4.c",
186        "lib/builtins/muloti4.c",
187        "lib/builtins/mulsc3.c",
188        "lib/builtins/mulsf3.c",
189        "lib/builtins/multf3.c",
190        "lib/builtins/multi3.c",
191        "lib/builtins/mulvdi3.c",
192        "lib/builtins/mulvsi3.c",
193        "lib/builtins/mulvti3.c",
194        "lib/builtins/mulxc3.c",
195        "lib/builtins/negdf2.c",
196        "lib/builtins/negdi2.c",
197        "lib/builtins/negsf2.c",
198        "lib/builtins/negti2.c",
199        "lib/builtins/negvdi2.c",
200        "lib/builtins/negvsi2.c",
201        "lib/builtins/negvti2.c",
202        "lib/builtins/paritydi2.c",
203        "lib/builtins/paritysi2.c",
204        "lib/builtins/parityti2.c",
205        "lib/builtins/popcountdi2.c",
206        "lib/builtins/popcountsi2.c",
207        "lib/builtins/popcountti2.c",
208        "lib/builtins/powidf2.c",
209        "lib/builtins/powisf2.c",
210        "lib/builtins/powitf2.c",
211        "lib/builtins/powixf2.c",
212        "lib/builtins/subdf3.c",
213        "lib/builtins/subsf3.c",
214        "lib/builtins/subtf3.c",
215        "lib/builtins/subvdi3.c",
216        "lib/builtins/subvsi3.c",
217        "lib/builtins/subvti3.c",
218        "lib/builtins/trampoline_setup.c",
219        "lib/builtins/truncdfhf2.c",
220        "lib/builtins/truncdfsf2.c",
221        "lib/builtins/truncsfhf2.c",
222        "lib/builtins/trunctfdf2.c",
223        "lib/builtins/trunctfsf2.c",
224        "lib/builtins/ucmpdi2.c",
225        "lib/builtins/ucmpti2.c",
226        "lib/builtins/udivdi3.c",
227        "lib/builtins/udivmoddi4.c",
228        "lib/builtins/udivmodsi4.c",
229        "lib/builtins/udivmodti4.c",
230        "lib/builtins/udivsi3.c",
231        "lib/builtins/udivti3.c",
232        "lib/builtins/umoddi3.c",
233        "lib/builtins/umodsi3.c",
234        "lib/builtins/umodti3.c",
235    ],
236
237    cflags: [
238        "-Wno-unused-parameter",
239        "-Wno-visibility",
240        "-Wno-incompatible-pointer-types",
241        "-Werror",
242    ],
243
244    arch: {
245        arm: {
246            cflags: ["-D__ARM_EABI__"],
247            srcs: [
248                "lib/builtins/arm/aeabi_dcmp.S",
249                "lib/builtins/arm/aeabi_div0.c",
250                "lib/builtins/arm/aeabi_fcmp.S",
251                "lib/builtins/arm/aeabi_idivmod.S",
252                "lib/builtins/arm/aeabi_ldivmod.S",
253                "lib/builtins/arm/aeabi_memcmp.S",
254                "lib/builtins/arm/aeabi_memcpy.S",
255                "lib/builtins/arm/aeabi_memmove.S",
256                "lib/builtins/arm/aeabi_memset.S",
257                "lib/builtins/arm/aeabi_uidivmod.S",
258                "lib/builtins/arm/aeabi_uldivmod.S",
259                "lib/builtins/arm/comparesf2.S",
260                "lib/builtins/arm/divmodsi4.S",
261                "lib/builtins/arm/divsi3.S",
262                "lib/builtins/arm/modsi3.S",
263                "lib/builtins/arm/udivmodsi4.S",
264                "lib/builtins/arm/udivsi3.S",
265                "lib/builtins/arm/umodsi3.S",
266                "lib/builtins/arm/adddf3vfp.S",
267                "lib/builtins/arm/addsf3vfp.S",
268                "lib/builtins/arm/divdf3vfp.S",
269                "lib/builtins/arm/divsf3vfp.S",
270                "lib/builtins/arm/eqdf2vfp.S",
271                "lib/builtins/arm/eqsf2vfp.S",
272                "lib/builtins/arm/extendsfdf2vfp.S",
273                "lib/builtins/arm/fixdfsivfp.S",
274                "lib/builtins/arm/fixsfsivfp.S",
275                "lib/builtins/arm/fixunsdfsivfp.S",
276                "lib/builtins/arm/fixunssfsivfp.S",
277                "lib/builtins/arm/floatsidfvfp.S",
278                "lib/builtins/arm/floatsisfvfp.S",
279                "lib/builtins/arm/floatunssidfvfp.S",
280                "lib/builtins/arm/floatunssisfvfp.S",
281                "lib/builtins/arm/gedf2vfp.S",
282                "lib/builtins/arm/gesf2vfp.S",
283                "lib/builtins/arm/gtdf2vfp.S",
284                "lib/builtins/arm/gtsf2vfp.S",
285                "lib/builtins/arm/ledf2vfp.S",
286                "lib/builtins/arm/lesf2vfp.S",
287                "lib/builtins/arm/ltdf2vfp.S",
288                "lib/builtins/arm/ltsf2vfp.S",
289                "lib/builtins/arm/muldf3vfp.S",
290                "lib/builtins/arm/mulsf3vfp.S",
291                "lib/builtins/arm/nedf2vfp.S",
292                "lib/builtins/arm/negdf2vfp.S",
293                "lib/builtins/arm/negsf2vfp.S",
294                "lib/builtins/arm/nesf2vfp.S",
295                "lib/builtins/arm/subdf3vfp.S",
296                "lib/builtins/arm/subsf3vfp.S",
297                "lib/builtins/arm/truncdfsf2vfp.S",
298                "lib/builtins/arm/unorddf2vfp.S",
299                "lib/builtins/arm/unordsf2vfp.S",
300            ],
301            exclude_srcs: [
302                "lib/builtins/comparesf2.c",
303                "lib/builtins/divmodsi4.c",
304                "lib/builtins/divsi3.c",
305                "lib/builtins/modsi3.c",
306                "lib/builtins/udivmodsi4.c",
307                "lib/builtins/udivsi3.c",
308                "lib/builtins/umodsi3.c",
309            ],
310        },
311        mips64: {
312            cflags: [
313                "-DCRT_HAS_128BIT",
314            ],
315        },
316        x86: {
317            srcs: [
318                "lib/builtins/i386/ashldi3.S",
319                "lib/builtins/i386/ashrdi3.S",
320                "lib/builtins/i386/divdi3.S",
321                "lib/builtins/i386/floatdidf.S",
322                "lib/builtins/i386/floatdisf.S",
323                "lib/builtins/i386/floatdixf.S",
324                "lib/builtins/i386/floatundidf.S",
325                "lib/builtins/i386/floatundisf.S",
326                "lib/builtins/i386/floatundixf.S",
327                "lib/builtins/i386/lshrdi3.S",
328                "lib/builtins/i386/moddi3.S",
329                "lib/builtins/i386/muldi3.S",
330                "lib/builtins/i386/udivdi3.S",
331                "lib/builtins/i386/umoddi3.S",
332            ],
333            exclude_srcs: [
334                "lib/builtins/ashldi3.c",
335                "lib/builtins/ashrdi3.c",
336                "lib/builtins/divdi3.c",
337                "lib/builtins/floatdidf.c",
338                "lib/builtins/floatdisf.c",
339                "lib/builtins/floatdixf.c",
340                "lib/builtins/floatundidf.c",
341                "lib/builtins/floatundisf.c",
342                "lib/builtins/floatundixf.c",
343                "lib/builtins/lshrdi3.c",
344                "lib/builtins/moddi3.c",
345                "lib/builtins/muldi3.c",
346                "lib/builtins/udivdi3.c",
347                "lib/builtins/umoddi3.c",
348            ],
349        },
350        x86_64: {
351            srcs: [
352                "lib/builtins/x86_64/floatundixf.S",
353                "lib/builtins/x86_64/floatdisf.c",
354                "lib/builtins/x86_64/floatdidf.c",
355                "lib/builtins/x86_64/floatdixf.c",
356                "lib/builtins/x86_64/floatundisf.S",
357                "lib/builtins/x86_64/floatundidf.S",
358            ],
359            exclude_srcs: [
360                "lib/builtins/floatundixf.c",
361                "lib/builtins/floatdisf.c",
362                "lib/builtins/floatdidf.c",
363                "lib/builtins/floatdixf.c",
364                "lib/builtins/floatundisf.c",
365                "lib/builtins/floatundidf.c",
366            ],
367        },
368    },
369
370    sdk_version: "21",
371    target: {
372        android: {
373            shared_libs: ["liblog"],
374            static_libs: ["liblzma"],
375        },
376        android_arm: {
377            static_libs: ["libunwind_llvm"],
378            ldflags: ["-Wl,--exclude-libs,libunwind_llvm.a"],
379        },
380        android_arm64: {
381            static_libs: ["libunwindbacktrace", "libunwind"],
382            ldflags: ["-Wl,--exclude-libs,libunwindbacktrace.a:libunwind.a"],
383        },
384        android_mips: {
385            static_libs: ["libunwindbacktrace", "libunwind"],
386            ldflags: ["-Wl,--exclude-libs,libunwindbacktrace.a:libunwind.a"],
387        },
388        android_mips64: {
389            static_libs: ["libunwindbacktrace", "libunwind"],
390            ldflags: ["-Wl,--exclude-libs,libunwindbacktrace.a:libunwind.a"],
391        },
392        android_x86: {
393            static_libs: ["libunwindbacktrace", "libunwind"],
394            ldflags: ["-Wl,--exclude-libs,libunwindbacktrace.a:libunwind.a"],
395        },
396        android_x86_64: {
397            srcs: ["lib/builtins/ppc/floatditf.c"],
398            static_libs: ["libunwindbacktrace", "libunwind"],
399            ldflags: ["-Wl,--exclude-libs,libunwindbacktrace.a:libunwind.a"],
400        },
401        linux_glibc: {
402            static_libs: ["libunwindbacktrace", "libunwind"],
403            shared_libs: ["liblzma"],
404        },
405        windows: {
406            static_libs: ["libunwindbacktrace", "libunwind"],
407            // Only build enable_execute_stack.c on non-Windows hosts.
408            exclude_srcs: ["lib/builtins/enable_execute_stack.c"],
409        },
410    },
411
412    asflags: ["-integrated-as"],
413    no_libgcc: true,
414
415    sanitize: {
416        never: true,
417    },
418    stl: "none",
419}
420
421cc_defaults {
422    name: "asan_arch_defaults",
423
424    vendor_available: true,
425    enabled: false,
426    target: {
427        android_arm: {
428            enabled: true,
429        },
430        android_arm64: {
431            enabled: true,
432        },
433        android_mips: {
434            enabled: true,
435        },
436        android_mips64: {
437            enabled: true,
438        },
439        android_x86: {
440            enabled: true,
441        },
442        android_x86_64: {
443            enabled: true,
444        },
445        linux_glibc: {
446            enabled: true,
447        },
448    },
449}
450
451subdirs=["lib/*"]
452