Debian Codegraph @

llvm-project/utils/bazel/llvm-project-overlay/libc/BUILD.bazel

raw
1 # This file is licensed under the Apache License v2.0 with LLVM Exceptions.
2 # See https://llvm.org/LICENSE.txt for license information.
3 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5 # LLVM libc project.
6 load(
7 ":libc_build_rules.bzl",
8 "libc_function",
9 "libc_math_function",
10 "libc_support_library",
11 )
12 load(":platforms.bzl", "PLATFORM_CPU_ARM64", "PLATFORM_CPU_X86_64")
13 load("@bazel_skylib//lib:selects.bzl", "selects")
14 load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
15
16 package(
17 default_visibility = ["//visibility:public"],
18 features = ["-use_header_modules"],
19 )
20
21 licenses(["notice"])
22
23 # A flag to pick which `mpfr` to use for math tests.
24 # Usage: `--@llvm-project//libc:mpfr=<disable|external|system>`.
25 # Flag documentation: https://bazel.build/extending/config
26 string_flag(
27 name = "mpfr",
28 build_setting_default = "external",
29 values = [
30 "disable", # Skip tests that need mpfr
31 "external", # Build mpfr from source
32 "system", # Use system mpfr (non hermetic)
33 ],
34 )
35
36 config_setting(
37 name = "mpfr_disable",
38 flag_values = {":mpfr": "disable"},
39 )
40
41 config_setting(
42 name = "mpfr_external",
43 flag_values = {":mpfr": "external"},
44 )
45
46 config_setting(
47 name = "mpfr_system",
48 flag_values = {":mpfr": "system"},
49 )
50
51 # This empty root library helps us add an include path to this directory
52 # using the 'includes' attribute. The strings listed in the includes attribute
53 # are relative paths wrt this library but are inherited by the dependents
54 # appropriately. Hence, using this as a root dependency avoids adding include
55 # paths of the kind "../../" to other libc targets.
56 cc_library(
57 name = "libc_root",
58 includes = ["."],
59 )
60
61 ############################## Support libraries #############################
62
63 libc_support_library(
64 name = "__support_compiler_features",
65 hdrs = ["src/__support/compiler_features.h"],
66 )
67
68 libc_support_library(
69 name = "__support_sanitizer",
70 hdrs = ["src/__support/sanitizer.h"],
71 deps = [
72 ":__support_compiler_features",
73 ":libc_root",
74 ],
75 )
76
77 libc_support_library(
78 name = "__support_common",
79 hdrs = [
80 "src/__support/architectures.h",
81 "src/__support/common.h",
82 "src/__support/endian.h",
83 ],
84 )
85
86 libc_support_library(
87 name = "__support_cpp_array",
88 hdrs = ["src/__support/CPP/array.h"],
89 deps = [":libc_root"],
90 )
91
92 libc_support_library(
93 name = "__support_cpp_bit",
94 hdrs = ["src/__support/CPP/bit.h"],
95 deps = [
96 ":__support_compiler_features",
97 ":libc_root",
98 ],
99 )
100
101 libc_support_library(
102 name = "__support_cpp_bitset",
103 hdrs = ["src/__support/CPP/bitset.h"],
104 deps = [":libc_root"],
105 )
106
107 libc_support_library(
108 name = "__support_cpp_cstddef",
109 hdrs = ["src/__support/CPP/cstddef.h"],
110 deps = [
111 "__support_cpp_type_traits",
112 ":libc_root",
113 ],
114 )
115
116 libc_support_library(
117 name = "__support_cpp_functional",
118 hdrs = ["src/__support/CPP/functional.h"],
119 deps = [":libc_root"],
120 )
121
122 libc_support_library(
123 name = "__support_cpp_limits",
124 hdrs = ["src/__support/CPP/limits.h"],
125 deps = [":libc_root"],
126 )
127
128 libc_support_library(
129 name = "__support_cpp_optional",
130 hdrs = ["src/__support/CPP/optional.h"],
131 deps = [":libc_root"],
132 )
133
134 libc_support_library(
135 name = "__support_cpp_span",
136 hdrs = ["src/__support/CPP/span.h"],
137 deps = [
138 "__support_cpp_array",
139 "__support_cpp_type_traits",
140 ":libc_root",
141 ],
142 )
143
144 libc_support_library(
145 name = "__support_cpp_string_view",
146 hdrs = ["src/__support/CPP/string_view.h"],
147 deps = [
148 ":__support_common",
149 ":libc_root",
150 ],
151 )
152
153 libc_support_library(
154 name = "__support_cpp_type_traits",
155 hdrs = ["src/__support/CPP/type_traits.h"],
156 deps = [":libc_root"],
157 )
158
159 libc_support_library(
160 name = "__support_cpp_utility",
161 hdrs = ["src/__support/CPP/utility.h"],
162 deps = [
163 ":__support_cpp_type_traits",
164 ":libc_root",
165 ],
166 )
167
168 libc_support_library(
169 name = "__support_cpp_atomic",
170 hdrs = ["src/__support/CPP/atomic.h"],
171 deps = [
172 ":__support_cpp_type_traits",
173 ":libc_root",
174 ],
175 )
176
177 libc_support_library(
178 name = "__support_number_pair",
179 hdrs = ["src/__support/number_pair.h"],
180 deps = [
181 "__support_cpp_type_traits",
182 "__support_named_pair",
183 ":libc_root",
184 ],
185 )
186
187 libc_support_library(
188 name = "__support_integer_utils",
189 hdrs = ["src/__support/integer_utils.h"],
190 deps = [
191 "__support_builtin_wrappers",
192 "__support_cpp_type_traits",
193 "__support_number_pair",
194 ":libc_root",
195 ],
196 )
197
198 libc_support_library(
199 name = "__support_uint",
200 hdrs = ["src/__support/UInt.h"],
201 deps = [
202 "__support_builtin_wrappers",
203 "__support_common",
204 "__support_compiler_features",
205 "__support_cpp_array",
206 "__support_cpp_limits",
207 "__support_cpp_optional",
208 "__support_cpp_type_traits",
209 "__support_integer_utils",
210 "__support_number_pair",
211 ":libc_root",
212 ],
213 )
214
215 libc_support_library(
216 name = "__support_uint128",
217 hdrs = ["src/__support/UInt128.h"],
218 deps = [
219 ":__support_uint",
220 ":libc_root",
221 ],
222 )
223
224 libc_support_library(
225 name = "__support_str_to_num_result",
226 hdrs = ["src/__support/str_to_num_result.h"],
227 deps = [
228 ":libc_root",
229 ],
230 )
231
232 libc_support_library(
233 name = "__support_integer_operations",
234 hdrs = ["src/__support/integer_operations.h"],
235 deps = [":__support_cpp_type_traits"],
236 )
237
238 libc_support_library(
239 name = "__support_ctype_utils",
240 hdrs = ["src/__support/ctype_utils.h"],
241 )
242
243 libc_support_library(
244 name = "__support_str_to_integer",
245 hdrs = ["src/__support/str_to_integer.h"],
246 deps = [
247 ":__support_common",
248 ":__support_cpp_limits",
249 ":__support_ctype_utils",
250 ":__support_str_to_num_result",
251 ],
252 )
253
254 libc_support_library(
255 name = "__support_fputil_basic_operations",
256 hdrs = ["src/__support/FPUtil/BasicOperations.h"],
257 deps = [
258 ":__support_common",
259 ":__support_cpp_type_traits",
260 ":__support_fputil_fp_bits",
261 ":libc_root",
262 ],
263 )
264
265 libc_support_library(
266 name = "__support_named_pair",
267 hdrs = ["src/__support/named_pair.h"],
268 deps = [":libc_root"],
269 )
270
271 libc_support_library(
272 name = "__support_builtin_wrappers",
273 hdrs = ["src/__support/builtin_wrappers.h"],
274 deps = [
275 ":__support_common",
276 ":__support_compiler_features",
277 ":__support_cpp_type_traits",
278 ":__support_named_pair",
279 ":libc_root",
280 ],
281 )
282
283 libc_support_library(
284 name = "__support_fputil_division_and_remainder_operations",
285 hdrs = ["src/__support/FPUtil/DivisionAndRemainderOperations.h"],
286 deps = [
287 ":__support_common",
288 ":__support_cpp_type_traits",
289 ":__support_fputil_fp_bits",
290 ":__support_fputil_manipulation_functions",
291 ":__support_fputil_normal_float",
292 ":libc_root",
293 ],
294 )
295
296 libc_support_library(
297 name = "__support_fputil_except_value_utils",
298 hdrs = ["src/__support/FPUtil/except_value_utils.h"],
299 deps = [
300 ":__support_cpp_optional",
301 ":__support_fputil_fenv_impl",
302 ":__support_fputil_fp_bits",
303 ":libc_root",
304 ],
305 )
306
307 libc_support_library(
308 name = "__support_fputil_fenv_impl",
309 hdrs = ["src/__support/FPUtil/FEnvImpl.h"],
310 textual_hdrs = [
311 "src/__support/FPUtil/x86_64/FEnvImpl.h",
312 "src/__support/FPUtil/aarch64/FEnvImpl.h",
313 "src/__support/FPUtil/aarch64/fenv_darwin_impl.h",
314 ],
315 deps = [
316 ":__support_common",
317 ":__support_compiler_features",
318 ":__support_fputil_fp_bits",
319 ":__support_sanitizer",
320 ":libc_root",
321 ],
322 )
323
324 libc_support_library(
325 name = "__support_fputil_float_properties",
326 hdrs = ["src/__support/FPUtil/FloatProperties.h"],
327 deps = [
328 ":__support_fputil_platform_defs",
329 ":__support_uint128",
330 ":libc_root",
331 ],
332 )
333
334 libc_support_library(
335 name = "__support_fputil_fp_bits",
336 hdrs = ["src/__support/FPUtil/FPBits.h"],
337 textual_hdrs = ["src/__support/FPUtil/x86_64/LongDoubleBits.h"],
338 deps = [
339 ":__support_builtin_wrappers",
340 ":__support_common",
341 ":__support_cpp_bit",
342 ":__support_cpp_type_traits",
343 ":__support_fputil_float_properties",
344 ":__support_fputil_platform_defs",
345 ":__support_uint128",
346 ":libc_root",
347 ],
348 )
349
350 libc_support_library(
351 name = "__support_fputil_hypot",
352 hdrs = ["src/__support/FPUtil/Hypot.h"],
353 deps = [
354 ":__support_builtin_wrappers",
355 ":__support_common",
356 ":__support_cpp_bit",
357 ":__support_cpp_type_traits",
358 ":__support_fputil_basic_operations",
359 ":__support_fputil_fenv_impl",
360 ":__support_fputil_fp_bits",
361 ":__support_uint128",
362 ":libc_root",
363 ],
364 )
365
366 libc_support_library(
367 name = "__support_fputil_manipulation_functions",
368 hdrs = ["src/__support/FPUtil/ManipulationFunctions.h"],
369 textual_hdrs = ["src/__support/FPUtil/x86_64/NextAfterLongDouble.h"],
370 deps = [
371 ":__support_common",
372 ":__support_cpp_bit",
373 ":__support_cpp_type_traits",
374 ":__support_fputil_fp_bits",
375 ":__support_fputil_nearest_integer_operations",
376 ":__support_fputil_normal_float",
377 ":__support_fputil_platform_defs",
378 ":__support_uint128",
379 ":libc_root",
380 ],
381 )
382
383 libc_support_library(
384 name = "__support_fputil_nearest_integer_operations",
385 hdrs = ["src/__support/FPUtil/NearestIntegerOperations.h"],
386 deps = [
387 ":__support_common",
388 ":__support_cpp_type_traits",
389 ":__support_fputil_fenv_impl",
390 ":__support_fputil_fp_bits",
391 ":libc_root",
392 ],
393 )
394
395 libc_support_library(
396 name = "__support_fputil_normal_float",
397 hdrs = ["src/__support/FPUtil/NormalFloat.h"],
398 deps = [
399 ":__support_common",
400 ":__support_cpp_type_traits",
401 ":__support_fputil_fp_bits",
402 ":libc_root",
403 ],
404 )
405
406 libc_support_library(
407 name = "__support_fputil_platform_defs",
408 hdrs = ["src/__support/FPUtil/PlatformDefs.h"],
409 deps = [
410 ":__support_common",
411 ":libc_root",
412 ],
413 )
414
415 sqrt_common_hdrs = [
416 "src/__support/FPUtil/sqrt.h",
417 "src/__support/FPUtil/generic/sqrt.h",
418 "src/__support/FPUtil/generic/sqrt_80_bit_long_double.h",
419 ]
420
421 sqrt_hdrs = selects.with_or({
422 "//conditions:default": sqrt_common_hdrs,
423 PLATFORM_CPU_X86_64: sqrt_common_hdrs + [
424 "src/__support/FPUtil/x86_64/sqrt.h",
425 ],
426 PLATFORM_CPU_ARM64: sqrt_common_hdrs + [
427 "src/__support/FPUtil/aarch64/sqrt.h",
428 ],
429 })
430
431 libc_support_library(
432 name = "__support_fputil_sqrt",
433 hdrs = sqrt_hdrs,
434 deps = [
435 ":__support_builtin_wrappers",
436 ":__support_common",
437 ":__support_cpp_bit",
438 ":__support_cpp_type_traits",
439 ":__support_fputil_fenv_impl",
440 ":__support_fputil_fp_bits",
441 ":__support_fputil_platform_defs",
442 ":__support_uint128",
443 ":libc_root",
444 ],
445 )
446
447 fma_common_hdrs = [
448 "src/__support/FPUtil/FMA.h",
449 "src/__support/FPUtil/generic/FMA.h",
450 ]
451
452 fma_platform_hdrs = [
453 "src/__support/FPUtil/x86_64/FMA.h",
454 "src/__support/FPUtil/aarch64/FMA.h",
455 ]
456
457 libc_support_library(
458 name = "__support_fputil_fma",
459 hdrs = fma_common_hdrs,
460 # These are conditionally included and will #error out if the platform
461 # doesn't support FMA, so they can't be compiled on their own.
462 textual_hdrs = fma_platform_hdrs,
463 deps = [
464 ":__support_builtin_wrappers",
465 ":__support_common",
466 ":__support_cpp_bit",
467 ":__support_cpp_type_traits",
468 ":__support_fputil_fenv_impl",
469 ":__support_fputil_float_properties",
470 ":__support_fputil_fp_bits",
471 ":__support_uint128",
472 ":libc_root",
473 ],
474 )
475
476 libc_support_library(
477 name = "__support_fputil_multiply_add",
478 hdrs = [
479 "src/__support/FPUtil/multiply_add.h",
480 ],
481 deps = [
482 ":__support_common",
483 ":__support_fputil_fma",
484 ],
485 )
486
487 libc_support_library(
488 name = "__support_fputil_polyeval",
489 hdrs = [
490 "src/__support/FPUtil/PolyEval.h",
491 ],
492 deps = [
493 ":__support_common",
494 ":__support_fputil_multiply_add",
495 ],
496 )
497
498 nearest_integer_common_hdrs = [
499 "src/__support/FPUtil/nearest_integer.h",
500 ]
501
502 nearest_integer_platform_hdrs = [
503 "src/__support/FPUtil/x86_64/nearest_integer.h",
504 "src/__support/FPUtil/aarch64/nearest_integer.h",
505 ]
506
507 libc_support_library(
508 name = "__support_fputil_nearest_integer",
509 hdrs = nearest_integer_common_hdrs,
510 # These are conditionally included and will #error out if the platform
511 # doesn't support rounding instructions, so they can't be compiled on their
512 # own.
513 textual_hdrs = nearest_integer_platform_hdrs,
514 deps = [
515 ":__support_common",
516 ":libc_root",
517 ],
518 )
519
520 libc_support_library(
521 name = "__support_osutil",
522 hdrs = ["src/__support/OSUtil/syscall.h"],
523 textual_hdrs = [
524 "src/__support/OSUtil/linux/syscall.h",
525 "src/__support/OSUtil/linux/aarch64/syscall.h",
526 "src/__support/OSUtil/linux/x86_64/syscall.h",
527 ],
528 deps = [
529 ":__support_common",
530 ":libc_root",
531 ],
532 )
533
534 ################################ fenv targets ################################
535
536 libc_function(
537 name = "fetestexcept",
538 srcs = ["src/fenv/fetestexcept.cpp"],
539 hdrs = ["src/fenv/fetestexcept.h"],
540 deps = [
541 ":__support_common",
542 ":__support_fputil_fenv_impl",
543 ],
544 )
545
546 libc_function(
547 name = "feclearexcept",
548 srcs = ["src/fenv/feclearexcept.cpp"],
549 hdrs = ["src/fenv/feclearexcept.h"],
550 deps = [
551 ":__support_common",
552 ":__support_fputil_fenv_impl",
553 ],
554 )
555
556 libc_function(
557 name = "feraiseexcept",
558 srcs = ["src/fenv/feraiseexcept.cpp"],
559 hdrs = ["src/fenv/feraiseexcept.h"],
560 deps = [
561 ":__support_common",
562 ":__support_fputil_fenv_impl",
563 ],
564 )
565
566 libc_function(
567 name = "fegetround",
568 srcs = ["src/fenv/fegetround.cpp"],
569 hdrs = ["src/fenv/fegetround.h"],
570 deps = [
571 ":__support_common",
572 ":__support_fputil_fenv_impl",
573 ],
574 )
575
576 libc_function(
577 name = "fesetround",
578 srcs = ["src/fenv/fesetround.cpp"],
579 hdrs = ["src/fenv/fesetround.h"],
580 deps = [
581 ":__support_common",
582 ":__support_fputil_fenv_impl",
583 ],
584 )
585
586 libc_function(
587 name = "fedisableexcept",
588 srcs = ["src/fenv/fedisableexcept.cpp"],
589 hdrs = ["src/fenv/fedisableexcept.h"],
590 deps = [
591 ":__support_common",
592 ":__support_fputil_fenv_impl",
593 ],
594 )
595
596 libc_function(
597 name = "feenableexcept",
598 srcs = ["src/fenv/feenableexcept.cpp"],
599 hdrs = ["src/fenv/feenableexcept.h"],
600 deps = [
601 ":__support_common",
602 ":__support_fputil_fenv_impl",
603 ],
604 )
605
606 libc_function(
607 name = "fegetexcept",
608 srcs = ["src/fenv/fegetexcept.cpp"],
609 hdrs = ["src/fenv/fegetexcept.h"],
610 deps = [
611 ":__support_common",
612 ":__support_fputil_fenv_impl",
613 ],
614 )
615
616 libc_function(
617 name = "fegetenv",
618 srcs = ["src/fenv/fegetenv.cpp"],
619 hdrs = ["src/fenv/fegetenv.h"],
620 deps = [
621 ":__support_common",
622 ":__support_fputil_fenv_impl",
623 ],
624 )
625
626 libc_function(
627 name = "fesetenv",
628 srcs = ["src/fenv/fesetenv.cpp"],
629 hdrs = ["src/fenv/fesetenv.h"],
630 deps = [
631 ":__support_common",
632 ":__support_fputil_fenv_impl",
633 ],
634 )
635
636 libc_function(
637 name = "feupdateenv",
638 srcs = ["src/fenv/feupdateenv.cpp"],
639 hdrs = ["src/fenv/feupdateenv.h"],
640 deps = [
641 ":__support_common",
642 ":__support_fputil_fenv_impl",
643 ],
644 )
645
646 libc_function(
647 name = "fegetexceptflag",
648 srcs = ["src/fenv/fegetexceptflag.cpp"],
649 hdrs = ["src/fenv/fegetexceptflag.h"],
650 deps = [
651 ":__support_common",
652 ":__support_fputil_fenv_impl",
653 ],
654 )
655
656 libc_function(
657 name = "fesetexceptflag",
658 srcs = ["src/fenv/fesetexceptflag.cpp"],
659 hdrs = ["src/fenv/fesetexceptflag.h"],
660 deps = [
661 ":__support_common",
662 ":__support_fputil_fenv_impl",
663 ],
664 )
665
666 libc_function(
667 name = "feholdexcept",
668 srcs = ["src/fenv/feholdexcept.cpp"],
669 hdrs = ["src/fenv/feholdexcept.h"],
670 deps = [
671 ":__support_common",
672 ":__support_fputil_fenv_impl",
673 ],
674 )
675
676 ################################ math targets ################################
677
678 libc_support_library(
679 name = "math_utils",
680 srcs = ["src/math/generic/math_utils.cpp"],
681 hdrs = ["src/math/generic/math_utils.h"],
682 deps = [
683 "__support_cpp_bit",
684 "__support_cpp_type_traits",
685 ":__support_common",
686 ":libc_root",
687 ],
688 )
689
690 libc_support_library(
691 name = "common_constants",
692 srcs = ["src/math/generic/common_constants.cpp"],
693 hdrs = ["src/math/generic/common_constants.h"],
694 deps = [
695 ":libc_root",
696 ],
697 )
698
699 libc_support_library(
700 name = "range_reduction",
701 hdrs = [
702 "src/math/generic/range_reduction.h",
703 "src/math/generic/range_reduction_fma.h",
704 ],
705 deps = [
706 ":__support_common",
707 ":__support_fputil_fma",
708 ":__support_fputil_fp_bits",
709 ":__support_fputil_multiply_add",
710 ":__support_fputil_nearest_integer",
711 ":libc_root",
712 ],
713 )
714
715 libc_support_library(
716 name = "sincosf_utils",
717 hdrs = ["src/math/generic/sincosf_utils.h"],
718 deps = [
719 ":__support_common",
720 ":__support_fputil_fp_bits",
721 ":__support_fputil_polyeval",
722 ":libc_root",
723 ":range_reduction",
724 ],
725 )
726
727 libc_math_function(
728 name = "expm1f",
729 additional_deps = [
730 ":__support_fputil_fma",
731 ":__support_fputil_nearest_integer",
732 ":__support_fputil_multiply_add",
733 ":__support_fputil_polyeval",
734 ":common_constants",
735 ],
736 )
737
738 libc_math_function(name = "fabs")
739
740 libc_math_function(name = "fabsf")
741
742 libc_math_function(name = "fabsl")
743
744 libc_math_function(name = "fdim")
745
746 libc_math_function(name = "fdimf")
747
748 libc_math_function(name = "fdiml")
749
750 libc_math_function(
751 name = "ceil",
752 specializations = [
753 "aarch64",
754 "generic",
755 ],
756 )
757
758 libc_math_function(
759 name = "ceilf",
760 specializations = [
761 "aarch64",
762 "generic",
763 ],
764 )
765
766 libc_math_function(
767 name = "ceill",
768 specializations = [
769 "generic",
770 ],
771 )
772
773 libc_math_function(
774 name = "floor",
775 specializations = [
776 "aarch64",
777 "generic",
778 ],
779 )
780
781 libc_math_function(
782 name = "floorf",
783 specializations = [
784 "aarch64",
785 "generic",
786 ],
787 )
788
789 libc_math_function(name = "floorl")
790
791 libc_math_function(name = "ldexp")
792
793 libc_math_function(name = "ldexpf")
794
795 libc_math_function(name = "ldexpl")
796
797 libc_math_function(
798 name = "trunc",
799 specializations = [
800 "aarch64",
801 "generic",
802 ],
803 )
804
805 libc_math_function(
806 name = "truncf",
807 specializations = [
808 "aarch64",
809 "generic",
810 ],
811 )
812
813 libc_math_function(name = "truncl")
814
815 libc_math_function(
816 name = "round",
817 specializations = [
818 "aarch64",
819 "generic",
820 ],
821 )
822
823 libc_math_function(
824 name = "roundf",
825 specializations = [
826 "aarch64",
827 "generic",
828 ],
829 )
830
831 libc_math_function(name = "roundl")
832
833 libc_math_function(name = "frexp")
834
835 libc_math_function(name = "frexpf")
836
837 libc_math_function(name = "frexpl")
838
839 libc_math_function(name = "hypot")
840
841 libc_math_function(
842 name = "hypotf",
843 additional_deps = [
844 ":__support_fputil_sqrt",
845 ],
846 )
847
848 libc_math_function(name = "logb")
849
850 libc_math_function(name = "logbf")
851
852 libc_math_function(name = "logbl")
853
854 libc_math_function(name = "modf")
855
856 libc_math_function(name = "modff")
857
858 libc_math_function(name = "modfl")
859
860 libc_math_function(name = "remquo")
861
862 libc_math_function(name = "remquof")
863
864 libc_math_function(name = "remquol")
865
866 libc_math_function(name = "remainder")
867
868 libc_math_function(name = "remainderf")
869
870 libc_math_function(name = "remainderl")
871
872 libc_math_function(name = "fmin")
873
874 libc_math_function(name = "fminf")
875
876 libc_math_function(name = "fminl")
877
878 libc_math_function(name = "fmax")
879
880 libc_math_function(name = "fmaxf")
881
882 libc_math_function(name = "fmaxl")
883
884 libc_math_function(
885 name = "cosf",
886 additional_deps = [
887 ":__support_fputil_fma",
888 ":__support_fputil_multiply_add",
889 ":sincosf_utils",
890 ],
891 )
892
893 libc_math_function(
894 name = "sincosf",
895 additional_deps = [
896 ":__support_fputil_fma",
897 ":__support_fputil_multiply_add",
898 ":sincosf_utils",
899 ],
900 )
901
902 libc_math_function(
903 name = "sinf",
904 additional_deps = [
905 ":__support_fputil_fma",
906 ":__support_fputil_multiply_add",
907 ":__support_fputil_polyeval",
908 ":range_reduction",
909 ":sincosf_utils",
910 ],
911 )
912
913 libc_math_function(
914 name = "sqrt",
915 additional_deps = [
916 ":__support_fputil_sqrt",
917 ],
918 )
919
920 libc_math_function(
921 name = "sqrtf",
922 additional_deps = [
923 ":__support_fputil_sqrt",
924 ],
925 )
926
927 libc_math_function(
928 name = "sqrtl",
929 additional_deps = [
930 ":__support_fputil_sqrt",
931 ],
932 )
933
934 libc_math_function(name = "copysign")
935
936 libc_math_function(name = "copysignf")
937
938 libc_math_function(name = "copysignl")
939
940 libc_math_function(name = "ilogb")
941
942 libc_math_function(name = "ilogbf")
943
944 libc_math_function(name = "ilogbl")
945
946 libc_math_function(name = "rint")
947
948 libc_math_function(name = "rintf")
949
950 libc_math_function(name = "rintl")
951
952 libc_math_function(name = "lrint")
953
954 libc_math_function(name = "lrintf")
955
956 libc_math_function(name = "lrintl")
957
958 libc_math_function(name = "llrint")
959
960 libc_math_function(name = "llrintf")
961
962 libc_math_function(name = "llrintl")
963
964 libc_math_function(name = "lround")
965
966 libc_math_function(name = "lroundf")
967
968 libc_math_function(name = "lroundl")
969
970 libc_math_function(name = "llround")
971
972 libc_math_function(name = "llroundf")
973
974 libc_math_function(name = "llroundl")
975
976 libc_math_function(name = "nearbyint")
977
978 libc_math_function(name = "nearbyintf")
979
980 libc_math_function(name = "nearbyintl")
981
982 libc_math_function(name = "nextafter")
983
984 libc_math_function(name = "nextafterf")
985
986 libc_math_function(name = "nextafterl")
987
988 ############################### stdlib targets ###############################
989
990 libc_function(
991 name = "atoi",
992 srcs = ["src/stdlib/atoi.cpp"],
993 hdrs = ["src/stdlib/atoi.h"],
994 deps = [
995 ":__support_common",
996 ":__support_str_to_integer",
997 ],
998 )
999
1000 libc_function(
1001 name = "atol",
1002 srcs = ["src/stdlib/atol.cpp"],
1003 hdrs = ["src/stdlib/atol.h"],
1004 deps = [
1005 ":__support_common",
1006 ":__support_str_to_integer",
1007 ],
1008 )
1009
1010 libc_function(
1011 name = "atoll",
1012 srcs = ["src/stdlib/atoll.cpp"],
1013 hdrs = ["src/stdlib/atoll.h"],
1014 deps = [
1015 ":__support_common",
1016 ":__support_str_to_integer",
1017 ],
1018 )
1019
1020 libc_function(
1021 name = "bsearch",
1022 srcs = ["src/stdlib/bsearch.cpp"],
1023 hdrs = ["src/stdlib/bsearch.h"],
1024 deps = [
1025 ":__support_common",
1026 ],
1027 )
1028
1029 libc_function(
1030 name = "qsort",
1031 srcs = ["src/stdlib/qsort.cpp"],
1032 hdrs = ["src/stdlib/qsort.h"],
1033 deps = [
1034 ":__support_common",
1035 ],
1036 )
1037
1038 libc_function(
1039 name = "strtol",
1040 srcs = ["src/stdlib/strtol.cpp"],
1041 hdrs = ["src/stdlib/strtol.h"],
1042 deps = [
1043 ":__support_common",
1044 ":__support_str_to_integer",
1045 ],
1046 )
1047
1048 libc_function(
1049 name = "strtoll",
1050 srcs = ["src/stdlib/strtoll.cpp"],
1051 hdrs = ["src/stdlib/strtoll.h"],
1052 deps = [
1053 ":__support_common",
1054 ":__support_str_to_integer",
1055 ],
1056 )
1057
1058 libc_function(
1059 name = "strtoul",
1060 srcs = ["src/stdlib/strtoul.cpp"],
1061 hdrs = ["src/stdlib/strtoul.h"],
1062 deps = [
1063 ":__support_common",
1064 ":__support_str_to_integer",
1065 ],
1066 )
1067
1068 libc_function(
1069 name = "strtoull",
1070 srcs = ["src/stdlib/strtoull.cpp"],
1071 hdrs = ["src/stdlib/strtoull.h"],
1072 deps = [
1073 ":__support_common",
1074 ":__support_str_to_integer",
1075 ],
1076 )
1077
1078 ############################### string targets ###############################
1079
1080 no_sanitize_features = [
1081 "-asan",
1082 "-msan",
1083 "-tsan",
1084 "-ubsan",
1085 ]
1086
1087 libc_support_library(
1088 name = "string_memory_utils",
1089 hdrs = [
1090 "src/string/memory_utils/op_aarch64.h",
1091 "src/string/memory_utils/op_builtin.h",
1092 "src/string/memory_utils/op_generic.h",
1093 "src/string/memory_utils/op_x86.h",
1094 "src/string/memory_utils/utils.h",
1095 ],
1096 textual_hdrs = [
1097 "src/string/memory_utils/bcmp_implementations.h",
1098 "src/string/memory_utils/bzero_implementations.h",
1099 "src/string/memory_utils/memcmp_implementations.h",
1100 "src/string/memory_utils/memcpy_implementations.h",
1101 "src/string/memory_utils/memmove_implementations.h",
1102 "src/string/memory_utils/memset_implementations.h",
1103 "src/string/memory_utils/strcmp_implementations.h",
1104 ],
1105 deps = [
1106 ":__support_common",
1107 ":__support_compiler_features",
1108 ":__support_cpp_array",
1109 ":__support_cpp_bit",
1110 ":__support_cpp_cstddef",
1111 ":__support_cpp_type_traits",
1112 ":libc_root",
1113 ],
1114 )
1115
1116 libc_support_library(
1117 name = "string_utils",
1118 hdrs = ["src/string/string_utils.h"],
1119 deps = [
1120 ":__support_common",
1121 ":__support_cpp_bitset",
1122 ":libc_root",
1123 ":string_memory_utils",
1124 ],
1125 )
1126
1127 libc_function(
1128 name = "memchr",
1129 srcs = ["src/string/memchr.cpp"],
1130 hdrs = ["src/string/memchr.h"],
1131 deps = [
1132 ":__support_common",
1133 ":string_utils",
1134 ],
1135 )
1136
1137 libc_function(
1138 name = "memcpy",
1139 srcs = ["src/string/memcpy.cpp"],
1140 hdrs = ["src/string/memcpy.h"],
1141 copts = ["-mllvm --tail-merge-threshold=0"],
1142 features = no_sanitize_features,
1143 weak = True,
1144 deps = [
1145 ":__support_common",
1146 ":string_memory_utils",
1147 ],
1148 )
1149
1150 libc_function(
1151 name = "memset",
1152 srcs = ["src/string/memset.cpp"],
1153 hdrs = ["src/string/memset.h"],
1154 features = no_sanitize_features,
1155 weak = True,
1156 deps = [
1157 ":__support_common",
1158 ":string_memory_utils",
1159 ],
1160 )
1161
1162 libc_function(
1163 name = "memmove",
1164 srcs = ["src/string/memmove.cpp"],
1165 hdrs = ["src/string/memmove.h"],
1166 features = no_sanitize_features,
1167 weak = True,
1168 deps = [
1169 ":__support_common",
1170 ":string_memory_utils",
1171 ],
1172 )
1173
1174 libc_function(
1175 name = "bcopy",
1176 srcs = ["src/string/bcopy.cpp"],
1177 hdrs = ["src/string/bcopy.h"],
1178 features = no_sanitize_features,
1179 deps = [
1180 ":__support_common",
1181 ":string_memory_utils",
1182 ],
1183 )
1184
1185 libc_function(
1186 name = "memcmp",
1187 srcs = ["src/string/memcmp.cpp"],
1188 hdrs = ["src/string/memcmp.h"],
1189 features = no_sanitize_features,
1190 weak = True,
1191 deps = [
1192 ":__support_common",
1193 ":__support_integer_operations",
1194 ":string_memory_utils",
1195 ],
1196 )
1197
1198 libc_function(
1199 name = "bcmp",
1200 srcs = ["src/string/bcmp.cpp"],
1201 hdrs = ["src/string/bcmp.h"],
1202 features = no_sanitize_features,
1203 weak = True,
1204 deps = [
1205 ":__support_common",
1206 ":string_memory_utils",
1207 ],
1208 )
1209
1210 libc_function(
1211 name = "bzero",
1212 srcs = ["src/string/bzero.cpp"],
1213 hdrs = ["src/string/bzero.h"],
1214 features = no_sanitize_features,
1215 weak = True,
1216 deps = [
1217 ":__support_common",
1218 ":string_memory_utils",
1219 ],
1220 )
1221
1222 libc_function(
1223 name = "memrchr",
1224 srcs = ["src/string/memrchr.cpp"],
1225 hdrs = ["src/string/memrchr.h"],
1226 deps = [
1227 ":__support_common",
1228 ":string_utils",
1229 ],
1230 )
1231
1232 libc_function(
1233 name = "strlen",
1234 srcs = ["src/string/strlen.cpp"],
1235 hdrs = ["src/string/strlen.h"],
1236 features = no_sanitize_features,
1237 deps = [
1238 ":__support_common",
1239 ":string_utils",
1240 ],
1241 )
1242
1243 libc_function(
1244 name = "strcpy",
1245 srcs = ["src/string/strcpy.cpp"],
1246 hdrs = ["src/string/strcpy.h"],
1247 features = no_sanitize_features,
1248 deps = [
1249 ":__support_common",
1250 ":memcpy",
1251 ":string_memory_utils",
1252 ":string_utils",
1253 ],
1254 )
1255
1256 # A sanitizer instrumented flavor of strcpy to be used with unittests.
1257 libc_function(
1258 name = "strcpy_sanitized",
1259 testonly = 1,
1260 srcs = ["src/string/strcpy.cpp"],
1261 hdrs = ["src/string/strcpy.h"],
1262 deps = [
1263 ":__support_common",
1264 ":memcpy",
1265 ":string_memory_utils",
1266 ":string_utils",
1267 ],
1268 )
1269
1270 libc_function(
1271 name = "strncpy",
1272 srcs = ["src/string/strncpy.cpp"],
1273 hdrs = ["src/string/strncpy.h"],
1274 deps = [
1275 ":__support_common",
1276 ],
1277 )
1278
1279 libc_function(
1280 name = "strcmp",
1281 srcs = ["src/string/strcmp.cpp"],
1282 hdrs = ["src/string/strcmp.h"],
1283 deps = [
1284 ":__support_common",
1285 ":string_memory_utils",
1286 ":string_utils",
1287 ],
1288 )
1289
1290 libc_function(
1291 name = "strchr",
1292 srcs = ["src/string/strchr.cpp"],
1293 hdrs = ["src/string/strchr.h"],
1294 deps = [
1295 ":__support_common",
1296 ":string_utils",
1297 ],
1298 )
1299
1300 libc_function(
1301 name = "strrchr",
1302 srcs = ["src/string/strrchr.cpp"],
1303 hdrs = ["src/string/strrchr.h"],
1304 deps = [
1305 ":__support_common",
1306 ":string_utils",
1307 ],
1308 )
1309
1310 libc_function(
1311 name = "strstr",
1312 srcs = ["src/string/strstr.cpp"],
1313 hdrs = ["src/string/strstr.h"],
1314 deps = [
1315 ":__support_common",
1316 ":string_utils",
1317 ],
1318 )
1319
1320 libc_function(
1321 name = "strnlen",
1322 srcs = ["src/string/strnlen.cpp"],
1323 hdrs = ["src/string/strnlen.h"],
1324 deps = [
1325 ":__support_common",
1326 ":string_utils",
1327 ],
1328 )
1329
1330 libc_function(
1331 name = "strcspn",
1332 srcs = ["src/string/strcspn.cpp"],
1333 hdrs = ["src/string/strcspn.h"],
1334 deps = [
1335 ":__support_common",
1336 ":string_utils",
1337 ],
1338 )
1339
1340 libc_function(
1341 name = "strspn",
1342 srcs = ["src/string/strspn.cpp"],
1343 hdrs = ["src/string/strspn.h"],
1344 deps = [
1345 ":__support_common",
1346 ":__support_cpp_bitset",
1347 ":string_utils",
1348 ],
1349 )
1350
1351 libc_function(
1352 name = "strpbrk",
1353 srcs = ["src/string/strpbrk.cpp"],
1354 hdrs = ["src/string/strpbrk.h"],
1355 deps = [
1356 ":__support_common",
1357 ":string_utils",
1358 ],
1359 )
1360
1361 libc_function(
1362 name = "strtok",
1363 srcs = ["src/string/strtok.cpp"],
1364 hdrs = ["src/string/strtok.h"],
1365 deps = [
1366 ":__support_common",
1367 ":string_utils",
1368 ],
1369 )
1370
1371 ############################### unistd targets ###############################
1372
1373 libc_function(
1374 name = "chdir",
1375 srcs = ["src/unistd/linux/chdir.cpp"],
1376 hdrs = ["src/unistd/chdir.h"],
1377 deps = [
1378 ":__support_common",
1379 ":__support_osutil",
1380 ],
1381 )
1382
1383 libc_function(
1384 name = "close",
1385 srcs = ["src/unistd/linux/close.cpp"],
1386 hdrs = ["src/unistd/close.h"],
1387 deps = [
1388 ":__support_common",
1389 ":__support_osutil",
1390 ],
1391 )
1392
1393 libc_function(
1394 name = "fchdir",
1395 srcs = ["src/unistd/linux/fchdir.cpp"],
1396 hdrs = ["src/unistd/fchdir.h"],
1397 deps = [
1398 ":__support_common",
1399 ":__support_osutil",
1400 ],
1401 )
1402
1403 libc_function(
1404 name = "fsync",
1405 srcs = ["src/unistd/linux/fsync.cpp"],
1406 hdrs = ["src/unistd/fsync.h"],
1407 deps = [
1408 ":__support_common",
1409 ":__support_osutil",
1410 ],
1411 )
1412
1413 libc_function(
1414 name = "ftruncate",
1415 srcs = ["src/unistd/linux/ftruncate.cpp"],
1416 hdrs = ["src/unistd/ftruncate.h"],
1417 deps = [
1418 ":__support_common",
1419 ":__support_osutil",
1420 ],
1421 )
1422
1423 libc_function(
1424 name = "link",
1425 srcs = ["src/unistd/linux/link.cpp"],
1426 hdrs = ["src/unistd/link.h"],
1427 deps = [
1428 ":__support_common",
1429 ":__support_osutil",
1430 ],
1431 )
1432
1433 libc_function(
1434 name = "linkat",
1435 srcs = ["src/unistd/linux/linkat.cpp"],
1436 hdrs = ["src/unistd/linkat.h"],
1437 deps = [
1438 ":__support_common",
1439 ":__support_osutil",
1440 ],
1441 )
1442
1443 libc_function(
1444 name = "lseek",
1445 srcs = ["src/unistd/linux/lseek.cpp"],
1446 hdrs = ["src/unistd/lseek.h"],
1447 deps = [
1448 ":__support_common",
1449 ":__support_osutil",
1450 ],
1451 )
1452
1453 libc_function(
1454 name = "read",
1455 srcs = ["src/unistd/linux/read.cpp"],
1456 hdrs = ["src/unistd/read.h"],
1457 deps = [
1458 ":__support_common",
1459 ":__support_osutil",
1460 ],
1461 )
1462
1463 libc_function(
1464 name = "readlink",
1465 srcs = ["src/unistd/linux/readlink.cpp"],
1466 hdrs = ["src/unistd/readlink.h"],
1467 deps = [
1468 ":__support_common",
1469 ":__support_osutil",
1470 ],
1471 )
1472
1473 libc_function(
1474 name = "readlinkat",
1475 srcs = ["src/unistd/linux/readlinkat.cpp"],
1476 hdrs = ["src/unistd/readlinkat.h"],
1477 deps = [
1478 ":__support_common",
1479 ":__support_osutil",
1480 ],
1481 )
1482
1483 libc_function(
1484 name = "rmdir",
1485 srcs = ["src/unistd/linux/rmdir.cpp"],
1486 hdrs = ["src/unistd/rmdir.h"],
1487 deps = [
1488 ":__support_common",
1489 ":__support_osutil",
1490 ],
1491 )
1492
1493 libc_function(
1494 name = "symlink",
1495 srcs = ["src/unistd/linux/symlink.cpp"],
1496 hdrs = ["src/unistd/symlink.h"],
1497 deps = [
1498 ":__support_common",
1499 ":__support_osutil",
1500 ],
1501 )
1502
1503 libc_function(
1504 name = "symlinkat",
1505 srcs = ["src/unistd/linux/symlinkat.cpp"],
1506 hdrs = ["src/unistd/symlinkat.h"],
1507 deps = [
1508 ":__support_common",
1509 ":__support_osutil",
1510 ],
1511 )
1512
1513 libc_function(
1514 name = "truncate",
1515 srcs = ["src/unistd/linux/truncate.cpp"],
1516 hdrs = ["src/unistd/truncate.h"],
1517 deps = [
1518 ":__support_common",
1519 ":__support_osutil",
1520 ],
1521 )
1522
1523 libc_function(
1524 name = "unlink",
1525 srcs = ["src/unistd/linux/unlink.cpp"],
1526 hdrs = ["src/unistd/unlink.h"],
1527 deps = [
1528 ":__support_common",
1529 ":__support_osutil",
1530 ],
1531 )
1532
1533 libc_function(
1534 name = "unlinkat",
1535 srcs = ["src/unistd/linux/unlinkat.cpp"],
1536 hdrs = ["src/unistd/unlinkat.h"],
1537 deps = [
1538 ":__support_common",
1539 ":__support_osutil",
1540 ],
1541 )
1542
1543 libc_function(
1544 name = "write",
1545 srcs = ["src/unistd/linux/write.cpp"],
1546 hdrs = ["src/unistd/write.h"],
1547 deps = [
1548 ":__support_common",
1549 ":__support_osutil",
1550 ],
1551 )