Commit Graph

1266 Commits

Author SHA1 Message Date
Siva Chandra Reddy 9145bf13b7 [libc] Add example programs and their CMake build and instructions.
These examples are serve as an examples for people wanting to start
using the libc.

Reviewed By: michaelrj, jeffbailey

Differential Revision: https://reviews.llvm.org/D137090
2022-11-04 08:31:06 +00:00
Siva Chandra Reddy 4eea884959 [libc] Add implementation of setbuf and setvbuf.
Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D137356
2022-11-04 07:15:13 +00:00
Siva Chandra Reddy c9da0352a3 [libc] Convert the api-test in to an integration test.
It used to pass but showed an annoying message about _start not being
available. That will not happen anymore.
2022-11-04 07:09:18 +00:00
Siva Chandra Reddy 1ceafe5e0f [libc] Add implementation of ungetc.
A bug in the file read logic has also been fixed along the way. Parts
of the ungetc tests will fail without that bug fixed.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D137286
2022-11-02 22:45:57 +00:00
Siva Chandra Reddy 136b927c9e [libc] Add a doc about the libc fullbuild mode.
Reviewed By: jeffbailey

Differential Revision: https://reviews.llvm.org/D137061
2022-11-02 08:18:48 -07:00
Siva Chandra Reddy f7fd4f319a [libc] Add links to libc Discourse and to the libc Discord channel.
Reviewed By: jeffbailey

Differential Revision: https://reviews.llvm.org/D137229
2022-11-02 08:03:53 -07:00
Siva Chandra Reddy a2a87ee7e9 [libc] Add a contributing guide to the docs.
Reviewed By: jeffbailey

Differential Revision: https://reviews.llvm.org/D136961
2022-11-02 08:02:11 -07:00
Siva Chandra Reddy 9dd7388668 [libc] Add a porting guide to the docs.
Reviewed By: jeffbailey

Differential Revision: https://reviews.llvm.org/D136960
2022-11-02 07:59:07 -07:00
Guillaume Chatelet 67437dd014 [reland][libc] Switch to new implementation of mem* functions
The new framework makes it explicit which processor feature is being
used and allows for easier per platform customization:
 - ARM cpu now uses trivial implementations to reduce code size.
 - Memcmp, Bcmp and Memmove have been optimized for x86
 - Bcmp has been optimized for aarch64.

This is a reland of https://reviews.llvm.org/D135134 (b3f1d58, 0284148813)

Reviewed By: courbet

Differential Revision: https://reviews.llvm.org/D136595
2022-11-02 09:09:46 +00:00
Guillaume Chatelet 3635195e0d [libc] Improve testing of mem functions
This patch extracts the testing logic from `op_tests.cpp` into
`memory_check_utils.h` so we can reuse it for mem* function integration
tests.

This makes testing consistent and thorough.
For instance this catches a bug that got unnoticed during submission of
D136595 and D135134. Integration test for memcmp was only testing a
single size.

This also leverages ASAN to make sure that data is not read / written
outside permitted boundaries

Differential Revision: https://reviews.llvm.org/D136865
2022-11-02 08:55:46 +00:00
Siva Chandra Reddy 15ae08c1a1 [libc] Add definitions of a few missing macros and types. 2022-11-02 07:17:33 +00:00
Siva Chandra Reddy f357a41265 [libc][Obvious] Fix a typo in a CMake file. 2022-11-01 23:18:34 +00:00
Siva Chandra Reddy 3756227ef6 [libc] Skip setjmp tests under sanitizers. 2022-11-01 23:13:57 +00:00
Siva Chandra Reddy 3b82b4fbd5 [libc] Add x86_64 implementation of setjmp and longjmp.
Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D137147
2022-11-01 22:58:35 +00:00
Tue Ly 45233cc1ca [libc][math] Add place-holder implementation for pow function.
Add place-holder implementation for pow function to unblock libc demo
examples.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D137109
2022-10-31 17:23:33 -04:00
Tue Ly 97b4cc83e1 [libc][math] Add place-holder implementation for asin to unblock demo examples.
Add a place-holder implementation for asin to unblock libc demo
examples.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D137105
2022-10-31 17:22:12 -04:00
Alex Brachet 5fd03c8176 [libc] Implement getopt
Differential Revision: https://reviews.llvm.org/D133487
2022-10-31 16:55:53 +00:00
Siva Chandra Reddy 53c251bd05 [libc] Fix the return value of fread and fwrite.
They were previously returning the number of bytes read. They should
instead be returning the number of objects read.
2022-10-29 06:10:35 +00:00
Michael Jones f418f88824 [libc] add locale free strcoll
The strcoll function is intended to compare strings based on their
ordering in the current locale. Since the locale facilities have not yet
been added, a simple implementation that is the same as strcmp has been
added as a placeholder.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D136802
2022-10-28 11:13:07 -07:00
Michael Jones 1f54641d33 [libc][obvious] fix scanf parser test
One of the expected values wasn't being initialized correctly.

Differential Revision: https://reviews.llvm.org/D136965
2022-10-28 11:02:15 -07:00
Michael Jones 7a129f0756 [libc] add scanf parser and core utilities
This is the first piece of scanf. It's very similar in design to printf,
and so much of the code is copied from that. There were potential issues
with conflicting macros so I've also renamed the "ASSERT_FORMAT_EQ"
macro for printf to "ASSERT_PFORMAT_EQ".

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D136288
2022-10-28 10:52:51 -07:00
Michael Jones 374cebe8df [libc] add features to bitset
This patch adds the flip, set_range, and operator== functions to bitset.
These will be used in scanf.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D136881
2022-10-28 10:52:48 -07:00
Michael Jones 2d52283391 [libc] add fgets
This adds the fgets function and its unit tests.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D136785
2022-10-27 10:27:24 -07:00
Guillaume Chatelet b6d3ae3d3d Revert D136595 "[libc] Switch to new implementation of mem* functions"
This patch seems to introduce bugs on aarch64.
Reverting while we investigate the root cause.

This reverts commit 0284148813.
2022-10-27 08:38:46 +00:00
Alex Brachet d6ac84bce8 Revert "[libc] Implement getopt"
This reverts commit a678f86351.
2022-10-27 06:47:24 +00:00
Alex Brachet a678f86351 [libc] Implement getopt
Differential Revision: https://reviews.llvm.org/D133487
2022-10-27 06:23:33 +00:00
Siva Chandra 227eb3d72d [libc] Cleanup stale documentation. 2022-10-26 22:53:15 -07:00
Siva Chandra Reddy 89ba240f4b [libc] Add a doc about the libc overlay mode.
Reviewed By: jeffbailey

Differential Revision: https://reviews.llvm.org/D136810
2022-10-26 21:53:29 -07:00
Tue Ly 1427550151 [libc] Add a testing macro for MPFR matchers skipping `explainError` calls.
Adding `EXPECT_MPFR_MATCH_ROUNDING_SILENTLY` macro that does not call
`explainError` when the tests fail.  This is useful to check the passing or
failing rates, such as hitting percentages of fast passes in math
implementations.

Reviewed By: michaelrj, sivachandra

Differential Revision: https://reviews.llvm.org/D136731
2022-10-26 18:11:45 -04:00
Siva Chandra 07b7023181 [libc] Enable more entrypoints on aarch64. 2022-10-26 14:03:15 -07:00
Michael Jones 2cd20ad90e [libc] tighten strtofloat cutoffs
When a number for strtofloat has an exponent that's too big or small, it
doesn't need to be calculated precisely since it is guaranteed to be
either INF or 0.0. This tightens those cutoffs to improve performance.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D136699
2022-10-26 11:17:15 -07:00
Siva Chandra f8490601c2 [libc] Enable a few entrypoints on aarch64 already available on x86_64. 2022-10-25 15:41:41 -07:00
Siva Chandra Reddy 22ea0e5d9b [libc] Add Linux implementations of time and clock functions.
Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D136666
2022-10-25 18:06:05 +00:00
Guillaume Chatelet 0284148813 [libc] Switch to new implementation of mem* functions
The new framework makes it explicit which processor feature is being
used and allows for easier per platform customization:
 - ARM cpu now uses trivial implementations to reduce code size.
 - Memcmp, Bcmp and Memmove have been optimized for x86
 - Bcmp has been optimized for aarch64.

This is a reland of https://reviews.llvm.org/D135134 (b3f1d58)

Differential Revision: https://reviews.llvm.org/D136595
2022-10-25 10:49:34 +00:00
Siva Chandra Reddy 6faf40bb75 [libc] Add the header sys/types.h.
Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D136642
2022-10-25 00:24:49 +00:00
Raman Tenneti cec276ac91 [libc] Build fix.
Build fix.

Reviewed By: rtenneti

Differential Revision: https://reviews.llvm.org/D136647
2022-10-24 16:18:52 -07:00
Raman Tenneti 12204429f2 [libc] Add implementation of difftime function.
The difftime function computes the difference between two calendar
times: time1 - time0 as per as per 7.27.2.2 section in
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2478.pdf.

  double difftime(time_t time1, time_t time0);

Tested:
Unit tests

Co-authored-by: Jeff Bailey <jeffbailey@google.com>

Reviewed By: jeffbailey

Differential Revision: https://reviews.llvm.org/D136631
2022-10-24 15:14:26 -07:00
Michael Jones 551c7aed70 [libc] add performance options for string to float
This allows the client to set compile flags to disable the passes that
the string to float function uses. A client may be willing to trade off
performance for a reduction in code size, and this allows for that
fine-tuning.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D136495
2022-10-24 11:36:16 -07:00
Guillaume Chatelet d7917fdc0f [libc] Use cpp::byte instead of char in mem* functions
`cpp::byte` is better than `char` which -depending on platform- can be `signed char` or `unsigned char`.  This has introduced subtle arithmetic errors.
2022-10-24 10:30:32 +00:00
Guillaume Chatelet 282fe5084d [libc] Fix generic 32-bit implementation of Bcmp/Memcmp 2022-10-24 10:15:28 +00:00
Guillaume Chatelet 55509b1136 [libc] Fix broken tests on arm32 2022-10-24 09:54:19 +00:00
Guillaume Chatelet 69090143f5 [libc] mem* framework v3
This version is more composable and also simpler at the expense of being more explicit and more verbose.

This patch provides rationale for the framework, implementation and unit tests but the functions themselves are still using the previous version. The change in implementation will come in a follow up patch.

Differential Revision: https://reviews.llvm.org/D136292
2022-10-24 09:13:46 +00:00
Schrodinger ZHU Yifan 12c62a6718 clean up std::iterator in LibcBenchmark.h
Reviewed By: gchatelet

Differential Revision: https://reviews.llvm.org/D135540
2022-10-23 10:33:45 +00:00
Guillaume Chatelet 6abea7a17e
[libc] Add missing is_unsigned in type_traits.h 2022-10-23 12:08:44 +02:00
Guillaume Chatelet d02525cab7 [libc] Add cpp::byte
This provides the equivalent of std::byte.
std::byte is a distinct type that implements the concept of byte as specified in the C++ language definition.
https://en.cppreference.com/w/cpp/types/byte

Differential Revision: https://reviews.llvm.org/D136294
2022-10-22 20:54:14 +00:00
Siva Chandra Reddy 0480b45e9e [libc] Add implementation of fgetc.
Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D136421
2022-10-22 03:34:44 +00:00
Siva Chandra Reddy 2a038f9138 [libc] Add stdin definition.
Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D136398
2022-10-22 03:27:31 +00:00
Siva Chandra Reddy be4e425758 [libc] Add select.h and the implementation of the select function for Linux.
Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D136375
2022-10-22 03:17:48 +00:00
Siva Chandra Reddy 52d707d9fd [libc][Obvious] Add few missing license headers. 2022-10-21 00:01:36 +00:00
Michael Jones f1190bc0db [libc][obvious] fix comparison test cmake
The name of the libc target changed, this patch updates the cmake for
the string to float comparison test to use the correct name.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D136388
2022-10-20 16:23:32 -07:00
Guillaume Chatelet 3c438f6119 Revert D136292 "[libc] mem* framework v3"
This breaks llvm-libc build bots:
 - libc-x86_64-debian-dbg-asan
 - libc-x86_64-debian-fullbuild-dbg-asan
Address sanitizers fail with "AddressSanitizer: invalid alignment requested in aligned_alloc: 64, alignment must be a power of two and the requested size 0x41 must be a multiple of alignment (thread T0)"
 - libc-aarch64-ubuntu-dbg
 - libc-aarch64-ubuntu-fullbuild-dbg
https://lab.llvm.org/buildbot/#/builders/223/builds/8877/steps/7/logs/stdio
 - libc-arm32-debian-dbg
https://lab.llvm.org/buildbot/#/builders/229/builds/5201/steps/7/logs/stdio

This reverts commit 903cc71a82.
2022-10-20 13:59:05 +00:00
Guillaume Chatelet 903cc71a82 [libc] mem* framework v3
This version is more composable and also simpler at the expense of being more explicit and more verbose.

This patch provides rationale for the framework, implementation and unit tests but the functions themselves are still using the previous version. The change in implementation will come in a follow up patch.

Differential Revision: https://reviews.llvm.org/D136292
2022-10-20 13:44:07 +00:00
Guillaume Chatelet 35fb67a995 [libc][automemcpy] fix build after change in Arg enum 2022-10-20 11:59:19 +00:00
Guillaume Chatelet 3f81126a33 [libc][NFC] add missing static qualifiers in tests 2022-10-20 08:52:56 +00:00
Guillaume Chatelet e4b4d0f74f [libc][NFC] remove unneeded -lpthread for utils_test 2022-10-20 08:48:50 +00:00
Siva Chandra Reddy 9ec0ad75f5 [libc][Obvious] Fix incomplete spec definition of sys/random.h. 2022-10-20 06:57:00 +00:00
Siva Chandra Reddy c03ea285bd [libc][Obvious] Add termios.h to the list of x86_64 linux headers. 2022-10-19 23:00:15 +00:00
Siva Chandra Reddy 67957368ae [libc] Add implementation of sigaltstack for linux.
Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D135949
2022-10-18 22:04:30 +00:00
Siva Chandra Reddy 18daa8255a [libc][Obvious] Skip some termios tests when there no is /dev/tty. 2022-10-18 20:58:50 +00:00
Siva Chandra Reddy b2a294bcf8 [libc] Add termios.h and the implementation of functions declared in it.
Reviewed By: lntue, michaelrj

Differential Revision: https://reviews.llvm.org/D136143
2022-10-18 20:53:00 +00:00
Guillaume Chatelet a786096f9d [libc][NFC] Cleanup and document utils.h 2022-10-18 14:32:39 +00:00
Guillaume Chatelet 2e3b8b31ce [libc][NFC] Use ASSERT instead of EXPECT in tests 2022-10-18 14:32:39 +00:00
Jeff Bailey 7caae24473 [libc]Identify which processors are completed for Math
Switch from green checkmarks to the following legend:

X = x86_64
A = aarch64
a = arm32

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D136020
2022-10-18 03:12:44 +00:00
Michael Jones 40b494396b [libc] add putc, fputc, and putchar
These three functions are simple, but needed for libc build testing.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D135990
2022-10-17 16:29:04 -07:00
Jeff Bailey 998d1ebb27 [libc][cleanup] Docs clean up
* Make consistent heading names
 * Factor out |check| into an include for reuse
 * Use it everywhere (No more YES or UTF-8)
 * Remove unneeded summary from pages. People know why they're there.
 * Ensure source location headers everywhere.

Differential Revision: https://reviews.llvm.org/D136016
2022-10-15 15:29:48 +00:00
Sterling Augustine d8415b02a5 Revert "[libc] New version of the mem* framework"
This reverts commit https://reviews.llvm.org/D135134 (b3f1d58a13)

That revision appears to have broken Arm memcpy in some subtle
ways. Am communicating with the original author to get a
good reproduction.
2022-10-14 12:32:20 -07:00
Siva Chandra Reddy 8b0e84a6f6 [libc] Add implementation of the POSIX getcwd function.
Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D135905
2022-10-14 16:20:59 +00:00
Guillaume Chatelet b3f1d58a13 [libc] New version of the mem* framework
This version is more composable and also simpler at the expense of being more explicit and more verbose. It also provides minimal implementations for ARM platforms.

    Codegen can be checked here https://godbolt.org/z/chf1Y6eGM

    Differential Revision: https://reviews.llvm.org/D135134
2022-10-14 13:46:42 +00:00
Guillaume Chatelet 6d252a4888 Revert "[libc] New version of the mem* framework"
This reverts commit 9721687835.
2022-10-14 13:21:52 +00:00
Guillaume Chatelet 84f887c82b Revert "[libc] Fix embedded version of bcmp / memcmp"
This reverts commit 7c9b8fa6d2.
2022-10-14 13:21:19 +00:00
Guillaume Chatelet 7c9b8fa6d2 [libc] Fix embedded version of bcmp / memcmp 2022-10-14 13:09:53 +00:00
Guillaume Chatelet 9721687835 [libc] New version of the mem* framework
This version is more composable and also simpler at the expense of being more explicit and more verbose. It also provides minimal implementations for ARM platforms.

Codegen can be checked here https://godbolt.org/z/x19zvE59v

Differential Revision: https://reviews.llvm.org/D135134
2022-10-14 12:42:54 +00:00
Guillaume Chatelet 4fed4b0943 Revert "[libc] New version of the mem* framework"
This reverts commit 98bf836f31.
2022-10-14 12:27:04 +00:00
Guillaume Chatelet 98bf836f31 [libc] New version of the mem* framework
This version is more composable and also simpler at the expense of being more explicit and more verbose. It also provides minimal implementations for ARM platforms.

Codegen can be checked here https://godbolt.org/z/x19zvE59v

Differential Revision: https://reviews.llvm.org/D135134
2022-10-14 12:25:03 +00:00
Siva Chandra Reddy 02a543db66 [libc] Add a simple implementation of the posix_spawn function.
The implementation currently ignores all spawn attributes. Support for
them will be added in future changes.

A simple allocator for integration tests has been added so that the
integration test for posix_spawn can use the
posix_spawn_file_actions_add* functions.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D135752
2022-10-13 18:47:47 +00:00
Guillaume Chatelet 9d1f6466e5 Revert "[libc] New version of the mem* framework"
This reverts commit d55f2d8ab0.
2022-10-13 14:49:58 +00:00
Guillaume Chatelet d55f2d8ab0 [libc] New version of the mem* framework
This version is more composable and also simpler at the expense of being more explicit and more verbose. It also provides minimal implementations for ARM platforms.

Codegen can be checked here https://godbolt.org/z/x19zvE59v

Differential Revision: https://reviews.llvm.org/D135134
2022-10-13 14:44:03 +00:00
Michael Jones 35a4fe4c0b [libc] add headers sys/auxv sys/prctl and sys/time
These headers are uncommonly used, and from extensions, but some basic
support is needed. Macros have been added where available.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D135731
2022-10-12 13:19:50 -07:00
Guillaume Chatelet e431731e08 Revert "[libc] New version of the mem* framework"
This reverts commit 4c19439d24.
2022-10-12 15:35:18 +00:00
Guillaume Chatelet 4c19439d24 [libc] New version of the mem* framework
This version is more composable and also simpler at the expense of being more explicit and more verbose.
This patch is not meant to be submitted but gives an idea of the change.
Codegen can be checked in https://godbolt.org/z/6z1dEoWbs by removing the "static inline" before individual functions.

Unittests are coming.

Suggested review order:
 - utils
 - op_base
 - op_builtin
 - op_generic
 - op_x86 / op_aarch64
 - *_implementations.h

Differential Revision: https://reviews.llvm.org/D135134
2022-10-12 15:26:26 +00:00
Andre Vieira bc71aa4fbc [libc] Update benchmarks/README.md
This patch updates the instructions on how to run the mem* benchmarks in
README.md.

Differential Revision: https://reviews.llvm.org/D135582
2022-10-12 16:13:24 +01:00
Siva Chandra Reddy 28943d617a [libc] Add POSIX functions posix_spawn_file_actions_*.
Namely, posix_spawn_file_actions_addclose,
posix_spawn_file_actions_adddup2, posix_spawn_file_actions_addopen,
posix_spawn_file_actions_destroy, posix_spawn_file_actions_init have
been added.

Reviewed By: michaelrj, lntue

Differential Revision: https://reviews.llvm.org/D135603
2022-10-11 04:54:44 +00:00
Michael Jones a6abcfee8a [libc] fix header list for x86_64
Some headers hadn't been added, this fixes that and improves the
ordering.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D135629
2022-10-10 16:05:53 -07:00
Michael Jones aec239cdb8 [libc] reset errno in isatty tests
Errno wasn't getting reset between tests, causing cascading failures.

Differential Revision: https://reviews.llvm.org/D135627
2022-10-10 15:49:48 -07:00
Michael Jones 707996e486 [libc] handle case where /dev/tty doesn't exist
In the isatty test it was assumed that /dev/tty existed, but that's not
always the case. Now we check for that.

Differential Revision: https://reviews.llvm.org/D135626
2022-10-10 15:40:52 -07:00
Michael Jones 7639ba6906 [libc] add isatty
The isatty function uses the side effects of an ioctl call to determine
if a specific file descriptor is a terminal. I chose TIOCGETD (get line
discipline of terminal) because it didn't require any new structs.

Reviewed By: sivachandra, lntue

Differential Revision: https://reviews.llvm.org/D135618
2022-10-10 15:20:46 -07:00
Michael Jones 1ac525b28b [libc] add sysconf with pagesize
The sysconf function has many options, this patch adds the basic funtion
and the pagesize option. More options will be added in future patches.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D135409
2022-10-10 14:51:45 -07:00
Siva Chandra Reddy 438e59182b [libc] Add implementation of pthread_atfork.
Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D135432
2022-10-10 18:28:43 +00:00
Schrodinger ZHU Yifan 9eb11856cf Implement `getrandom` function for linux targets.
Reviewed By: michaelrj, sivachandra

Differential Revision: https://reviews.llvm.org/D134665
2022-10-10 11:00:35 -07:00
Jeff Bailey aa8ab5b213 [libc] Document which date funcs are needed/done
Reviewed By: rtenneti

Differential Revision: https://reviews.llvm.org/D135501
2022-10-08 00:06:22 +00:00
Michael Jones 7c7f331a00 [libc][nfc] fix comment in clock_gettime
The first line got split because it was too long. Now it's fixed.

Differential Revision: https://reviews.llvm.org/D135498
2022-10-07 16:17:41 -07:00
Michael Jones 07c0a41b53 [libc] add printf decimal float conversion
This patch adds support for converting doubles to string in the %f/F
format specifier. It does not yet support long doubles outside of the
double range. This implementation is based on the work of Ulf Adams,
specifically the Ryu Printf algorithm.

See:
Ulf Adams. 2019. Ryū revisited: printf floating point conversion.
Proc. ACM Program. Lang. 3, OOPSLA, Article 169 (October 2019), 23 pages.
https://doi.org/10.1145/3360595

Differential Revision: https://reviews.llvm.org/D131023
2022-10-07 11:25:25 -07:00
Michael Jones 07793f95c4 [libc] add strsignal and refactor message mapping
The logic for strsignal and strerror is very similar, so I've moved them
both to use a shared utility (MessageMapper) for the basic
functionality.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D135322
2022-10-07 11:11:53 -07:00
Michael Jones a9f95b769e [libc] add strerror_r function
I've implemente the gnu variant of strerror_r since that seems to be the
one more relevant to what we're trying to do.

Differential Revision: https://reviews.llvm.org/D135227
2022-10-07 11:07:06 -07:00
Dominic Chen 74ec467964 [libc] Resolve NaN/implementation-defined behavior of floating-point tests
Differential Revision: https://reviews.llvm.org/D134917
2022-10-06 21:11:47 -07:00
Michael Jones 6d65ac5009 [libc][obvious] move kill into fullbuild only
Signal is currently fullbuild only, so all functions inside it should be
as well.

Differential Revision: https://reviews.llvm.org/D135410
2022-10-06 15:35:45 -07:00
Michael Jones 9015810648 [libc] add kill
Add the kill syscall wrapper and tests.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D135406
2022-10-06 15:25:56 -07:00
Michael Jones f2a9974666 [libc] fix futex type
Previously the futex type was defined in terms of unsigned int, now it's
uint32, which is more portable.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D135408
2022-10-06 15:19:43 -07:00
Siva Chandra Reddy 3f965818b6 [libc] Add POSIX execv and execve functions.
The POSIX global variable environ has also been added.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D135351
2022-10-06 19:50:23 +00:00
Dominic Chen 8f10d204d1 Revert "[libc] Resolve NaN/implementation-defined behavior of floating-point tests"
This reverts commit 5470b1fcb5.
2022-10-05 16:33:32 -07:00