Debian Codegraph @

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("@bazel_skylib//lib:selects.bzl", "selects")
7 load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
8 load(
9 ":libc_build_rules.bzl",
10 "libc_function",
11 "libc_math_function",
12 "libc_support_library",
13 )
14 load(":platforms.bzl", "PLATFORM_CPU_ARM64", "PLATFORM_CPU_X86_64")
15
16 package(
17 default_visibility = ["//visibility:public"],
18 features = [
19 "-use_header_modules",
20 "-layering_check",
21 ],
22 )
23
24 licenses(["notice"])
25
26 # A flag to pick which `mpfr` to use for math tests.
27 # Usage: `--@llvm-project//libc:mpfr=<disable|external|system>`.
28 # Flag documentation: https://bazel.build/extending/config
29 string_flag(
30 name = "mpfr",
31 build_setting_default = "external",
32 values = [
33 "disable", # Skip tests that need mpfr
34 "external", # Build mpfr from source
35 "system", # Use system mpfr (non hermetic)
36 ],
37 )
38
39 config_setting(
40 name = "mpfr_disable",
41 flag_values = {":mpfr": "disable"},
42 )
43
44 config_setting(
45 name = "mpfr_external",
46 flag_values = {":mpfr": "external"},
47 )
48
49 config_setting(
50 name = "mpfr_system",
51 flag_values = {":mpfr": "system"},
52 )
53
54 ################################## Base Config #################################
55
56 cc_library(
57 name = "__support_macros_config",
58 hdrs = ["src/__support/macros/config.h"],
59 )
60
61 ################################# Include Files ################################
62
63 libc_support_library(
64 name = "llvm_libc_macros_math_macros",
65 hdrs = ["include/llvm-libc-macros/math-macros.h"],
66 deps = [":llvm_libc_macros_limits_macros"],
67 )
68
69 libc_support_library(
70 name = "llvm_libc_macros_limits_macros",
71 hdrs = ["include/llvm-libc-macros/limits-macros.h"],
72 )
73
74 libc_support_library(
75 name = "llvm_libc_macros_float_macros",
76 hdrs = ["include/llvm-libc-macros/float-macros.h"],
77 )
78
79 libc_support_library(
80 name = "llvm_libc_macros_float16_macros",
81 hdrs = ["include/llvm-libc-macros/float16-macros.h"],
82 deps = [":llvm_libc_types_float128"],
83 )
84
85 libc_support_library(
86 name = "llvm_libc_macros_stdint_macros",
87 hdrs = ["include/llvm-libc-macros/stdint-macros.h"],
88 )
89
90 libc_support_library(
91 name = "llvm_libc_macros_stdfix_macros",
92 hdrs = ["include/llvm-libc-macros/stdfix-macros.h"],
93 deps = [":llvm_libc_macros_float_macros"],
94 )
95
96 libc_support_library(
97 name = "llvm_libc_types_float128",
98 hdrs = ["include/llvm-libc-types/float128.h"],
99 target_compatible_with = select({
100 "@platforms//os:linux": [],
101 "//conditions:default": ["@platforms//:incompatible"],
102 }),
103 deps = [":llvm_libc_macros_float_macros"],
104 )
105
106 libc_support_library(
107 name = "llvm_libc_macros_fcntl_macros",
108 hdrs = ["include/llvm-libc-macros/linux/fcntl-macros.h"],
109 )
110
111 ########################### Macro Proxy Header Files ###########################
112
113 libc_support_library(
114 name = "hdr_math_macros",
115 hdrs = ["hdr/math_macros.h"],
116 )
117
118 libc_support_library(
119 name = "hdr_fenv_macros",
120 hdrs = ["hdr/fenv_macros.h"],
121 )
122
123 libc_support_library(
124 name = "hdr_signal_macros",
125 hdrs = ["hdr/signal_macros.h"],
126 )
127
128 libc_support_library(
129 name = "hdr_sys_epoll_macros",
130 hdrs = ["hdr/sys_epoll_macros.h"],
131 )
132
133 libc_support_library(
134 name = "hdr_errno_macros",
135 hdrs = ["hdr/errno_macros.h"],
136 )
137
138 libc_support_library(
139 name = "hdr_time_macros",
140 hdrs = ["hdr/time_macros.h"],
141 )
142
143 libc_support_library(
144 name = "hdr_float_macros",
145 hdrs = ["hdr/float_macros.h"],
146 )
147
148 libc_support_library(
149 name = "hdr_stdio_macros",
150 hdrs = ["hdr/stdio_macros.h"],
151 )
152
153 ############################ Type Proxy Header Files ###########################
154
155 libc_support_library(
156 name = "types_clockid_t",
157 hdrs = ["hdr/types/clockid_t.h"],
158 )
159
160 libc_support_library(
161 name = "types_fenv_t",
162 hdrs = ["hdr/types/fenv_t.h"],
163 )
164
165 libc_support_library(
166 name = "types_fexcept_t",
167 hdrs = ["hdr/types/fexcept_t.h"],
168 )
169
170 libc_support_library(
171 name = "types_sigset_t",
172 hdrs = ["hdr/types/sigset_t.h"],
173 )
174
175 libc_support_library(
176 name = "types_struct_epoll_event",
177 hdrs = ["hdr/types/struct_epoll_event.h"],
178 )
179
180 libc_support_library(
181 name = "types_struct_timespec",
182 hdrs = ["hdr/types/struct_timespec.h"],
183 )
184
185 libc_support_library(
186 name = "types_time_t",
187 hdrs = ["hdr/types/time_t.h"],
188 )
189
190 libc_support_library(
191 name = "types_pid_t",
192 hdrs = ["hdr/types/pid_t.h"],
193 )
194
195 libc_support_library(
196 name = "types_off_t",
197 hdrs = ["hdr/types/off_t.h"],
198 )
199
200 libc_support_library(
201 name = "types_FILE",
202 hdrs = ["hdr/types/FILE.h"],
203 )
204
205 ############################### Support libraries ##############################
206
207 libc_support_library(
208 name = "__support_macros_properties_architectures",
209 hdrs = ["src/__support/macros/properties/architectures.h"],
210 )
211
212 libc_support_library(
213 name = "__support_macros_properties_compiler",
214 hdrs = ["src/__support/macros/properties/compiler.h"],
215 )
216
217 libc_support_library(
218 name = "__support_macros_properties_os",
219 hdrs = ["src/__support/macros/properties/os.h"],
220 )
221
222 libc_support_library(
223 name = "__support_macros_properties_types",
224 hdrs = ["src/__support/macros/properties/types.h"],
225 deps = [
226 ":__support_macros_properties_architectures",
227 ":__support_macros_properties_compiler",
228 ":__support_macros_properties_cpu_features",
229 ":__support_macros_properties_os",
230 ":hdr_float_macros",
231 ":llvm_libc_macros_float16_macros",
232 ":llvm_libc_types_float128",
233 ],
234 )
235
236 libc_support_library(
237 name = "__support_macros_properties_cpu_features",
238 hdrs = ["src/__support/macros/properties/cpu_features.h"],
239 deps = [
240 "__support_macros_properties_architectures",
241 ],
242 )
243
244 libc_support_library(
245 name = "__support_macros_attributes",
246 hdrs = ["src/__support/macros/attributes.h"],
247 deps = [
248 ":__support_macros_properties_architectures",
249 ],
250 )
251
252 libc_support_library(
253 name = "__support_macros_optimization",
254 hdrs = ["src/__support/macros/optimization.h"],
255 deps = [
256 ":__support_macros_attributes",
257 ":__support_macros_config",
258 ":__support_macros_properties_compiler",
259 ],
260 )
261
262 libc_support_library(
263 name = "__support_macros_sanitizer",
264 hdrs = ["src/__support/macros/sanitizer.h"],
265 deps = [
266 ":__support_macros_config",
267 ],
268 )
269
270 libc_support_library(
271 name = "__support_common",
272 hdrs = [
273 "src/__support/common.h",
274 "src/__support/endian.h",
275 ],
276 deps = [
277 ":__support_macros_attributes",
278 ":__support_macros_config",
279 ":__support_macros_properties_architectures",
280 ],
281 )
282
283 libc_support_library(
284 name = "__support_cpp_algorithm",
285 hdrs = ["src/__support/CPP/algorithm.h"],
286 deps = [
287 ":__support_macros_attributes",
288 ":__support_macros_config",
289 ],
290 )
291
292 libc_support_library(
293 name = "__support_cpp_iterator",
294 hdrs = ["src/__support/CPP/iterator.h"],
295 deps = [
296 ":__support_cpp_type_traits",
297 ":__support_macros_attributes",
298 ],
299 )
300
301 libc_support_library(
302 name = "__support_cpp_array",
303 hdrs = ["src/__support/CPP/array.h"],
304 deps = [
305 ":__support_cpp_iterator",
306 ":__support_macros_attributes",
307 ],
308 )
309
310 libc_support_library(
311 name = "__support_cpp_bit",
312 hdrs = ["src/__support/CPP/bit.h"],
313 deps = [
314 ":__support_cpp_limits",
315 ":__support_cpp_type_traits",
316 ":__support_macros_attributes",
317 ":__support_macros_sanitizer",
318 ],
319 )
320
321 libc_support_library(
322 name = "__support_cpp_bitset",
323 hdrs = ["src/__support/CPP/bitset.h"],
324 deps = [
325 ":__support_macros_attributes",
326 ":__support_macros_config",
327 ],
328 )
329
330 libc_support_library(
331 name = "__support_cpp_cstddef",
332 hdrs = ["src/__support/CPP/cstddef.h"],
333 deps = [
334 ":__support_cpp_type_traits",
335 ":__support_macros_attributes",
336 ],
337 )
338
339 libc_support_library(
340 name = "__support_cpp_expected",
341 hdrs = ["src/__support/CPP/expected.h"],
342 deps = [
343 ":__support_macros_attributes",
344 ":__support_macros_config",
345 ],
346 )
347
348 libc_support_library(
349 name = "__support_cpp_functional",
350 hdrs = ["src/__support/CPP/functional.h"],
351 deps = [
352 "__support_cpp_type_traits",
353 "__support_cpp_utility",
354 "__support_macros_attributes",
355 ],
356 )
357
358 libc_support_library(
359 name = "__support_cpp_limits",
360 hdrs = ["src/__support/CPP/limits.h"],
361 deps = [
362 "__support_cpp_type_traits",
363 "__support_macros_attributes",
364 ":__support_macros_properties_types",
365 ":llvm_libc_macros_limits_macros",
366 ],
367 )
368
369 libc_support_library(
370 name = "__support_cpp_new",
371 srcs = ["src/__support/CPP/new.cpp"],
372 hdrs = ["src/__support/CPP/new.h"],
373 deps = [
374 ":__support_common",
375 ],
376 )
377
378 libc_support_library(
379 name = "__support_cpp_optional",
380 hdrs = ["src/__support/CPP/optional.h"],
381 deps = [
382 ":__support_cpp_utility",
383 ],
384 )
385
386 libc_support_library(
387 name = "__support_cpp_span",
388 hdrs = ["src/__support/CPP/span.h"],
389 deps = [
390 ":__support_cpp_array",
391 ":__support_cpp_type_traits",
392 ],
393 )
394
395 libc_support_library(
396 name = "__support_cpp_string_view",
397 hdrs = ["src/__support/CPP/string_view.h"],
398 deps = [
399 ":__support_common",
400 ],
401 )
402
403 libc_support_library(
404 name = "__support_cpp_stringstream",
405 hdrs = ["src/__support/CPP/stringstream.h"],
406 deps = [
407 ":__support_cpp_span",
408 ":__support_cpp_string_view",
409 ":__support_cpp_type_traits",
410 ":__support_integer_to_string",
411 ],
412 )
413
414 libc_support_library(
415 name = "__support_cpp_string",
416 hdrs = ["src/__support/CPP/string.h"],
417 deps = [
418 ":__support_common",
419 ":__support_cpp_string_view",
420 ":__support_integer_to_string",
421 ":string_memory_utils",
422 ":string_utils",
423 ],
424 )
425
426 libc_support_library(
427 name = "__support_cpp_type_traits",
428 hdrs = glob(["src/__support/CPP/type_traits/*.h"]) + [
429 "src/__support/CPP/type_traits.h",
430 "src/__support/CPP/utility/declval.h",
431 "src/__support/CPP/utility/forward.h",
432 ],
433 deps = [
434 ":__support_macros_attributes",
435 ":__support_macros_config",
436 ":__support_macros_properties_types",
437 ":llvm_libc_macros_stdfix_macros",
438 ],
439 )
440
441 libc_support_library(
442 name = "__support_cpp_utility",
443 hdrs = glob(["src/__support/CPP/utility/*.h"]) + [
444 "src/__support/CPP/utility.h",
445 ],
446 deps = [
447 ":__support_cpp_type_traits",
448 ":__support_macros_attributes",
449 ],
450 )
451
452 libc_support_library(
453 name = "__support_cpp_atomic",
454 hdrs = ["src/__support/CPP/atomic.h"],
455 deps = [
456 ":__support_cpp_type_traits",
457 ":__support_macros_attributes",
458 ":__support_macros_properties_architectures",
459 ],
460 )
461
462 libc_support_library(
463 name = "__support_blockstore",
464 hdrs = ["src/__support/blockstore.h"],
465 deps = [
466 ":__support_cpp_new",
467 ":__support_libc_assert",
468 ],
469 )
470
471 libc_support_library(
472 name = "__support_arg_list",
473 hdrs = ["src/__support/arg_list.h"],
474 deps = [
475 ":__support_common",
476 ],
477 )
478
479 libc_support_library(
480 name = "__support_c_string",
481 hdrs = ["src/__support/c_string.h"],
482 deps = [
483 ":__support_cpp_string",
484 ],
485 )
486
487 libc_support_library(
488 name = "__support_fixedvector",
489 hdrs = ["src/__support/fixedvector.h"],
490 deps = [
491 ":__support_cpp_array",
492 ":__support_cpp_iterator",
493 ],
494 )
495
496 libc_support_library(
497 name = "__support_char_vector",
498 hdrs = ["src/__support/char_vector.h"],
499 deps = [
500 ":__support_common",
501 ],
502 )
503
504 libc_support_library(
505 name = "__support_error_or",
506 hdrs = ["src/__support/error_or.h"],
507 deps = [
508 ":__support_common",
509 ":__support_cpp_expected",
510 ],
511 )
512
513 libc_support_library(
514 name = "__support_float_to_string",
515 hdrs = [
516 "src/__support/float_to_string.h",
517 "src/__support/ryu_constants.h",
518 "src/__support/ryu_long_double_constants.h",
519 ],
520 deps = [
521 ":__support_big_int",
522 ":__support_common",
523 ":__support_cpp_type_traits",
524 ":__support_fputil_dyadic_float",
525 ":__support_fputil_fp_bits",
526 ":__support_libc_assert",
527 ],
528 )
529
530 libc_support_library(
531 name = "__support_number_pair",
532 hdrs = ["src/__support/number_pair.h"],
533 deps = [
534 ":__support_cpp_type_traits",
535 ],
536 )
537
538 libc_support_library(
539 name = "__support_big_int",
540 hdrs = ["src/__support/big_int.h"],
541 deps = [
542 ":__support_cpp_array",
543 ":__support_cpp_bit",
544 ":__support_cpp_limits",
545 ":__support_cpp_optional",
546 ":__support_cpp_type_traits",
547 ":__support_macros_attributes",
548 ":__support_macros_optimization",
549 ":__support_macros_properties_types",
550 ":__support_math_extras",
551 ":__support_number_pair",
552 ],
553 )
554
555 libc_support_library(
556 name = "__support_sign",
557 hdrs = ["src/__support/sign.h"],
558 deps = [
559 ":__support_macros_attributes",
560 ],
561 )
562
563 libc_support_library(
564 name = "__support_uint128",
565 hdrs = ["src/__support/uint128.h"],
566 deps = [
567 ":__support_big_int",
568 ":__support_macros_attributes",
569 ":__support_macros_properties_types",
570 ],
571 )
572
573 libc_support_library(
574 name = "__support_integer_literals",
575 hdrs = ["src/__support/integer_literals.h"],
576 deps = [
577 ":__support_cpp_limits",
578 ":__support_uint128",
579 ],
580 )
581
582 libc_support_library(
583 name = "__support_str_to_num_result",
584 hdrs = ["src/__support/str_to_num_result.h"],
585 deps = [
586 ":__support_macros_attributes",
587 ":__support_macros_config",
588 ],
589 )
590
591 libc_support_library(
592 name = "__support_integer_operations",
593 hdrs = ["src/__support/integer_operations.h"],
594 deps = [":__support_cpp_type_traits"],
595 )
596
597 libc_support_library(
598 name = "__support_integer_to_string",
599 hdrs = ["src/__support/integer_to_string.h"],
600 deps = [
601 ":__support_big_int",
602 ":__support_common",
603 ":__support_cpp_algorithm",
604 ":__support_cpp_bit",
605 ":__support_cpp_limits",
606 ":__support_cpp_optional",
607 ":__support_cpp_span",
608 ":__support_cpp_string_view",
609 ":__support_cpp_type_traits",
610 ],
611 )
612
613 libc_support_library(
614 name = "__support_libc_assert",
615 hdrs = ["src/__support/libc_assert.h"],
616 deps = [
617 ":__support_integer_to_string",
618 ":__support_macros_attributes",
619 ":__support_osutil_exit",
620 ":__support_osutil_io",
621 ],
622 )
623
624 libc_support_library(
625 name = "__support_ctype_utils",
626 hdrs = ["src/__support/ctype_utils.h"],
627 deps = [
628 ":__support_macros_attributes",
629 ":__support_macros_config",
630 ],
631 )
632
633 libc_support_library(
634 name = "__support_str_to_integer",
635 hdrs = ["src/__support/str_to_integer.h"],
636 deps = [
637 ":__support_common",
638 ":__support_cpp_limits",
639 ":__support_cpp_type_traits",
640 ":__support_ctype_utils",
641 ":__support_str_to_num_result",
642 ":__support_uint128",
643 ":errno",
644 ],
645 )
646
647 libc_support_library(
648 name = "__support_str_to_float",
649 hdrs = [
650 "src/__support/detailed_powers_of_ten.h",
651 "src/__support/high_precision_decimal.h",
652 "src/__support/str_to_float.h",
653 ],
654 deps = [
655 ":__support_common",
656 ":__support_cpp_bit",
657 ":__support_cpp_limits",
658 ":__support_cpp_optional",
659 ":__support_cpp_string_view",
660 ":__support_ctype_utils",
661 ":__support_fputil_dyadic_float",
662 ":__support_fputil_fenv_impl",
663 ":__support_fputil_fp_bits",
664 ":__support_fputil_rounding_mode",
665 ":__support_str_to_integer",
666 ":__support_str_to_num_result",
667 ":__support_uint128",
668 ":errno",
669 ],
670 )
671
672 libc_support_library(
673 name = "__support_fputil_basic_operations",
674 hdrs = ["src/__support/FPUtil/BasicOperations.h"],
675 deps = [
676 ":__support_common",
677 ":__support_cpp_type_traits",
678 ":__support_fputil_fenv_impl",
679 ":__support_fputil_fp_bits",
680 ":__support_macros_optimization",
681 ":__support_uint128",
682 ],
683 )
684
685 libc_support_library(
686 name = "__support_file_file",
687 srcs = [
688 "include/llvm-libc-types/off_t.h",
689 "src/__support/File/file.cpp",
690 ],
691 hdrs = ["src/__support/File/file.h"],
692 deps = [
693 ":__support_cpp_new",
694 ":__support_cpp_span",
695 ":__support_error_or",
696 ":__support_threads_mutex",
697 ":errno",
698 ":hdr_stdio_macros",
699 ":types_off_t",
700 ],
701 )
702
703 libc_support_library(
704 name = "__support_file_linux_lseekimpl",
705 hdrs = ["src/__support/File/linux/lseekImpl.h"],
706 deps = [
707 ":__support_common",
708 ":__support_error_or",
709 ":__support_osutil_syscall",
710 ":errno",
711 ":types_off_t",
712 ],
713 )
714
715 libc_support_library(
716 name = "__support_math_extras",
717 hdrs = ["src/__support/math_extras.h"],
718 deps = [
719 ":__support_cpp_bit",
720 ":__support_cpp_limits",
721 ":__support_cpp_type_traits",
722 ":__support_macros_attributes",
723 ],
724 )
725
726 libc_support_library(
727 name = "__support_fixed_point",
728 hdrs = [
729 "src/__support/fixed_point/fx_bits.h",
730 "src/__support/fixed_point/fx_rep.h",
731 ],
732 deps = [
733 ":__support_cpp_bit",
734 ":__support_cpp_type_traits",
735 ":__support_macros_attributes",
736 ":__support_macros_optimization",
737 ":__support_math_extras",
738 ":llvm_libc_macros_stdfix_macros",
739 ],
740 )
741
742 libc_support_library(
743 name = "__support_fputil_generic_fmod",
744 hdrs = ["src/__support/FPUtil/generic/FMod.h"],
745 deps = [
746 ":__support_common",
747 ":__support_cpp_bit",
748 ":__support_cpp_limits",
749 ":__support_cpp_type_traits",
750 ":__support_fputil_fenv_impl",
751 ":__support_fputil_fp_bits",
752 ],
753 )
754
755 libc_support_library(
756 name = "__support_fputil_division_and_remainder_operations",
757 hdrs = ["src/__support/FPUtil/DivisionAndRemainderOperations.h"],
758 deps = [
759 ":__support_common",
760 ":__support_cpp_type_traits",
761 ":__support_fputil_fp_bits",
762 ":__support_fputil_manipulation_functions",
763 ":__support_fputil_normal_float",
764 ],
765 )
766
767 libc_support_library(
768 name = "__support_fputil_except_value_utils",
769 hdrs = ["src/__support/FPUtil/except_value_utils.h"],
770 deps = [
771 ":__support_cpp_optional",
772 ":__support_fputil_fenv_impl",
773 ":__support_fputil_fp_bits",
774 ":__support_fputil_rounding_mode",
775 ],
776 )
777
778 libc_support_library(
779 name = "__support_fputil_fenv_impl",
780 hdrs = ["src/__support/FPUtil/FEnvImpl.h"],
781 textual_hdrs = [
782 "src/__support/FPUtil/x86_64/FEnvImpl.h",
783 "src/__support/FPUtil/aarch64/FEnvImpl.h",
784 "src/__support/FPUtil/aarch64/fenv_darwin_impl.h",
785 ],
786 deps = [
787 ":__support_fputil_fp_bits",
788 ":__support_macros_attributes",
789 ":__support_macros_properties_architectures",
790 ":__support_macros_sanitizer",
791 ":errno",
792 ":hdr_fenv_macros",
793 ":hdr_math_macros",
794 ":types_fenv_t",
795 ],
796 )
797
798 libc_support_library(
799 name = "__support_fputil_rounding_mode",
800 hdrs = ["src/__support/FPUtil/rounding_mode.h"],
801 deps = [
802 ":__support_macros_attributes",
803 ":__support_macros_config",
804 ":hdr_fenv_macros",
805 ],
806 )
807
808 libc_support_library(
809 name = "__support_fputil_fp_bits",
810 hdrs = ["src/__support/FPUtil/FPBits.h"],
811 deps = [
812 ":__support_common",
813 ":__support_cpp_bit",
814 ":__support_cpp_type_traits",
815 ":__support_libc_assert",
816 ":__support_macros_attributes",
817 ":__support_macros_properties_types",
818 ":__support_math_extras",
819 ":__support_sign",
820 ":__support_uint128",
821 ],
822 )
823
824 libc_support_library(
825 name = "__support_fputil_fpbits_str",
826 hdrs = ["src/__support/FPUtil/fpbits_str.h"],
827 deps = [
828 ":__support_common",
829 ":__support_cpp_string",
830 ":__support_cpp_type_traits",
831 ":__support_fputil_fp_bits",
832 ":__support_integer_to_string",
833 ":__support_uint128",
834 ],
835 )
836
837 libc_support_library(
838 name = "__support_fputil_hypot",
839 hdrs = ["src/__support/FPUtil/Hypot.h"],
840 deps = [
841 ":__support_common",
842 ":__support_cpp_bit",
843 ":__support_cpp_type_traits",
844 ":__support_fputil_basic_operations",
845 ":__support_fputil_fenv_impl",
846 ":__support_fputil_fp_bits",
847 ":__support_fputil_rounding_mode",
848 ":__support_uint128",
849 ],
850 )
851
852 libc_support_library(
853 name = "__support_fputil_manipulation_functions",
854 hdrs = ["src/__support/FPUtil/ManipulationFunctions.h"],
855 textual_hdrs = [
856 "src/__support/FPUtil/x86_64/NextAfterLongDouble.h",
857 "src/__support/FPUtil/x86_64/NextUpDownLongDouble.h",
858 ],
859 deps = [
860 ":__support_common",
861 ":__support_cpp_bit",
862 ":__support_cpp_limits",
863 ":__support_cpp_type_traits",
864 ":__support_fputil_dyadic_float",
865 ":__support_fputil_fp_bits",
866 ":__support_fputil_nearest_integer_operations",
867 ":__support_fputil_normal_float",
868 ":__support_macros_optimization",
869 ":__support_uint128",
870 ":hdr_math_macros",
871 ],
872 )
873
874 libc_support_library(
875 name = "__support_fputil_nearest_integer_operations",
876 hdrs = ["src/__support/FPUtil/NearestIntegerOperations.h"],
877 deps = [
878 ":__support_common",
879 ":__support_cpp_type_traits",
880 ":__support_fputil_fenv_impl",
881 ":__support_fputil_fp_bits",
882 ":__support_fputil_rounding_mode",
883 ":__support_macros_attributes",
884 ":hdr_math_macros",
885 ],
886 )
887
888 libc_support_library(
889 name = "__support_fputil_normal_float",
890 hdrs = ["src/__support/FPUtil/NormalFloat.h"],
891 deps = [
892 ":__support_common",
893 ":__support_cpp_type_traits",
894 ":__support_fputil_fp_bits",
895 ],
896 )
897
898 sqrt_common_hdrs = [
899 "src/__support/FPUtil/sqrt.h",
900 "src/__support/FPUtil/generic/sqrt.h",
901 "src/__support/FPUtil/generic/sqrt_80_bit_long_double.h",
902 ]
903
904 sqrt_hdrs = selects.with_or({
905 "//conditions:default": sqrt_common_hdrs,
906 PLATFORM_CPU_X86_64: sqrt_common_hdrs + [
907 "src/__support/FPUtil/x86_64/sqrt.h",
908 ],
909 PLATFORM_CPU_ARM64: sqrt_common_hdrs + [
910 "src/__support/FPUtil/aarch64/sqrt.h",
911 ],
912 })
913
914 libc_support_library(
915 name = "__support_fputil_sqrt",
916 hdrs = sqrt_hdrs,
917 deps = [
918 ":__support_common",
919 ":__support_cpp_bit",
920 ":__support_cpp_type_traits",
921 ":__support_fputil_dyadic_float",
922 ":__support_fputil_fenv_impl",
923 ":__support_fputil_fp_bits",
924 ":__support_fputil_rounding_mode",
925 ":__support_uint128",
926 ],
927 )
928
929 fma_common_hdrs = [
930 "src/__support/FPUtil/FMA.h",
931 "src/__support/FPUtil/generic/FMA.h",
932 ]
933
934 libc_support_library(
935 name = "__support_fputil_fma",
936 hdrs = fma_common_hdrs,
937 deps = [
938 ":__support_cpp_bit",
939 ":__support_cpp_type_traits",
940 ":__support_fputil_basic_operations",
941 ":__support_fputil_dyadic_float",
942 ":__support_fputil_fenv_impl",
943 ":__support_fputil_fp_bits",
944 ":__support_fputil_rounding_mode",
945 ":__support_macros_attributes",
946 ":__support_macros_optimization",
947 ":__support_macros_properties_cpu_features",
948 ":__support_uint128",
949 ],
950 )
951
952 libc_support_library(
953 name = "__support_fputil_multiply_add",
954 hdrs = [
955 "src/__support/FPUtil/multiply_add.h",
956 ],
957 deps = [
958 ":__support_common",
959 ":__support_cpp_type_traits",
960 ],
961 )
962
963 libc_support_library(
964 name = "__support_fputil_polyeval",
965 hdrs = [
966 "src/__support/FPUtil/PolyEval.h",
967 ],
968 deps = [
969 ":__support_common",
970 ":__support_fputil_multiply_add",
971 ],
972 )
973
974 nearest_integer_common_hdrs = [
975 "src/__support/FPUtil/nearest_integer.h",
976 ]
977
978 nearest_integer_platform_hdrs = [
979 "src/__support/FPUtil/x86_64/nearest_integer.h",
980 "src/__support/FPUtil/aarch64/nearest_integer.h",
981 ]
982
983 libc_support_library(
984 name = "__support_fputil_nearest_integer",
985 hdrs = nearest_integer_common_hdrs,
986 # These are conditionally included and will #error out if the platform
987 # doesn't support rounding instructions, so they can't be compiled on their
988 # own.
989 textual_hdrs = nearest_integer_platform_hdrs,
990 deps = [
991 ":__support_common",
992 ":__support_macros_optimization",
993 ":__support_macros_properties_architectures",
994 ":__support_macros_properties_cpu_features",
995 ],
996 )
997
998 libc_support_library(
999 name = "__support_fputil_double_double",
1000 hdrs = ["src/__support/FPUtil/double_double.h"],
1001 deps = [
1002 ":__support_common",
1003 ":__support_fputil_multiply_add",
1004 ":__support_number_pair",
1005 ],
1006 )
1007
1008 libc_support_library(
1009 name = "__support_fputil_triple_double",
1010 hdrs = ["src/__support/FPUtil/triple_double.h"],
1011 deps = [
1012 ":__support_common",
1013 ],
1014 )
1015
1016 libc_support_library(
1017 name = "__support_fputil_dyadic_float",
1018 hdrs = ["src/__support/FPUtil/dyadic_float.h"],
1019 deps = [
1020 ":__support_big_int",
1021 ":__support_common",
1022 ":__support_cpp_type_traits",
1023 ":__support_fputil_fenv_impl",
1024 ":__support_fputil_fp_bits",
1025 ":__support_fputil_multiply_add",
1026 ":__support_macros_optimization",
1027 ],
1028 )
1029
1030 libc_support_library(
1031 name = "__support_osutil_syscall",
1032 hdrs = ["src/__support/OSUtil/syscall.h"],
1033 textual_hdrs = select({
1034 "@platforms//os:macos": [
1035 "src/__support/OSUtil/darwin/syscall.h",
1036 "src/__support/OSUtil/darwin/arm/syscall.h",
1037 ],
1038 "@platforms//os:linux": [
1039 "src/__support/OSUtil/linux/syscall.h",
1040 "src/__support/OSUtil/linux/aarch64/syscall.h",
1041 "src/__support/OSUtil/linux/x86_64/syscall.h",
1042 ],
1043 }),
1044 deps = [
1045 ":__support_common",
1046 ":__support_cpp_bit",
1047 ":__support_macros_sanitizer",
1048 ],
1049 )
1050
1051 libc_support_library(
1052 name = "__support_osutil_io",
1053 hdrs = ["src/__support/OSUtil/io.h"],
1054 textual_hdrs = select({
1055 "@platforms//os:macos": ["src/__support/OSUtil/darwin/io.h"],
1056 "@platforms//os:linux": ["src/__support/OSUtil/linux/io.h"],
1057 }),
1058 deps = [
1059 ":__support_common",
1060 ":__support_cpp_string_view",
1061 ":__support_osutil_syscall",
1062 ":string_utils",
1063 ],
1064 )
1065
1066 libc_support_library(
1067 name = "__support_osutil_exit",
1068 srcs = ["src/__support/OSUtil/linux/exit.cpp"],
1069 hdrs = ["src/__support/OSUtil/exit.h"],
1070 target_compatible_with = select({
1071 "@platforms//os:linux": [],
1072 "//conditions:default": ["@platforms//:incompatible"],
1073 }),
1074 deps = [
1075 ":__support_osutil_syscall",
1076 ],
1077 )
1078
1079 libc_support_library(
1080 name = "__support_osutil_pid",
1081 srcs = ["src/__support/OSUtil/linux/pid.cpp"],
1082 hdrs = ["src/__support/OSUtil/pid.h"],
1083 target_compatible_with = select({
1084 "@platforms//os:linux": [],
1085 "//conditions:default": ["@platforms//:incompatible"],
1086 }),
1087 deps = [
1088 ":__support_macros_attributes",
1089 ":__support_macros_optimization",
1090 ":__support_osutil_syscall",
1091 ":types_pid_t",
1092 ]
1093 )
1094
1095 libc_support_library(
1096 name = "__support_stringutil",
1097 srcs = glob(["src/__support/StringUtil/tables/**/*.h"]) + [
1098 "src/__support/StringUtil/error_to_string.cpp",
1099 "src/__support/StringUtil/message_mapper.h",
1100 "src/__support/StringUtil/platform_errors.h",
1101 "src/__support/StringUtil/platform_signals.h",
1102 "src/__support/StringUtil/signal_to_string.cpp",
1103 ],
1104 hdrs = [
1105 "src/__support/StringUtil/error_to_string.h",
1106 "src/__support/StringUtil/signal_to_string.h",
1107 ],
1108 target_compatible_with = select({
1109 "@platforms//os:linux": [],
1110 "//conditions:default": ["@platforms//:incompatible"],
1111 }),
1112 deps = [
1113 ":__support_cpp_array",
1114 ":__support_cpp_span",
1115 ":__support_cpp_string_view",
1116 ":__support_cpp_stringstream",
1117 ":__support_integer_to_string",
1118 ":__support_macros_attributes",
1119 ":errno",
1120 ],
1121 )
1122
1123 libc_support_library(
1124 name = "__support_threads_linux_futex_word_type",
1125 hdrs = [
1126 "src/__support/threads/linux/futex_word.h",
1127 ],
1128 target_compatible_with = select({
1129 "@platforms//os:linux": [],
1130 "//conditions:default": ["@platforms//:incompatible"],
1131 }),
1132 deps = [
1133 ":__support_osutil_syscall",
1134 ],
1135 )
1136
1137 libc_support_library(
1138 name = "__support_threads_linux_futex_utils",
1139 hdrs = [
1140 "src/__support/threads/linux/futex_utils.h",
1141 ],
1142 target_compatible_with = select({
1143 "@platforms//os:linux": [],
1144 "//conditions:default": ["@platforms//:incompatible"],
1145 }),
1146 deps = [
1147 ":__support_cpp_atomic",
1148 ":__support_cpp_optional",
1149 ":__support_osutil_syscall",
1150 ":__support_threads_linux_futex_word_type",
1151 ":__support_time_linux",
1152 ":types_struct_timespec",
1153 ],
1154 )
1155
1156 libc_support_library(
1157 name = "__support_threads_sleep",
1158 hdrs = ["src/__support/threads/sleep.h"],
1159 deps = [
1160 ":__support_macros_attributes",
1161 ":__support_macros_config",
1162 ],
1163 )
1164
1165 libc_support_library(
1166 name = "__support_threads_raw_mutex",
1167 hdrs = [
1168 "src/__support/threads/linux/raw_mutex.h",
1169 ],
1170 defines = [
1171 "LIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY",
1172 "LIBC_COPT_RAW_MUTEX_DEFAULT_SPIN_COUNT",
1173 ],
1174 target_compatible_with = select({
1175 "@platforms//os:linux": [],
1176 "//conditions:default": ["@platforms//:incompatible"],
1177 }),
1178 deps = [
1179 ":__support_cpp_optional",
1180 ":__support_threads_linux_futex_utils",
1181 ":__support_threads_sleep",
1182 ":__support_time_linux",
1183 ":types_pid_t",
1184 ],
1185 )
1186
1187 libc_support_library(
1188 name = "__support_threads_mutex",
1189 hdrs = [
1190 "src/__support/threads/mutex.h",
1191 "src/__support/threads/mutex_common.h",
1192 ],
1193 target_compatible_with = select({
1194 "@platforms//os:linux": [],
1195 "//conditions:default": ["@platforms//:incompatible"],
1196 }),
1197 textual_hdrs = [
1198 "src/__support/threads/linux/mutex.h",
1199 ],
1200 deps = [
1201 ":__support_cpp_atomic",
1202 ":__support_osutil_syscall",
1203 ":__support_threads_linux_futex_utils",
1204 ":__support_threads_raw_mutex",
1205 ":types_pid_t",
1206 ],
1207 )
1208
1209 libc_support_library(
1210 name = "__support_time",
1211 hdrs = glob(["src/__support/time/*.h"]),
1212 deps = [
1213 ":__support_common",
1214 ":hdr_time_macros",
1215 ":types_time_t",
1216 ],
1217 )
1218
1219 libc_support_library(
1220 name = "__support_time_linux",
1221 hdrs = glob(["src/__support/time/linux/**/*.h"]),
1222 target_compatible_with = select({
1223 "@platforms//os:linux": [],
1224 "//conditions:default": ["@platforms//:incompatible"],
1225 }),
1226 deps = [
1227 ":__support_common",
1228 ":__support_cpp_expected",
1229 ":__support_error_or",
1230 ":__support_libc_assert",
1231 ":__support_time",
1232 ":hdr_time_macros",
1233 ":types_clockid_t",
1234 ":types_struct_timespec",
1235 ],
1236 )
1237
1238 ############################### errno targets ################################
1239
1240 libc_function(
1241 name = "errno",
1242 srcs = ["src/errno/libc_errno.cpp"],
1243 hdrs = ["src/errno/libc_errno.h"],
1244 deps = [
1245 ":__support_common",
1246 ":__support_cpp_atomic",
1247 ":__support_macros_attributes",
1248 ":__support_macros_properties_architectures",
1249 ":hdr_errno_macros",
1250 ],
1251 )
1252
1253 ################################ fenv targets ################################
1254
1255 libc_function(
1256 name = "fetestexcept",
1257 srcs = ["src/fenv/fetestexcept.cpp"],
1258 hdrs = ["src/fenv/fetestexcept.h"],
1259 deps = [
1260 ":__support_common",
1261 ":__support_fputil_fenv_impl",
1262 ],
1263 )
1264
1265 libc_function(
1266 name = "fetestexceptflag",
1267 srcs = ["src/fenv/fetestexceptflag.cpp"],
1268 hdrs = ["src/fenv/fetestexceptflag.h"],
1269 deps = [
1270 ":__support_common",
1271 ":__support_fputil_fenv_impl",
1272 ":types_fexcept_t",
1273 ],
1274 )
1275
1276 libc_function(
1277 name = "feclearexcept",
1278 srcs = ["src/fenv/feclearexcept.cpp"],
1279 hdrs = ["src/fenv/feclearexcept.h"],
1280 deps = [
1281 ":__support_common",
1282 ":__support_fputil_fenv_impl",
1283 ],
1284 )
1285
1286 libc_function(
1287 name = "feraiseexcept",
1288 srcs = ["src/fenv/feraiseexcept.cpp"],
1289 hdrs = ["src/fenv/feraiseexcept.h"],
1290 deps = [
1291 ":__support_common",
1292 ":__support_fputil_fenv_impl",
1293 ],
1294 )
1295
1296 libc_function(
1297 name = "fegetround",
1298 srcs = ["src/fenv/fegetround.cpp"],
1299 hdrs = ["src/fenv/fegetround.h"],
1300 deps = [
1301 ":__support_common",
1302 ":__support_fputil_fenv_impl",
1303 ],
1304 )
1305
1306 libc_function(
1307 name = "fesetround",
1308 srcs = ["src/fenv/fesetround.cpp"],
1309 hdrs = ["src/fenv/fesetround.h"],
1310 deps = [
1311 ":__support_common",
1312 ":__support_fputil_fenv_impl",
1313 ],
1314 )
1315
1316 libc_function(
1317 name = "fedisableexcept",
1318 srcs = ["src/fenv/fedisableexcept.cpp"],
1319 hdrs = ["src/fenv/fedisableexcept.h"],
1320 deps = [
1321 ":__support_common",
1322 ":__support_fputil_fenv_impl",
1323 ],
1324 )
1325
1326 libc_function(
1327 name = "feenableexcept",
1328 srcs = ["src/fenv/feenableexcept.cpp"],
1329 hdrs = ["src/fenv/feenableexcept.h"],
1330 deps = [
1331 ":__support_common",
1332 ":__support_fputil_fenv_impl",
1333 ],
1334 )
1335
1336 libc_function(
1337 name = "fegetexcept",
1338 srcs = ["src/fenv/fegetexcept.cpp"],
1339 hdrs = ["src/fenv/fegetexcept.h"],
1340 deps = [
1341 ":__support_common",
1342 ":__support_fputil_fenv_impl",
1343 ],
1344 )
1345
1346 libc_function(
1347 name = "fegetenv",
1348 srcs = ["src/fenv/fegetenv.cpp"],
1349 hdrs = ["src/fenv/fegetenv.h"],
1350 deps = [
1351 ":__support_common",
1352 ":__support_fputil_fenv_impl",
1353 ],
1354 )
1355
1356 libc_function(
1357 name = "fesetenv",
1358 srcs = ["src/fenv/fesetenv.cpp"],
1359 hdrs = ["src/fenv/fesetenv.h"],
1360 deps = [
1361 ":__support_common",
1362 ":__support_fputil_fenv_impl",
1363 ],
1364 )
1365
1366 libc_function(
1367 name = "feupdateenv",
1368 srcs = ["src/fenv/feupdateenv.cpp"],
1369 hdrs = ["src/fenv/feupdateenv.h"],
1370 deps = [
1371 ":__support_common",
1372 ":__support_fputil_fenv_impl",
1373 ],
1374 )
1375
1376 libc_function(
1377 name = "fesetexcept",
1378 srcs = ["src/fenv/fesetexcept.cpp"],
1379 hdrs = ["src/fenv/fesetexcept.h"],
1380 deps = [
1381 ":__support_common",
1382 ":__support_fputil_fenv_impl",
1383 ],
1384 )
1385
1386 libc_function(
1387 name = "fegetexceptflag",
1388 srcs = ["src/fenv/fegetexceptflag.cpp"],
1389 hdrs = ["src/fenv/fegetexceptflag.h"],
1390 deps = [
1391 ":__support_common",
1392 ":__support_fputil_fenv_impl",
1393 ":types_fexcept_t",
1394 ],
1395 )
1396
1397 libc_function(
1398 name = "fesetexceptflag",
1399 srcs = ["src/fenv/fesetexceptflag.cpp"],
1400 hdrs = ["src/fenv/fesetexceptflag.h"],
1401 deps = [
1402 ":__support_common",
1403 ":__support_fputil_fenv_impl",
1404 ":types_fexcept_t",
1405 ],
1406 )
1407
1408 libc_function(
1409 name = "feholdexcept",
1410 srcs = ["src/fenv/feholdexcept.cpp"],
1411 hdrs = ["src/fenv/feholdexcept.h"],
1412 deps = [
1413 ":__support_common",
1414 ":__support_fputil_fenv_impl",
1415 ],
1416 )
1417
1418 ################################ math targets ################################
1419
1420 libc_support_library(
1421 name = "common_constants",
1422 srcs = ["src/math/generic/common_constants.cpp"],
1423 hdrs = ["src/math/generic/common_constants.h"],
1424 deps = [
1425 ":__support_fputil_triple_double",
1426 ":__support_number_pair",
1427 ],
1428 )
1429
1430 libc_support_library(
1431 name = "range_reduction",
1432 hdrs = [
1433 "src/math/generic/range_reduction.h",
1434 "src/math/generic/range_reduction_fma.h",
1435 ],
1436 deps = [
1437 ":__support_common",
1438 ":__support_fputil_fma",
1439 ":__support_fputil_fp_bits",
1440 ":__support_fputil_multiply_add",
1441 ":__support_fputil_nearest_integer",
1442 ],
1443 )
1444
1445 libc_support_library(
1446 name = "sincosf_utils",
1447 hdrs = ["src/math/generic/sincosf_utils.h"],
1448 deps = [
1449 ":__support_fputil_fp_bits",
1450 ":__support_fputil_polyeval",
1451 ":range_reduction",
1452 ],
1453 )
1454
1455 libc_support_library(
1456 name = "explogxf",
1457 srcs = ["src/math/generic/explogxf.cpp"],
1458 hdrs = ["src/math/generic/explogxf.h"],
1459 deps = [
1460 ":__support_common",
1461 ":__support_fputil_fenv_impl",
1462 ":__support_fputil_fma",
1463 ":__support_fputil_fp_bits",
1464 ":__support_fputil_multiply_add",
1465 ":__support_fputil_nearest_integer",
1466 ":__support_fputil_polyeval",
1467 ":common_constants",
1468 ],
1469 )
1470
1471 libc_support_library(
1472 name = "inv_trigf_utils",
1473 srcs = ["src/math/generic/inv_trigf_utils.cpp"],
1474 hdrs = ["src/math/generic/inv_trigf_utils.h"],
1475 deps = [
1476 ":__support_common",
1477 ":__support_fputil_fma",
1478 ":__support_fputil_multiply_add",
1479 ":__support_fputil_polyeval",
1480 ],
1481 )
1482
1483 libc_support_library(
1484 name = "log_range_reduction",
1485 hdrs = ["src/math/generic/log_range_reduction.h"],
1486 deps = [
1487 ":__support_common",
1488 ":__support_fputil_dyadic_float",
1489 ":__support_uint128",
1490 ":common_constants",
1491 ],
1492 )
1493
1494 libc_support_library(
1495 name = "exp10f_impl",
1496 hdrs = ["src/math/generic/exp10f_impl.h"],
1497 deps = [
1498 ":__support_fputil_basic_operations",
1499 ":__support_fputil_fma",
1500 ":__support_fputil_multiply_add",
1501 ":__support_fputil_nearest_integer",
1502 ":__support_fputil_polyeval",
1503 ":__support_fputil_rounding_mode",
1504 ":__support_macros_optimization",
1505 ":common_constants",
1506 ":explogxf",
1507 ],
1508 )
1509
1510 libc_support_library(
1511 name = "exp2f_impl",
1512 hdrs = ["src/math/generic/exp2f_impl.h"],
1513 deps = [
1514 ":__support_fputil_except_value_utils",
1515 ":__support_fputil_fma",
1516 ":__support_fputil_multiply_add",
1517 ":__support_fputil_nearest_integer",
1518 ":__support_fputil_polyeval",
1519 ":__support_fputil_rounding_mode",
1520 ":__support_macros_optimization",
1521 ":common_constants",
1522 ":explogxf",
1523 ],
1524 )
1525
1526 libc_math_function(
1527 name = "erff",
1528 additional_deps = [
1529 ":__support_fputil_multiply_add",
1530 ":__support_fputil_polyeval",
1531 ":__support_macros_optimization",
1532 ],
1533 )
1534
1535 libc_math_function(
1536 name = "expm1",
1537 additional_deps = [
1538 ":__support_fputil_double_double",
1539 ":__support_fputil_dyadic_float",
1540 ":__support_fputil_multiply_add",
1541 ":__support_fputil_nearest_integer",
1542 ":__support_fputil_polyeval",
1543 ":__support_fputil_rounding_mode",
1544 ":__support_fputil_triple_double",
1545 ":__support_integer_literals",
1546 ":__support_macros_optimization",
1547 ":common_constants",
1548 ":explogxf",
1549 ],
1550 )
1551
1552 libc_math_function(
1553 name = "expm1f",
1554 additional_deps = [
1555 ":__support_fputil_fma",
1556 ":__support_fputil_multiply_add",
1557 ":__support_fputil_nearest_integer",
1558 ":__support_fputil_polyeval",
1559 ":__support_fputil_rounding_mode",
1560 ":__support_macros_optimization",
1561 ":__support_macros_properties_cpu_features",
1562 ":common_constants",
1563 ],
1564 )
1565
1566 libc_math_function(
1567 name = "exp",
1568 additional_deps = [
1569 ":__support_fputil_double_double",
1570 ":__support_fputil_dyadic_float",
1571 ":__support_fputil_multiply_add",
1572 ":__support_fputil_nearest_integer",
1573 ":__support_fputil_polyeval",
1574 ":__support_fputil_rounding_mode",
1575 ":__support_fputil_triple_double",
1576 ":__support_integer_literals",
1577 ":__support_macros_optimization",
1578 ":common_constants",
1579 ":explogxf",
1580 ],
1581 )
1582
1583 libc_math_function(
1584 name = "expf",
1585 additional_deps = [
1586 ":__support_fputil_fma",
1587 ":__support_fputil_multiply_add",
1588 ":__support_fputil_nearest_integer",
1589 ":__support_fputil_polyeval",
1590 ":__support_fputil_rounding_mode",
1591 ":__support_macros_optimization",
1592 ":common_constants",
1593 ],
1594 )
1595
1596 libc_math_function(
1597 name = "exp10",
1598 additional_deps = [
1599 ":__support_fputil_double_double",
1600 ":__support_fputil_dyadic_float",
1601 ":__support_fputil_multiply_add",
1602 ":__support_fputil_nearest_integer",
1603 ":__support_fputil_polyeval",
1604 ":__support_fputil_rounding_mode",
1605 ":__support_fputil_triple_double",
1606 ":__support_integer_literals",
1607 ":__support_macros_optimization",
1608 ":common_constants",
1609 ":explogxf",
1610 ],
1611 )
1612
1613 libc_math_function(
1614 name = "exp10f",
1615 additional_deps = [
1616 ":exp10f_impl",
1617 ],
1618 )
1619
1620 libc_math_function(
1621 name = "exp2",
1622 additional_deps = [
1623 ":__support_fputil_double_double",
1624 ":__support_fputil_dyadic_float",
1625 ":__support_fputil_multiply_add",
1626 ":__support_fputil_nearest_integer",
1627 ":__support_fputil_polyeval",
1628 ":__support_fputil_rounding_mode",
1629 ":__support_fputil_triple_double",
1630 ":__support_integer_literals",
1631 ":__support_macros_optimization",
1632 ":common_constants",
1633 ":explogxf",
1634 ],
1635 )
1636
1637 libc_math_function(
1638 name = "exp2f",
1639 additional_deps = [
1640 ":exp2f_impl",
1641 ],
1642 )
1643
1644 libc_math_function(
1645 name = "logf",
1646 additional_deps = [
1647 ":__support_fputil_fma",
1648 ":__support_fputil_multiply_add",
1649 ":__support_fputil_polyeval",
1650 ":__support_macros_optimization",
1651 ":__support_macros_properties_cpu_features",
1652 ":common_constants",
1653 ],
1654 )
1655
1656 libc_math_function(
1657 name = "log2f",
1658 additional_deps = [
1659 ":__support_fputil_fma",
1660 ":__support_fputil_multiply_add",
1661 ":__support_fputil_polyeval",
1662 ":__support_macros_optimization",
1663 ":common_constants",
1664 ],
1665 )
1666
1667 libc_math_function(
1668 name = "log10f",
1669 additional_deps = [
1670 ":__support_fputil_fma",
1671 ":__support_fputil_multiply_add",
1672 ":__support_fputil_polyeval",
1673 ":__support_macros_optimization",
1674 ":__support_macros_properties_cpu_features",
1675 ":common_constants",
1676 ],
1677 )
1678
1679 libc_math_function(
1680 name = "log1pf",
1681 additional_deps = [
1682 ":__support_fputil_fma",
1683 ":__support_fputil_multiply_add",
1684 ":__support_fputil_polyeval",
1685 ":__support_macros_optimization",
1686 ":__support_macros_properties_cpu_features",
1687 ":common_constants",
1688 ],
1689 )
1690
1691 libc_math_function(
1692 name = "log",
1693 additional_deps = [
1694 ":__support_fputil_double_double",
1695 ":__support_fputil_dyadic_float",
1696 ":__support_fputil_fma",
1697 ":__support_fputil_multiply_add",
1698 ":__support_fputil_polyeval",
1699 ":__support_integer_literals",
1700 ":__support_macros_optimization",
1701 ":__support_macros_properties_cpu_features",
1702 ":common_constants",
1703 ":log_range_reduction",
1704 ],
1705 )
1706
1707 libc_math_function(
1708 name = "log2",
1709 additional_deps = [
1710 ":__support_fputil_double_double",
1711 ":__support_fputil_dyadic_float",
1712 ":__support_fputil_fma",
1713 ":__support_fputil_multiply_add",
1714 ":__support_fputil_polyeval",
1715 ":__support_integer_literals",
1716 ":__support_macros_optimization",
1717 ":__support_macros_properties_cpu_features",
1718 ":common_constants",
1719 ":log_range_reduction",
1720 ],
1721 )
1722
1723 libc_math_function(
1724 name = "log10",
1725 additional_deps = [
1726 ":__support_fputil_double_double",
1727 ":__support_fputil_dyadic_float",
1728 ":__support_fputil_fma",
1729 ":__support_fputil_multiply_add",
1730 ":__support_fputil_polyeval",
1731 ":__support_integer_literals",
1732 ":__support_macros_optimization",
1733 ":__support_macros_properties_cpu_features",
1734 ":common_constants",
1735 ":log_range_reduction",
1736 ],
1737 )
1738
1739 libc_math_function(
1740 name = "log1p",
1741 additional_deps = [
1742 ":__support_fputil_double_double",
1743 ":__support_fputil_dyadic_float",
1744 ":__support_fputil_fma",
1745 ":__support_fputil_multiply_add",
1746 ":__support_fputil_polyeval",
1747 ":__support_integer_literals",
1748 ":__support_macros_optimization",
1749 ":__support_macros_properties_cpu_features",
1750 ":common_constants",
1751 ],
1752 )
1753
1754 libc_math_function(
1755 name = "sinhf",
1756 additional_deps = [
1757 ":__support_fputil_fma",
1758 ":__support_fputil_multiply_add",
1759 ":__support_fputil_nearest_integer",
1760 ":__support_fputil_polyeval",
1761 ":__support_fputil_rounding_mode",
1762 ":__support_macros_optimization",
1763 ":common_constants",
1764 ":explogxf",
1765 ],
1766 )
1767
1768 libc_math_function(
1769 name = "coshf",
1770 additional_deps = [
1771 ":__support_fputil_fma",
1772 ":__support_fputil_multiply_add",
1773 ":__support_fputil_nearest_integer",
1774 ":__support_fputil_polyeval",
1775 ":__support_fputil_rounding_mode",
1776 ":__support_macros_optimization",
1777 ":common_constants",
1778 ":explogxf",
1779 ],
1780 )
1781
1782 libc_math_function(
1783 name = "cospif",
1784 additional_deps = [
1785 ":__support_fputil_fma",
1786 ":__support_fputil_multiply_add",
1787 ":__support_fputil_nearest_integer",
1788 ":__support_fputil_polyeval",
1789 ":__support_fputil_rounding_mode",
1790 ":__support_macros_optimization",
1791 ":common_constants",
1792 ":explogxf",
1793 ":sincosf_utils",
1794 ],
1795 )
1796
1797 libc_math_function(
1798 name = "tanhf",
1799 additional_deps = [
1800 ":__support_fputil_fma",
1801 ":__support_fputil_multiply_add",
1802 ":__support_fputil_nearest_integer",
1803 ":__support_fputil_polyeval",
1804 ":__support_fputil_rounding_mode",
1805 ":__support_macros_optimization",
1806 ":__support_macros_properties_cpu_features",
1807 ":common_constants",
1808 ":explogxf",
1809 ],
1810 )
1811
1812 libc_math_function(
1813 name = "asinhf",
1814 additional_deps = [
1815 ":__support_fputil_fma",
1816 ":__support_fputil_multiply_add",
1817 ":__support_fputil_nearest_integer",
1818 ":__support_fputil_polyeval",
1819 ":__support_fputil_sqrt",
1820 ":__support_macros_optimization",
1821 ":common_constants",
1822 ":explogxf",
1823 ],
1824 )
1825
1826 libc_math_function(
1827 name = "acoshf",
1828 additional_deps = [
1829 ":__support_fputil_fma",
1830 ":__support_fputil_multiply_add",
1831 ":__support_fputil_nearest_integer",
1832 ":__support_fputil_polyeval",
1833 ":__support_fputil_sqrt",
1834 ":__support_macros_optimization",
1835 ":common_constants",
1836 ":explogxf",
1837 ],
1838 )
1839
1840 libc_math_function(
1841 name = "atanhf",
1842 additional_deps = [
1843 ":__support_fputil_fma",
1844 ":__support_fputil_multiply_add",
1845 ":__support_fputil_nearest_integer",
1846 ":__support_fputil_polyeval",
1847 ":__support_macros_optimization",
1848 ":common_constants",
1849 ":explogxf",
1850 ],
1851 )
1852
1853 libc_math_function(
1854 name = "asinf",
1855 additional_deps = [
1856 ":__support_fputil_fma",
1857 ":__support_fputil_multiply_add",
1858 ":__support_fputil_nearest_integer",
1859 ":__support_fputil_polyeval",
1860 ":__support_fputil_sqrt",
1861 ":__support_macros_optimization",
1862 ":__support_macros_properties_cpu_features",
1863 ":inv_trigf_utils",
1864 ],
1865 )
1866
1867 libc_math_function(
1868 name = "acosf",
1869 additional_deps = [
1870 ":__support_fputil_fma",
1871 ":__support_fputil_multiply_add",
1872 ":__support_fputil_nearest_integer",
1873 ":__support_fputil_polyeval",
1874 ":__support_fputil_sqrt",
1875 ":__support_macros_optimization",
1876 ":inv_trigf_utils",
1877 ],
1878 )
1879
1880 libc_math_function(
1881 name = "atanf",
1882 additional_deps = [
1883 ":__support_fputil_fma",
1884 ":__support_fputil_multiply_add",
1885 ":__support_fputil_nearest_integer",
1886 ":__support_fputil_polyeval",
1887 ":__support_fputil_rounding_mode",
1888 ":__support_macros_optimization",
1889 ":inv_trigf_utils",
1890 ],
1891 )
1892
1893 libc_math_function(
1894 name = "powf",
1895 additional_deps = [
1896 ":__support_fputil_double_double",
1897 ":__support_fputil_multiply_add",
1898 ":__support_fputil_nearest_integer",
1899 ":__support_fputil_polyeval",
1900 ":__support_fputil_rounding_mode",
1901 ":__support_fputil_sqrt",
1902 ":__support_fputil_triple_double",
1903 ":__support_macros_optimization",
1904 ":common_constants",
1905 ":explogxf",
1906 ":exp2f_impl",
1907 ":exp10f_impl",
1908 ],
1909 )
1910
1911 libc_math_function(name = "fabs")
1912
1913 libc_math_function(name = "fabsf")
1914
1915 libc_math_function(name = "fabsl")
1916
1917 libc_math_function(name = "fabsf128")
1918
1919 libc_math_function(name = "fdim")
1920
1921 libc_math_function(name = "fdimf")
1922
1923 libc_math_function(name = "fdiml")
1924
1925 libc_math_function(name = "fdimf128")
1926
1927 libc_math_function(
1928 name = "ceil",
1929 specializations = [
1930 "generic",
1931 ],
1932 )
1933
1934 libc_math_function(
1935 name = "ceilf",
1936 specializations = [
1937 "generic",
1938 ],
1939 )
1940
1941 libc_math_function(
1942 name = "ceill",
1943 specializations = [
1944 "generic",
1945 ],
1946 )
1947
1948 libc_math_function(name = "ceilf128")
1949
1950 libc_math_function(
1951 name = "floor",
1952 specializations = [
1953 "generic",
1954 ],
1955 )
1956
1957 libc_math_function(
1958 name = "floorf",
1959 specializations = [
1960 "generic",
1961 ],
1962 )
1963
1964 libc_math_function(name = "floorl")
1965
1966 libc_math_function(name = "floorf128")
1967
1968 libc_math_function(name = "ldexp")
1969
1970 libc_math_function(name = "ldexpf")
1971
1972 libc_math_function(name = "ldexpl")
1973
1974 libc_math_function(name = "ldexpf128")
1975
1976 libc_math_function(
1977 name = "trunc",
1978 specializations = [
1979 "generic",
1980 ],
1981 )
1982
1983 libc_math_function(
1984 name = "truncf",
1985 specializations = [
1986 "generic",
1987 ],
1988 )
1989
1990 libc_math_function(name = "truncl")
1991
1992 libc_math_function(name = "truncf128")
1993
1994 libc_math_function(
1995 name = "round",
1996 specializations = [
1997 "generic",
1998 ],
1999 )
2000
2001 libc_math_function(
2002 name = "roundf",
2003 specializations = [
2004 "generic",
2005 ],
2006 )
2007
2008 libc_math_function(name = "roundl")
2009
2010 libc_math_function(name = "roundf128")
2011
2012 libc_math_function(
2013 name = "fmod",
2014 additional_deps = [
2015 ":__support_fputil_generic_fmod",
2016 ],
2017 )
2018
2019 libc_math_function(
2020 name = "fmodf",
2021 additional_deps = [
2022 ":__support_fputil_generic_fmod",
2023 ],
2024 )
2025
2026 libc_math_function(name = "frexp")
2027
2028 libc_math_function(name = "frexpf")
2029
2030 libc_math_function(name = "frexpl")
2031
2032 libc_math_function(name = "frexpf128")
2033
2034 libc_math_function(name = "hypot")
2035
2036 libc_math_function(
2037 name = "hypotf",
2038 additional_deps = [
2039 ":__support_fputil_double_double",
2040 ":__support_fputil_sqrt",
2041 ],
2042 )
2043
2044 libc_math_function(name = "logb")
2045
2046 libc_math_function(name = "logbf")
2047
2048 libc_math_function(name = "logbl")
2049
2050 libc_math_function(name = "logbf128")
2051
2052 libc_math_function(name = "modf")
2053
2054 libc_math_function(name = "modff")
2055
2056 libc_math_function(name = "modfl")
2057
2058 libc_math_function(name = "modff128")
2059
2060 libc_math_function(name = "remquo")
2061
2062 libc_math_function(name = "remquof")
2063
2064 libc_math_function(name = "remquol")
2065
2066 libc_math_function(name = "remainder")
2067
2068 libc_math_function(name = "remainderf")
2069
2070 libc_math_function(name = "remainderl")
2071
2072 libc_math_function(name = "fmin")
2073
2074 libc_math_function(name = "fminf")
2075
2076 libc_math_function(name = "fminl")
2077
2078 libc_math_function(name = "fminf128")
2079
2080 libc_math_function(name = "fmax")
2081
2082 libc_math_function(name = "fmaxf")
2083
2084 libc_math_function(name = "fmaxl")
2085
2086 libc_math_function(name = "fmaxf128")
2087
2088 libc_math_function(
2089 name = "cosf",
2090 additional_deps = [
2091 ":__support_fputil_fma",
2092 ":__support_fputil_multiply_add",
2093 ":__support_macros_optimization",
2094 ":__support_macros_properties_cpu_features",
2095 ":sincosf_utils",
2096 ],
2097 )
2098
2099 libc_math_function(
2100 name = "sincosf",
2101 additional_deps = [
2102 ":__support_fputil_fma",
2103 ":__support_fputil_multiply_add",
2104 ":__support_fputil_rounding_mode",
2105 ":__support_macros_optimization",
2106 ":__support_macros_properties_cpu_features",
2107 ":sincosf_utils",
2108 ],
2109 )
2110
2111 libc_math_function(
2112 name = "sinf",
2113 additional_deps = [
2114 ":__support_fputil_fma",
2115 ":__support_fputil_multiply_add",
2116 ":__support_fputil_polyeval",
2117 ":__support_fputil_rounding_mode",
2118 ":__support_macros_optimization",
2119 ":__support_macros_properties_cpu_features",
2120 ":range_reduction",
2121 ":sincosf_utils",
2122 ],
2123 )
2124
2125 libc_math_function(
2126 name = "tanf",
2127 additional_deps = [
2128 ":__support_fputil_fma",
2129 ":__support_fputil_multiply_add",
2130 ":__support_fputil_nearest_integer",
2131 ":__support_fputil_polyeval",
2132 ":__support_macros_optimization",
2133 ":__support_macros_properties_cpu_features",
2134 ":range_reduction",
2135 ":sincosf_utils",
2136 ],
2137 )
2138
2139 libc_math_function(
2140 name = "sqrt",
2141 additional_deps = [
2142 ":__support_fputil_sqrt",
2143 ],
2144 )
2145
2146 libc_math_function(
2147 name = "sqrtf",
2148 additional_deps = [
2149 ":__support_fputil_sqrt",
2150 ],
2151 )
2152
2153 libc_math_function(
2154 name = "sqrtl",
2155 additional_deps = [
2156 ":__support_fputil_sqrt",
2157 ],
2158 )
2159
2160 libc_math_function(
2161 name = "sqrtf128",
2162 additional_deps = [
2163 ":__support_fputil_sqrt",
2164 ],
2165 )
2166
2167 libc_math_function(name = "copysign")
2168
2169 libc_math_function(name = "copysignf")
2170
2171 libc_math_function(name = "copysignl")
2172
2173 libc_math_function(
2174 name = "copysignf128",
2175 additional_deps = [
2176 ":llvm_libc_types_float128",
2177 ],
2178 )
2179
2180 libc_math_function(name = "ilogb")
2181
2182 libc_math_function(name = "ilogbf")
2183
2184 libc_math_function(name = "ilogbl")
2185
2186 libc_math_function(name = "ilogbf128")
2187
2188 libc_math_function(name = "rint")
2189
2190 libc_math_function(name = "rintf")
2191
2192 libc_math_function(name = "rintl")
2193
2194 libc_math_function(name = "rintf128")
2195
2196 libc_math_function(name = "lrint")
2197
2198 libc_math_function(name = "lrintf")
2199
2200 libc_math_function(name = "lrintl")
2201
2202 libc_math_function(name = "lrintf128")
2203
2204 libc_math_function(name = "llrint")
2205
2206 libc_math_function(name = "llrintf")
2207
2208 libc_math_function(name = "llrintl")
2209
2210 libc_math_function(name = "llrintf128")
2211
2212 libc_math_function(name = "lround")
2213
2214 libc_math_function(name = "lroundf")
2215
2216 libc_math_function(name = "lroundl")
2217
2218 libc_math_function(name = "lroundf128")
2219
2220 libc_math_function(name = "llround")
2221
2222 libc_math_function(name = "llroundf")
2223
2224 libc_math_function(name = "llroundl")
2225
2226 libc_math_function(name = "llroundf128")
2227
2228 libc_math_function(
2229 name = "nan",
2230 additional_deps = [
2231 ":__support_str_to_float",
2232 ":errno",
2233 ],
2234 )
2235
2236 libc_math_function(
2237 name = "nanf",
2238 additional_deps = [
2239 ":__support_str_to_float",
2240 ":errno",
2241 ],
2242 )
2243
2244 libc_math_function(
2245 name = "nanl",
2246 additional_deps = [
2247 ":__support_str_to_float",
2248 ":errno",
2249 ],
2250 )
2251
2252 libc_math_function(
2253 name = "nanf128",
2254 additional_deps = [
2255 ":__support_str_to_float",
2256 ":errno",
2257 ],
2258 )
2259
2260 libc_math_function(name = "nearbyint")
2261
2262 libc_math_function(name = "nearbyintf")
2263
2264 libc_math_function(name = "nearbyintl")
2265
2266 libc_math_function(name = "nextafter")
2267
2268 libc_math_function(name = "nextafterf")
2269
2270 libc_math_function(name = "nextafterl")
2271
2272 libc_math_function(name = "nextafterf128")
2273
2274 libc_math_function(name = "nexttoward")
2275
2276 libc_math_function(name = "nexttowardf")
2277
2278 libc_math_function(name = "nexttowardl")
2279
2280 libc_math_function(name = "scalbn")
2281
2282 libc_math_function(name = "scalbnf")
2283
2284 libc_math_function(name = "scalbnl")
2285
2286 ############################## inttypes targets ##############################
2287
2288 libc_function(
2289 name = "imaxabs",
2290 srcs = ["src/inttypes/imaxabs.cpp"],
2291 hdrs = ["src/inttypes/imaxabs.h"],
2292 deps = [
2293 ":__support_common",
2294 ":__support_integer_operations",
2295 ],
2296 )
2297
2298 libc_function(
2299 name = "imaxdiv",
2300 srcs = ["src/inttypes/imaxdiv.cpp"],
2301 hdrs = ["src/inttypes/imaxdiv.h"],
2302 deps = [
2303 ":__support_common",
2304 ":__support_integer_operations",
2305 ],
2306 )
2307
2308 ############################### stdlib targets ###############################
2309
2310 libc_function(
2311 name = "abs",
2312 srcs = ["src/stdlib/abs.cpp"],
2313 hdrs = ["src/stdlib/abs.h"],
2314 deps = [
2315 ":__support_common",
2316 ":__support_integer_operations",
2317 ],
2318 )
2319
2320 libc_function(
2321 name = "labs",
2322 srcs = ["src/stdlib/labs.cpp"],
2323 hdrs = ["src/stdlib/labs.h"],
2324 deps = [
2325 ":__support_common",
2326 ":__support_integer_operations",
2327 ],
2328 )
2329
2330 libc_function(
2331 name = "llabs",
2332 srcs = ["src/stdlib/llabs.cpp"],
2333 hdrs = ["src/stdlib/llabs.h"],
2334 deps = [
2335 ":__support_common",
2336 ":__support_integer_operations",
2337 ],
2338 )
2339
2340 libc_function(
2341 name = "div",
2342 srcs = ["src/stdlib/div.cpp"],
2343 hdrs = ["src/stdlib/div.h"],
2344 deps = [
2345 ":__support_common",
2346 ":__support_integer_operations",
2347 ],
2348 )
2349
2350 libc_function(
2351 name = "ldiv",
2352 srcs = ["src/stdlib/ldiv.cpp"],
2353 hdrs = ["src/stdlib/ldiv.h"],
2354 deps = [
2355 ":__support_common",
2356 ":__support_integer_operations",
2357 ],
2358 )
2359
2360 libc_function(
2361 name = "lldiv",
2362 srcs = ["src/stdlib/lldiv.cpp"],
2363 hdrs = ["src/stdlib/lldiv.h"],
2364 deps = [
2365 ":__support_common",
2366 ":__support_integer_operations",
2367 ],
2368 )
2369
2370 libc_function(
2371 name = "atoi",
2372 srcs = ["src/stdlib/atoi.cpp"],
2373 hdrs = ["src/stdlib/atoi.h"],
2374 deps = [
2375 ":__support_common",
2376 ":__support_str_to_integer",
2377 ":errno",
2378 ],
2379 )
2380
2381 libc_function(
2382 name = "atol",
2383 srcs = ["src/stdlib/atol.cpp"],
2384 hdrs = ["src/stdlib/atol.h"],
2385 deps = [
2386 ":__support_common",
2387 ":__support_str_to_integer",
2388 ":errno",
2389 ],
2390 )
2391
2392 libc_function(
2393 name = "atoll",
2394 srcs = ["src/stdlib/atoll.cpp"],
2395 hdrs = ["src/stdlib/atoll.h"],
2396 deps = [
2397 ":__support_common",
2398 ":__support_str_to_integer",
2399 ":errno",
2400 ],
2401 )
2402
2403 libc_function(
2404 name = "atof",
2405 srcs = ["src/stdlib/atof.cpp"],
2406 hdrs = ["src/stdlib/atof.h"],
2407 deps = [
2408 ":__support_common",
2409 ":__support_str_to_float",
2410 ":errno",
2411 ],
2412 )
2413
2414 libc_function(
2415 name = "bsearch",
2416 srcs = ["src/stdlib/bsearch.cpp"],
2417 hdrs = ["src/stdlib/bsearch.h"],
2418 deps = [
2419 ":__support_common",
2420 ],
2421 )
2422
2423 libc_support_library(
2424 name = "qsort_util",
2425 hdrs = [
2426 "src/stdlib/heap_sort.h",
2427 "src/stdlib/qsort_data.h",
2428 "src/stdlib/qsort_util.h",
2429 "src/stdlib/quick_sort.h",
2430 ],
2431 deps = [
2432 ":__support_common",
2433 ":__support_cpp_cstddef",
2434 ":__support_macros_attributes",
2435 ],
2436 )
2437
2438 libc_function(
2439 name = "qsort",
2440 srcs = ["src/stdlib/qsort.cpp"],
2441 hdrs = ["src/stdlib/qsort.h"],
2442 deps = [
2443 ":__support_common",
2444 ":qsort_util",
2445 ],
2446 )
2447
2448 libc_function(
2449 name = "qsort_r",
2450 srcs = ["src/stdlib/qsort_r.cpp"],
2451 hdrs = ["src/stdlib/qsort_r.h"],
2452 deps = [
2453 ":__support_common",
2454 ":qsort_util",
2455 ],
2456 )
2457
2458 libc_function(
2459 name = "strtol",
2460 srcs = ["src/stdlib/strtol.cpp"],
2461 hdrs = ["src/stdlib/strtol.h"],
2462 deps = [
2463 ":__support_common",
2464 ":__support_str_to_integer",
2465 ":errno",
2466 ],
2467 )
2468
2469 libc_function(
2470 name = "strtoll",
2471 srcs = ["src/stdlib/strtoll.cpp"],
2472 hdrs = ["src/stdlib/strtoll.h"],
2473 deps = [
2474 ":__support_common",
2475 ":__support_str_to_integer",
2476 ":errno",
2477 ],
2478 )
2479
2480 libc_function(
2481 name = "strtoul",
2482 srcs = ["src/stdlib/strtoul.cpp"],
2483 hdrs = ["src/stdlib/strtoul.h"],
2484 deps = [
2485 ":__support_common",
2486 ":__support_str_to_integer",
2487 ":errno",
2488 ],
2489 )
2490
2491 libc_function(
2492 name = "strtoull",
2493 srcs = ["src/stdlib/strtoull.cpp"],
2494 hdrs = ["src/stdlib/strtoull.h"],
2495 deps = [
2496 ":__support_common",
2497 ":__support_str_to_integer",
2498 ":errno",
2499 ],
2500 )
2501
2502 libc_function(
2503 name = "strtof",
2504 srcs = ["src/stdlib/strtof.cpp"],
2505 hdrs = ["src/stdlib/strtof.h"],
2506 deps = [
2507 ":__support_common",
2508 ":__support_str_to_float",
2509 ":errno",
2510 ],
2511 )
2512
2513 libc_function(
2514 name = "strtod",
2515 srcs = ["src/stdlib/strtod.cpp"],
2516 hdrs = ["src/stdlib/strtod.h"],
2517 deps = [
2518 ":__support_common",
2519 ":__support_str_to_float",
2520 ":errno",
2521 ],
2522 )
2523
2524 libc_function(
2525 name = "strtold",
2526 srcs = ["src/stdlib/strtold.cpp"],
2527 hdrs = ["src/stdlib/strtold.h"],
2528 deps = [
2529 ":__support_common",
2530 ":__support_str_to_float",
2531 ":errno",
2532 ],
2533 )
2534
2535 ############################### string targets ###############################
2536
2537 no_sanitize_features = [
2538 "-asan",
2539 "-msan",
2540 "-tsan",
2541 "-ubsan",
2542 ]
2543
2544 libc_support_library(
2545 name = "string_memory_utils",
2546 hdrs = [
2547 "src/string/memory_utils/op_aarch64.h",
2548 "src/string/memory_utils/op_builtin.h",
2549 "src/string/memory_utils/op_generic.h",
2550 "src/string/memory_utils/op_riscv.h",
2551 "src/string/memory_utils/op_x86.h",
2552 "src/string/memory_utils/utils.h",
2553 ],
2554 textual_hdrs = [
2555 "src/string/memory_utils/aarch64/inline_bcmp.h",
2556 "src/string/memory_utils/aarch64/inline_memcmp.h",
2557 "src/string/memory_utils/aarch64/inline_memcpy.h",
2558 "src/string/memory_utils/aarch64/inline_memmove.h",
2559 "src/string/memory_utils/aarch64/inline_memset.h",
2560 "src/string/memory_utils/generic/aligned_access.h",
2561 "src/string/memory_utils/generic/byte_per_byte.h",
2562 "src/string/memory_utils/inline_bcmp.h",
2563 "src/string/memory_utils/inline_bzero.h",
2564 "src/string/memory_utils/inline_memcmp.h",
2565 "src/string/memory_utils/inline_memcpy.h",
2566 "src/string/memory_utils/inline_memmem.h",
2567 "src/string/memory_utils/inline_memmove.h",
2568 "src/string/memory_utils/inline_memset.h",
2569 "src/string/memory_utils/inline_strcmp.h",
2570 "src/string/memory_utils/inline_strstr.h",
2571 "src/string/memory_utils/riscv/inline_bcmp.h",
2572 "src/string/memory_utils/riscv/inline_memcmp.h",
2573 "src/string/memory_utils/riscv/inline_memcpy.h",
2574 "src/string/memory_utils/riscv/inline_memmove.h",
2575 "src/string/memory_utils/riscv/inline_memset.h",
2576 "src/string/memory_utils/x86_64/inline_bcmp.h",
2577 "src/string/memory_utils/x86_64/inline_memcmp.h",
2578 "src/string/memory_utils/x86_64/inline_memcpy.h",
2579 "src/string/memory_utils/x86_64/inline_memmove.h",
2580 "src/string/memory_utils/x86_64/inline_memset.h",
2581 ],
2582 deps = [
2583 ":__support_common",
2584 ":__support_cpp_array",
2585 ":__support_cpp_bit",
2586 ":__support_cpp_cstddef",
2587 ":__support_cpp_type_traits",
2588 ":__support_macros_attributes",
2589 ":__support_macros_optimization",
2590 ":__support_macros_properties_architectures",
2591 ":__support_macros_properties_cpu_features",
2592 ],
2593 )
2594
2595 libc_support_library(
2596 name = "string_utils",
2597 hdrs = ["src/string/string_utils.h"],
2598 deps = [
2599 ":__support_common",
2600 ":__support_cpp_bitset",
2601 ":__support_macros_optimization",
2602 ":string_memory_utils",
2603 ],
2604 )
2605
2606 libc_function(
2607 name = "memchr",
2608 srcs = ["src/string/memchr.cpp"],
2609 hdrs = ["src/string/memchr.h"],
2610 deps = [
2611 ":__support_common",
2612 ":string_utils",
2613 ],
2614 )
2615
2616 libc_function(
2617 name = "memcpy",
2618 srcs = ["src/string/memcpy.cpp"],
2619 hdrs = ["src/string/memcpy.h"],
2620 copts = ["-mllvm --tail-merge-threshold=0"],
2621 features = no_sanitize_features,
2622 weak = True,
2623 deps = [
2624 ":__support_common",
2625 ":string_memory_utils",
2626 ],
2627 )
2628
2629 libc_function(
2630 name = "memset",
2631 srcs = ["src/string/memset.cpp"],
2632 hdrs = ["src/string/memset.h"],
2633 features = no_sanitize_features,
2634 weak = True,
2635 deps = [
2636 ":__support_common",
2637 ":string_memory_utils",
2638 ],
2639 )
2640
2641 libc_function(
2642 name = "memmove",
2643 srcs = ["src/string/memmove.cpp"],
2644 hdrs = ["src/string/memmove.h"],
2645 features = no_sanitize_features,
2646 weak = True,
2647 deps = [
2648 ":__support_common",
2649 ":string_memory_utils",
2650 ],
2651 )
2652
2653 libc_function(
2654 name = "mempcpy",
2655 srcs = ["src/string/mempcpy.cpp"],
2656 hdrs = ["src/string/mempcpy.h"],
2657 copts = ["-mllvm --tail-merge-threshold=0"],
2658 features = no_sanitize_features,
2659 weak = True,
2660 deps = [
2661 ":__support_common",
2662 ":string_memory_utils",
2663 ],
2664 )
2665
2666 libc_function(
2667 name = "bcopy",
2668 srcs = ["src/string/bcopy.cpp"],
2669 hdrs = ["src/string/bcopy.h"],
2670 features = no_sanitize_features,
2671 deps = [
2672 ":__support_common",
2673 ":string_memory_utils",
2674 ],
2675 )
2676
2677 libc_function(
2678 name = "memcmp",
2679 srcs = ["src/string/memcmp.cpp"],
2680 hdrs = ["src/string/memcmp.h"],
2681 features = no_sanitize_features,
2682 weak = True,
2683 deps = [
2684 ":__support_common",
2685 ":__support_integer_operations",
2686 ":string_memory_utils",
2687 ],
2688 )
2689
2690 libc_function(
2691 name = "bcmp",
2692 srcs = ["src/string/bcmp.cpp"],
2693 hdrs = ["src/string/bcmp.h"],
2694 features = no_sanitize_features,
2695 weak = True,
2696 deps = [
2697 ":__support_common",
2698 ":string_memory_utils",
2699 ],
2700 )
2701
2702 libc_function(
2703 name = "bzero",
2704 srcs = ["src/string/bzero.cpp"],
2705 hdrs = ["src/string/bzero.h"],
2706 features = no_sanitize_features,
2707 weak = True,
2708 deps = [
2709 ":__support_common",
2710 ":string_memory_utils",
2711 ],
2712 )
2713
2714 libc_function(
2715 name = "memrchr",
2716 srcs = ["src/string/memrchr.cpp"],
2717 hdrs = ["src/string/memrchr.h"],
2718 deps = [
2719 ":__support_common",
2720 ":string_utils",
2721 ],
2722 )
2723
2724 libc_function(
2725 name = "strlen",
2726 srcs = ["src/string/strlen.cpp"],
2727 hdrs = ["src/string/strlen.h"],
2728 features = no_sanitize_features,
2729 deps = [
2730 ":__support_common",
2731 ":string_utils",
2732 ],
2733 )
2734
2735 libc_function(
2736 name = "strcpy",
2737 srcs = ["src/string/strcpy.cpp"],
2738 hdrs = ["src/string/strcpy.h"],
2739 features = no_sanitize_features,
2740 deps = [
2741 ":__support_common",
2742 ":memcpy",
2743 ":string_memory_utils",
2744 ":string_utils",
2745 ],
2746 )
2747
2748 # A sanitizer instrumented flavor of strcpy to be used with unittests.
2749 libc_function(
2750 name = "strcpy_sanitized",
2751 testonly = 1,
2752 srcs = ["src/string/strcpy.cpp"],
2753 hdrs = ["src/string/strcpy.h"],
2754 deps = [
2755 ":__support_common",
2756 ":memcpy",
2757 ":string_memory_utils",
2758 ":string_utils",
2759 ],
2760 )
2761
2762 libc_function(
2763 name = "strncpy",
2764 srcs = ["src/string/strncpy.cpp"],
2765 hdrs = ["src/string/strncpy.h"],
2766 deps = [
2767 ":__support_common",
2768 ],
2769 )
2770
2771 libc_function(
2772 name = "strcmp",
2773 srcs = ["src/string/strcmp.cpp"],
2774 hdrs = ["src/string/strcmp.h"],
2775 deps = [
2776 ":__support_common",
2777 ":string_memory_utils",
2778 ":string_utils",
2779 ],
2780 )
2781
2782 libc_function(
2783 name = "strchr",
2784 srcs = ["src/string/strchr.cpp"],
2785 hdrs = ["src/string/strchr.h"],
2786 deps = [
2787 ":__support_common",
2788 ":string_utils",
2789 ],
2790 )
2791
2792 libc_function(
2793 name = "strrchr",
2794 srcs = ["src/string/strrchr.cpp"],
2795 hdrs = ["src/string/strrchr.h"],
2796 deps = [
2797 ":__support_common",
2798 ":string_utils",
2799 ],
2800 )
2801
2802 libc_function(
2803 name = "strstr",
2804 srcs = ["src/string/strstr.cpp"],
2805 hdrs = ["src/string/strstr.h"],
2806 deps = [
2807 ":__support_common",
2808 ":string_memory_utils",
2809 ":string_utils",
2810 ],
2811 )
2812
2813 libc_function(
2814 name = "strnlen",
2815 srcs = ["src/string/strnlen.cpp"],
2816 hdrs = ["src/string/strnlen.h"],
2817 deps = [
2818 ":__support_common",
2819 ":string_utils",
2820 ],
2821 )
2822
2823 libc_function(
2824 name = "strcspn",
2825 srcs = ["src/string/strcspn.cpp"],
2826 hdrs = ["src/string/strcspn.h"],
2827 deps = [
2828 ":__support_common",
2829 ":string_utils",
2830 ],
2831 )
2832
2833 libc_function(
2834 name = "strspn",
2835 srcs = ["src/string/strspn.cpp"],
2836 hdrs = ["src/string/strspn.h"],
2837 deps = [
2838 ":__support_common",
2839 ":__support_cpp_bitset",
2840 ":string_utils",
2841 ],
2842 )
2843
2844 libc_function(
2845 name = "strpbrk",
2846 srcs = ["src/string/strpbrk.cpp"],
2847 hdrs = ["src/string/strpbrk.h"],
2848 deps = [
2849 ":__support_common",
2850 ":string_utils",
2851 ],
2852 )
2853
2854 libc_function(
2855 name = "strtok",
2856 srcs = ["src/string/strtok.cpp"],
2857 hdrs = ["src/string/strtok.h"],
2858 deps = [
2859 ":__support_common",
2860 ":string_utils",
2861 ],
2862 )
2863
2864 ################################ fcntl targets #################################
2865
2866 libc_function(
2867 name = "open",
2868 srcs = ["src/fcntl/linux/open.cpp"],
2869 hdrs = ["src/fcntl/open.h"],
2870 target_compatible_with = select({
2871 "@platforms//os:linux": [],
2872 "//conditions:default": ["@platforms//:incompatible"],
2873 }),
2874 deps = [
2875 ":__support_common",
2876 ":__support_osutil_syscall",
2877 ":errno",
2878 ],
2879 )
2880
2881 libc_function(
2882 name = "openat",
2883 srcs = ["src/fcntl/linux/openat.cpp"],
2884 hdrs = ["src/fcntl/openat.h"],
2885 target_compatible_with = select({
2886 "@platforms//os:linux": [],
2887 "//conditions:default": ["@platforms//:incompatible"],
2888 }),
2889 deps = [
2890 ":__support_common",
2891 ":__support_osutil_syscall",
2892 ":errno",
2893 ],
2894 )
2895
2896 libc_function(
2897 name = "creat",
2898 srcs = ["src/fcntl/linux/creat.cpp"],
2899 hdrs = ["src/fcntl/creat.h"],
2900 deps = [
2901 ":__support_common",
2902 ":__support_osutil_syscall",
2903 ":errno",
2904 ],
2905 )
2906
2907 ################################ unistd targets ################################
2908
2909 libc_function(
2910 name = "access",
2911 srcs = ["src/unistd/linux/access.cpp"],
2912 hdrs = ["src/unistd/access.h"],
2913 deps = [
2914 ":__support_common",
2915 ":__support_osutil_syscall",
2916 ":errno",
2917 ],
2918 )
2919
2920 libc_function(
2921 name = "chdir",
2922 srcs = ["src/unistd/linux/chdir.cpp"],
2923 hdrs = ["src/unistd/chdir.h"],
2924 deps = [
2925 ":__support_common",
2926 ":__support_osutil_syscall",
2927 ":errno",
2928 ],
2929 )
2930
2931 libc_function(
2932 name = "close",
2933 srcs = ["src/unistd/linux/close.cpp"],
2934 hdrs = ["src/unistd/close.h"],
2935 deps = [
2936 ":__support_common",
2937 ":__support_osutil_syscall",
2938 ":errno",
2939 ],
2940 )
2941
2942 libc_function(
2943 name = "dup",
2944 srcs = ["src/unistd/linux/dup.cpp"],
2945 hdrs = ["src/unistd/dup.h"],
2946 deps = [
2947 ":__support_common",
2948 ":__support_osutil_syscall",
2949 ":errno",
2950 ],
2951 )
2952
2953 libc_function(
2954 name = "dup2",
2955 srcs = ["src/unistd/linux/dup2.cpp"],
2956 hdrs = ["src/unistd/dup2.h"],
2957 deps = [
2958 ":__support_common",
2959 ":__support_osutil_syscall",
2960 ":errno",
2961 ],
2962 )
2963
2964 libc_function(
2965 name = "dup3",
2966 srcs = ["src/unistd/linux/dup3.cpp"],
2967 hdrs = ["src/unistd/dup3.h"],
2968 target_compatible_with = select({
2969 "@platforms//os:linux": [],
2970 "//conditions:default": ["@platforms//:incompatible"],
2971 }),
2972 deps = [
2973 ":__support_common",
2974 ":__support_osutil_syscall",
2975 ":errno",
2976 ],
2977 )
2978
2979 libc_function(
2980 name = "environ",
2981 srcs = ["src/unistd/environ.cpp"],
2982 hdrs = ["src/unistd/environ.h"],
2983 deps = [
2984 ":__support_common",
2985 ":__support_osutil_syscall",
2986 ":errno",
2987 ],
2988 )
2989
2990 libc_function(
2991 name = "fchdir",
2992 srcs = ["src/unistd/linux/fchdir.cpp"],
2993 hdrs = ["src/unistd/fchdir.h"],
2994 deps = [
2995 ":__support_common",
2996 ":__support_osutil_syscall",
2997 ":errno",
2998 ],
2999 )
3000
3001 libc_function(
3002 name = "fsync",
3003 srcs = ["src/unistd/linux/fsync.cpp"],
3004 hdrs = ["src/unistd/fsync.h"],
3005 deps = [
3006 ":__support_common",
3007 ":__support_osutil_syscall",
3008 ":errno",
3009 ],
3010 )
3011
3012 libc_function(
3013 name = "ftruncate",
3014 srcs = ["src/unistd/linux/ftruncate.cpp"],
3015 hdrs = ["src/unistd/ftruncate.h"],
3016 deps = [
3017 ":__support_common",
3018 ":__support_osutil_syscall",
3019 ":errno",
3020 ],
3021 )
3022
3023 # libc_function(
3024 # name = "getcwd",
3025 # srcs = ["src/unistd/linux/getcwd.cpp"],
3026 # hdrs = ["src/unistd/getcwd.h"],
3027 # deps = [
3028 # ":__support_common",
3029 # ":__support_osutil_syscall",
3030 # ":errno",
3031 # ],
3032 # )
3033
3034 libc_function(
3035 name = "geteuid",
3036 srcs = ["src/unistd/linux/geteuid.cpp"],
3037 hdrs = ["src/unistd/geteuid.h"],
3038 deps = [
3039 ":__support_common",
3040 ":__support_osutil_syscall",
3041 ":errno",
3042 ],
3043 )
3044
3045 libc_function(
3046 name = "getpid",
3047 srcs = ["src/unistd/linux/getpid.cpp"],
3048 hdrs = ["src/unistd/getpid.h"],
3049 deps = [
3050 ":__support_common",
3051 ":__support_macros_config",
3052 ":__support_osutil_pid",
3053 ":__support_osutil_syscall",
3054 ":errno",
3055 ":types_pid_t",
3056 ],
3057 )
3058
3059 libc_function(
3060 name = "getppid",
3061 srcs = ["src/unistd/linux/getppid.cpp"],
3062 hdrs = ["src/unistd/getppid.h"],
3063 deps = [
3064 ":__support_common",
3065 ":__support_osutil_syscall",
3066 ":errno",
3067 ],
3068 )
3069
3070 libc_function(
3071 name = "getuid",
3072 srcs = ["src/unistd/linux/getuid.cpp"],
3073 hdrs = ["src/unistd/getuid.h"],
3074 deps = [
3075 ":__support_common",
3076 ":__support_osutil_syscall",
3077 ":errno",
3078 ],
3079 )
3080
3081 # libc_function(
3082 # name = "getopt",
3083 # srcs = ["src/unistd/getopt.cpp"],
3084 # hdrs = ["src/unistd/getopt.h"],
3085 # deps = [
3086 # ":__support_common",
3087 # ":__support_cpp_optional",
3088 # ":__support_cpp_string_view",
3089 # ":__support_file_file",
3090 # ":__support_osutil_syscall",
3091 # ":errno",
3092 # ],
3093 # )
3094
3095 libc_function(
3096 name = "isatty",
3097 srcs = ["src/unistd/linux/isatty.cpp"],
3098 hdrs = ["src/unistd/isatty.h"],
3099 deps = [
3100 ":__support_common",
3101 ":__support_osutil_syscall",
3102 ":errno",
3103 ],
3104 )
3105
3106 libc_function(
3107 name = "link",
3108 srcs = ["src/unistd/linux/link.cpp"],
3109 hdrs = ["src/unistd/link.h"],
3110 deps = [
3111 ":__support_common",
3112 ":__support_osutil_syscall",
3113 ":errno",
3114 ],
3115 )
3116
3117 libc_function(
3118 name = "linkat",
3119 srcs = ["src/unistd/linux/linkat.cpp"],
3120 hdrs = ["src/unistd/linkat.h"],
3121 deps = [
3122 ":__support_common",
3123 ":__support_osutil_syscall",
3124 ":errno",
3125 ],
3126 )
3127
3128 libc_function(
3129 name = "pipe",
3130 srcs = ["src/unistd/linux/pipe.cpp"],
3131 hdrs = ["src/unistd/pipe.h"],
3132 deps = [
3133 ":__support_common",
3134 ":__support_macros_sanitizer",
3135 ":__support_osutil_syscall",
3136 ":errno",
3137 ],
3138 )
3139
3140 libc_function(
3141 name = "lseek",
3142 srcs = ["src/unistd/linux/lseek.cpp"],
3143 hdrs = ["src/unistd/lseek.h"],
3144 deps = [
3145 ":__support_common",
3146 ":__support_file_linux_lseekimpl",
3147 ":__support_osutil_syscall",
3148 ":errno",
3149 ],
3150 )
3151
3152 libc_function(
3153 name = "pread",
3154 srcs = ["src/unistd/linux/pread.cpp"],
3155 hdrs = ["src/unistd/pread.h"],
3156 target_compatible_with = select({
3157 "@platforms//os:linux": [],
3158 "//conditions:default": ["@platforms//:incompatible"],
3159 }),
3160 deps = [
3161 ":__support_common",
3162 ":__support_macros_sanitizer",
3163 ":__support_osutil_syscall",
3164 ":errno",
3165 ],
3166 )
3167
3168 libc_function(
3169 name = "pwrite",
3170 srcs = ["src/unistd/linux/pwrite.cpp"],
3171 hdrs = ["src/unistd/pwrite.h"],
3172 target_compatible_with = select({
3173 "@platforms//os:linux": [],
3174 "//conditions:default": ["@platforms//:incompatible"],
3175 }),
3176 deps = [
3177 ":__support_common",
3178 ":__support_osutil_syscall",
3179 ":errno",
3180 ],
3181 )
3182
3183 libc_function(
3184 name = "read",
3185 srcs = ["src/unistd/linux/read.cpp"],
3186 hdrs = ["src/unistd/read.h"],
3187 weak = True,
3188 deps = [
3189 ":__support_common",
3190 ":__support_macros_sanitizer",
3191 ":__support_osutil_syscall",
3192 ":errno",
3193 ],
3194 )
3195
3196 libc_function(
3197 name = "readlink",
3198 srcs = ["src/unistd/linux/readlink.cpp"],
3199 hdrs = ["src/unistd/readlink.h"],
3200 deps = [
3201 ":__support_common",
3202 ":__support_osutil_syscall",
3203 ":errno",
3204 ],
3205 )
3206
3207 libc_function(
3208 name = "readlinkat",
3209 srcs = ["src/unistd/linux/readlinkat.cpp"],
3210 hdrs = ["src/unistd/readlinkat.h"],
3211 deps = [
3212 ":__support_common",
3213 ":__support_osutil_syscall",
3214 ":errno",
3215 ],
3216 )
3217
3218 libc_function(
3219 name = "rmdir",
3220 srcs = ["src/unistd/linux/rmdir.cpp"],
3221 hdrs = ["src/unistd/rmdir.h"],
3222 deps = [
3223 ":__support_common",
3224 ":__support_osutil_syscall",
3225 ":errno",
3226 ],
3227 )
3228
3229 libc_function(
3230 name = "symlink",
3231 srcs = ["src/unistd/linux/symlink.cpp"],
3232 hdrs = ["src/unistd/symlink.h"],
3233 deps = [
3234 ":__support_common",
3235 ":__support_osutil_syscall",
3236 ":errno",
3237 ],
3238 )
3239
3240 libc_function(
3241 name = "symlinkat",
3242 srcs = ["src/unistd/linux/symlinkat.cpp"],
3243 hdrs = ["src/unistd/symlinkat.h"],
3244 deps = [
3245 ":__support_common",
3246 ":__support_osutil_syscall",
3247 ":errno",
3248 ],
3249 )
3250
3251 #TODO: Enable once fullbuild is added to bazel, since this depends on a macro
3252 # definition in the public header
3253
3254 # libc_function(
3255 # name = "syscall",
3256 # srcs = ["src/unistd/linux/syscall.cpp"],
3257 # hdrs = ["src/unistd/syscall.h"],
3258 # deps = [
3259 # ":__support_common",
3260 # ":__support_osutil_syscall",
3261 # ":errno",
3262 # ],
3263 # )
3264
3265 libc_function(
3266 name = "swab",
3267 srcs = ["src/unistd/swab.cpp"],
3268 hdrs = ["src/unistd/swab.h"],
3269 deps = [
3270 ":__support_common",
3271 ":__support_osutil_syscall",
3272 ":errno",
3273 ],
3274 )
3275
3276 libc_function(
3277 name = "truncate",
3278 srcs = ["src/unistd/linux/truncate.cpp"],
3279 hdrs = ["src/unistd/truncate.h"],
3280 deps = [
3281 ":__support_common",
3282 ":__support_osutil_syscall",
3283 ":errno",
3284 ],
3285 )
3286
3287 libc_function(
3288 name = "unlink",
3289 srcs = ["src/unistd/linux/unlink.cpp"],
3290 hdrs = ["src/unistd/unlink.h"],
3291 deps = [
3292 ":__support_common",
3293 ":__support_osutil_syscall",
3294 ":errno",
3295 ],
3296 )
3297
3298 libc_function(
3299 name = "unlinkat",
3300 srcs = ["src/unistd/linux/unlinkat.cpp"],
3301 hdrs = ["src/unistd/unlinkat.h"],
3302 deps = [
3303 ":__support_common",
3304 ":__support_osutil_syscall",
3305 ":errno",
3306 ],
3307 )
3308
3309 libc_function(
3310 name = "write",
3311 srcs = ["src/unistd/linux/write.cpp"],
3312 hdrs = ["src/unistd/write.h"],
3313 weak = True,
3314 deps = [
3315 ":__support_common",
3316 ":__support_osutil_syscall",
3317 ":errno",
3318 ],
3319 )
3320
3321 ################################ stdio targets #################################
3322
3323 libc_support_library(
3324 name = "printf_config",
3325 hdrs = ["src/stdio/printf_core/printf_config.h"],
3326 deps = [
3327 ],
3328 )
3329
3330 libc_support_library(
3331 name = "printf_core_structs",
3332 hdrs = ["src/stdio/printf_core/core_structs.h"],
3333 deps = [
3334 ":__support_cpp_string_view",
3335 ":__support_fputil_fp_bits",
3336 ":printf_config",
3337 ],
3338 )
3339
3340 libc_support_library(
3341 name = "printf_parser",
3342 hdrs = ["src/stdio/printf_core/parser.h"],
3343 deps = [
3344 ":__support_arg_list",
3345 ":__support_common",
3346 ":__support_cpp_algorithm",
3347 ":__support_cpp_bit",
3348 ":__support_cpp_optional",
3349 ":__support_cpp_string_view",
3350 ":__support_cpp_type_traits",
3351 ":__support_ctype_utils",
3352 ":__support_fputil_fp_bits",
3353 ":__support_str_to_integer",
3354 ":printf_config",
3355 ":printf_core_structs",
3356 ],
3357 )
3358
3359 # Only used for testing.
3360 libc_support_library(
3361 name = "printf_mock_parser",
3362 hdrs = ["src/stdio/printf_core/parser.h"],
3363 local_defines = ["LIBC_COPT_MOCK_ARG_LIST"],
3364 deps = [
3365 ":__support_arg_list",
3366 ":__support_common",
3367 ":__support_cpp_bit",
3368 ":__support_cpp_optional",
3369 ":__support_cpp_string_view",
3370 ":__support_cpp_type_traits",
3371 ":__support_ctype_utils",
3372 ":__support_fputil_fp_bits",
3373 ":__support_str_to_integer",
3374 ":printf_config",
3375 ":printf_core_structs",
3376 ],
3377 )
3378
3379 libc_support_library(
3380 name = "printf_writer",
3381 srcs = ["src/stdio/printf_core/writer.cpp"],
3382 hdrs = ["src/stdio/printf_core/writer.h"],
3383 deps = [
3384 ":__support_cpp_string_view",
3385 ":__support_macros_optimization",
3386 ":printf_core_structs",
3387 ":string_memory_utils",
3388 ],
3389 )
3390
3391 libc_support_library(
3392 name = "printf_converter",
3393 srcs = ["src/stdio/printf_core/converter.cpp"],
3394 hdrs = [
3395 "src/stdio/printf_core/char_converter.h",
3396 "src/stdio/printf_core/converter.h",
3397 "src/stdio/printf_core/converter_atlas.h",
3398 "src/stdio/printf_core/converter_utils.h",
3399 "src/stdio/printf_core/float_dec_converter.h",
3400 "src/stdio/printf_core/float_hex_converter.h",
3401 "src/stdio/printf_core/float_inf_nan_converter.h",
3402 "src/stdio/printf_core/int_converter.h",
3403 "src/stdio/printf_core/ptr_converter.h",
3404 "src/stdio/printf_core/string_converter.h",
3405 "src/stdio/printf_core/write_int_converter.h",
3406 ],
3407 deps = [
3408 ":__support_big_int",
3409 ":__support_common",
3410 ":__support_cpp_limits",
3411 ":__support_cpp_span",
3412 ":__support_cpp_string_view",
3413 ":__support_float_to_string",
3414 ":__support_fputil_fenv_impl",
3415 ":__support_fputil_fp_bits",
3416 ":__support_fputil_rounding_mode",
3417 ":__support_integer_to_string",
3418 ":__support_libc_assert",
3419 ":__support_uint128",
3420 ":printf_config",
3421 ":printf_core_structs",
3422 ":printf_writer",
3423 ],
3424 )
3425
3426 libc_support_library(
3427 name = "printf_main",
3428 srcs = ["src/stdio/printf_core/printf_main.cpp"],
3429 hdrs = ["src/stdio/printf_core/printf_main.h"],
3430 deps = [
3431 ":__support_arg_list",
3432 ":printf_converter",
3433 ":printf_core_structs",
3434 ":printf_parser",
3435 ":printf_writer",
3436 ],
3437 )
3438
3439 libc_support_library(
3440 name = "vfprintf_internal",
3441 hdrs = ["src/stdio/printf_core/vfprintf_internal.h"],
3442 deps = [
3443 ":__support_arg_list",
3444 ":__support_file_file",
3445 ":__support_macros_attributes",
3446 ":printf_main",
3447 ":printf_writer",
3448 ":types_FILE",
3449 ],
3450 )
3451
3452 libc_function(
3453 name = "sprintf",
3454 srcs = ["src/stdio/sprintf.cpp"],
3455 hdrs = ["src/stdio/sprintf.h"],
3456 deps = [
3457 ":__support_arg_list",
3458 ":__support_cpp_limits",
3459 ":errno",
3460 ":printf_main",
3461 ":printf_writer",
3462 ],
3463 )
3464
3465 libc_function(
3466 name = "snprintf",
3467 srcs = ["src/stdio/snprintf.cpp"],
3468 hdrs = ["src/stdio/snprintf.h"],
3469 deps = [
3470 ":__support_arg_list",
3471 ":errno",
3472 ":printf_main",
3473 ":printf_writer",
3474 ],
3475 )
3476
3477 libc_function(
3478 name = "printf",
3479 srcs = ["src/stdio/generic/printf.cpp"],
3480 hdrs = ["src/stdio/printf.h"],
3481 deps = [
3482 ":__support_arg_list",
3483 ":__support_file_file",
3484 ":errno",
3485 ":types_FILE",
3486 ":vfprintf_internal",
3487 ],
3488 )
3489
3490 libc_function(
3491 name = "fprintf",
3492 srcs = ["src/stdio/generic/fprintf.cpp"],
3493 hdrs = ["src/stdio/fprintf.h"],
3494 deps = [
3495 ":__support_arg_list",
3496 ":__support_file_file",
3497 ":errno",
3498 ":types_FILE",
3499 ":vfprintf_internal",
3500 ],
3501 )
3502
3503 libc_function(
3504 name = "vsprintf",
3505 srcs = ["src/stdio/vsprintf.cpp"],
3506 hdrs = ["src/stdio/vsprintf.h"],
3507 deps = [
3508 ":__support_arg_list",
3509 ":__support_cpp_limits",
3510 ":errno",
3511 ":printf_main",
3512 ":printf_writer",
3513 ],
3514 )
3515
3516 libc_function(
3517 name = "vsnprintf",
3518 srcs = ["src/stdio/vsnprintf.cpp"],
3519 hdrs = ["src/stdio/vsnprintf.h"],
3520 deps = [
3521 ":__support_arg_list",
3522 ":errno",
3523 ":printf_main",
3524 ":printf_writer",
3525 ],
3526 )
3527
3528 libc_function(
3529 name = "vprintf",
3530 srcs = ["src/stdio/generic/vprintf.cpp"],
3531 hdrs = ["src/stdio/vprintf.h"],
3532 deps = [
3533 ":__support_arg_list",
3534 ":__support_file_file",
3535 ":errno",
3536 ":types_FILE",
3537 ":vfprintf_internal",
3538 ],
3539 )
3540
3541 libc_function(
3542 name = "vfprintf",
3543 srcs = ["src/stdio/generic/vfprintf.cpp"],
3544 hdrs = ["src/stdio/vfprintf.h"],
3545 deps = [
3546 ":__support_arg_list",
3547 ":__support_file_file",
3548 ":errno",
3549 ":types_FILE",
3550 ":vfprintf_internal",
3551 ],
3552 )
3553
3554 libc_function(
3555 name = "remove",
3556 srcs = ["src/stdio/linux/remove.cpp"],
3557 hdrs = ["src/stdio/remove.h"],
3558 deps = [
3559 ":__support_common",
3560 ":__support_osutil_syscall",
3561 ":errno",
3562 ":types_FILE",
3563 ],
3564 )
3565
3566 libc_function(
3567 name = "rename",
3568 srcs = ["src/stdio/linux/rename.cpp"],
3569 hdrs = ["src/stdio/rename.h"],
3570 target_compatible_with = select({
3571 "@platforms//os:linux": [],
3572 "//conditions:default": ["@platforms//:incompatible"],
3573 }),
3574 deps = [
3575 ":__support_common",
3576 ":__support_osutil_syscall",
3577 ":errno",
3578 ":llvm_libc_macros_fcntl_macros",
3579 ],
3580 )
3581
3582 ############################### sys/stat targets ###############################
3583
3584 libc_function(
3585 name = "mkdir",
3586 srcs = ["src/sys/stat/linux/mkdir.cpp"],
3587 hdrs = ["src/sys/stat/mkdir.h"],
3588 deps = [
3589 ":__support_common",
3590 ":__support_osutil_syscall",
3591 ":errno",
3592 ],
3593 )
3594
3595 libc_function(
3596 name = "mkdirat",
3597 srcs = ["src/sys/stat/linux/mkdirat.cpp"],
3598 hdrs = ["src/sys/stat/mkdirat.h"],
3599 deps = [
3600 ":__support_common",
3601 ":__support_osutil_syscall",
3602 ":errno",
3603 ],
3604 )
3605
3606 ############################## sys/epoll targets ###############################
3607
3608 libc_function(
3609 name = "epoll_create",
3610 srcs = ["src/sys/epoll/linux/epoll_create.cpp"],
3611 hdrs = ["src/sys/epoll/epoll_create.h"],
3612 target_compatible_with = select({
3613 "@platforms//os:linux": [],
3614 "//conditions:default": ["@platforms//:incompatible"],
3615 }),
3616 weak = True,
3617 deps = [
3618 ":__support_osutil_syscall",
3619 ":errno",
3620 ],
3621 )
3622
3623 libc_function(
3624 name = "epoll_create1",
3625 srcs = ["src/sys/epoll/linux/epoll_create1.cpp"],
3626 hdrs = ["src/sys/epoll/epoll_create1.h"],
3627 target_compatible_with = select({
3628 "@platforms//os:linux": [],
3629 "//conditions:default": ["@platforms//:incompatible"],
3630 }),
3631 weak = True,
3632 deps = [
3633 ":__support_osutil_syscall",
3634 ":errno",
3635 ],
3636 )
3637
3638 libc_function(
3639 name = "epoll_ctl",
3640 srcs = ["src/sys/epoll/linux/epoll_ctl.cpp"],
3641 hdrs = ["src/sys/epoll/epoll_ctl.h"],
3642 target_compatible_with = select({
3643 "@platforms//os:linux": [],
3644 "//conditions:default": ["@platforms//:incompatible"],
3645 }),
3646 weak = True,
3647 deps = [
3648 ":__support_osutil_syscall",
3649 ":errno",
3650 ":hdr_sys_epoll_macros",
3651 ":types_struct_epoll_event",
3652 ],
3653 )
3654
3655 libc_function(
3656 name = "epoll_wait",
3657 srcs = ["src/sys/epoll/linux/epoll_wait.cpp"],
3658 hdrs = ["src/sys/epoll/epoll_wait.h"],
3659 target_compatible_with = select({
3660 "@platforms//os:linux": [],
3661 "//conditions:default": ["@platforms//:incompatible"],
3662 }),
3663 weak = True,
3664 deps = [
3665 ":__support_macros_sanitizer",
3666 ":__support_osutil_syscall",
3667 ":errno",
3668 ":hdr_signal_macros",
3669 ":hdr_sys_epoll_macros",
3670 ":types_sigset_t",
3671 ":types_struct_epoll_event",
3672 ],
3673 )
3674
3675 libc_function(
3676 name = "epoll_pwait",
3677 srcs = ["src/sys/epoll/linux/epoll_pwait.cpp"],
3678 hdrs = ["src/sys/epoll/epoll_pwait.h"],
3679 target_compatible_with = select({
3680 "@platforms//os:linux": [],
3681 "//conditions:default": ["@platforms//:incompatible"],
3682 }),
3683 weak = True,
3684 deps = [
3685 ":__support_macros_sanitizer",
3686 ":__support_osutil_syscall",
3687 ":errno",
3688 ":hdr_signal_macros",
3689 ":hdr_sys_epoll_macros",
3690 ":types_sigset_t",
3691 ":types_struct_epoll_event",
3692 ],
3693 )
3694
3695 #TODO: Enable once epoll_pwait2 availablilty can be checked first.
3696 # https://github.com/llvm/llvm-project/issues/80060
3697 # libc_function(
3698 # name = "epoll_pwait2",
3699 # srcs = ["src/sys/epoll/linux/epoll_pwait2.cpp"],
3700 # hdrs = ["src/sys/epoll/epoll_pwait2.h"],
3701 # target_compatible_with = select({
3702 # "@platforms//os:linux": [],
3703 # "//conditions:default": ["@platforms//:incompatible"],
3704 # }),
3705 # weak = True,
3706 # deps = [
3707 # ":__support_macros_sanitizer",
3708 # ":__support_osutil_syscall",
3709 # ":errno",
3710 # ":hdr_signal_macros",
3711 # ":hdr_sys_epoll_macros",
3712 # ":types_sigset_t",
3713 # ":types_struct_epoll_event",
3714 # ":types_struct_timespec",
3715 # ],
3716 # )