Age | Commit message (Collapse) | Author | Files | Lines |
|
This is an implementation of `ctime` and includes `ctime_r`.
According to documentation, `ctime` and `ctime_r` are defined as the
following:
```c
char *ctime(const time_t *timep);
char *ctime_r(const time_t *restrict timep, char buf[restrict 26]);
```
closes #86567
|
|
Co-authored-by: OverMighty <its.overmighty@gmail.com>
|
|
The `<time.h>` functions `asctime`, `gmtime`, `mktime` and their `_r`
variants are purely computational functions which convert between well
defined time representations and/or strings. There's no reason these
shouldn't be available in bare-metal builds of the library as well as
hosted ones: even if the library has no way to find out the time in
POSIX format, it might still see POSIX-style `time_t` values in input
data (e.g. network protocols) and need to interpret them.
The only obstacle to this was that the `out_of_range()` helper function
set `errno` to `EOVERFLOW`, which fails in a bare-metal build because
the extra POSIX error values aren't defined, including `EOVERFLOW`. So
I've made that assignment conditional on `EOVERFLOW` being defined.
Fixes #85556.
|
|
|
|
Co-authored-by: Petr Hosek <phosek@google.com>
|
|
[libc] Implement vasprintf and asprintf
---------
Co-authored-by: Izaak Schroeder <izaak.schroeder@gmail.com>
|
|
This is a follow up to #99262.
|
|
This is used in some embedded projects.
|
|
While C99 defines type generic isnan macro, BSD provided isnan, isnanf
and isnanl in prior C standards and existing code still relies on these.
|
|
These are not required and without these dependencies, we would wound up
with an unresolved reference to __cxa_finalize, which can be provided by
the vendor making this compatible with baremetal.
|
|
This introduces opaque type `struct __llvm_libc_stdin` and a symbol
`__llvm_libc_stdin_read` that's intended to be provided by the vendor.
`__llvm_libc_stdin_read` intentionally has the same signature as
`cookie_read_function_t` so it can be used with `fopencookie` to
represent `stdin` as `FILE *` in the future.
|
|
This is a simple baremetal implementation of puts akin to putchar.
|
|
This is implemented using `__llvm_libc_exit` which should be provided by
the vendor and thus available in baremetal configurations.
|
|
This is available as of #97936.
|
|
This is available as of #97489.
|
|
This makes it easier to diff the different configurations.
|
|
These are all supported on arm32 and riscv32.
|
|
baremetal. (#96372)
Downstream build issue reported:
https://ci.chromium.org/ui/p/fuchsia/builders/toolchain.ci/clang-linux-x64/b8744479865106393873/overview
|
|
|
|
(#95619)
This reverts commit eca988aa4420f33810f9830c80ff9f149b7928ff. The
underlying libc issue was fixed by PR#95576.
The original PR is #95436 , which adds printf, putchar and vprintf in
bareemetal entrypoints
|
|
This reverts commit b1de42a81d838bb0c6dea7d2436820a2456c730b, which
breaks libc build for baremetal targets.
|
|
We now have baremetal implementations of these entrypoints.
|
|
These are provided by newlib and many baremetal projects assume they're
available rather than providing their own implementation.
|
|
Provide C23 `fetestexceptflag` function according to 7.6.4.6 in the
latest [revision of the C
standard](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf)
from 2023-04-02.
Closes https://github.com/llvm/llvm-project/issues/87565.
|
|
Closes #87564
|
|
We compute atan2f(y, x) in 2 stages:
- Fast step: perform computations in double precision , with relative
errors < 2^-50
- Accurate step: if the result from the Fast step fails Ziv's rounding
test, then we perform computations in double-double precision, with
relative errors < 2^-100.
On Ryzen 5900X, worst-case latency is ~ 200 clocks, compared to average
latency ~ 60 clocks, and average reciprocal throughput ~ 20 clocks.
|
|
This is required to avoid compilation error in libc++.
See #85335 for more details.
|
|
To match the entrypoints and types we need to exclude __atexithandler_t
and __qsortrcompare_t, as well as qsort_r, which is a GNU extension.
This is a reland of llvm/llvm-project#85030.
|
|
These types and conversion functions are used in embedded development.
Note that we cannot yet include other entrypoints such as asctime
because `src/time/time_utils.h` unconditionally uses `EOVERFLOW`, which
is only defined in POSIX and not in C standard. This issue is tracked by
#85556.
|
|
These functions are usable on embedded platforms and are sometimes used
in various baremetal projects.
|
|
|
|
(#83959)
Fix https://github.com/llvm/llvm-project/issues/83924.
|
|
Fixed-point arithmetic support is targeted towards baremetal targets.
|
|
Many baremetal applications use asserts.
|
|
stdbit.h isn't complete yet, but looking to turn these on on more
targets for
earlier feedback.
|
|
This matches the entrypoints for baremetal ARM.
|
|
`__stack_chk_fail` uses `write_to_stderr` and `abort` but these
currently aren't included in baremetal targets resulting in a CMake
build error:
```
CMake Error at /llvm-project/libc/cmake/modules/LLVMLibCObjectRules.cmake:693 (target_link_libraries):
Target "libc.src.stdlib.abort" of type UTILITY may not be linked into
another target. One may link only to INTERFACE, OBJECT, STATIC or SHARED
libraries, or to executables with the ENABLE_EXPORTS property set.
Call Stack (most recent call first):
/llvm-project/libc/cmake/modules/LLVMLibCObjectRules.cmake:811 (create_entrypoint_object)
/llvm-project/libc/cmake/modules/LLVMLibCObjectRules.cmake:891 (expand_flags_for_entrypoint_object)
/llvm-project/libc/src/compiler/generic/CMakeLists.txt:1 (add_entrypoint_object)
CMake Error at /llvm-project/libc/cmake/modules/LLVMLibCLibraryRules.cmake:5 (get_target_property):
get_target_property() called with non-existent target
"libc.src.__support.OSUtil.osutil".
Call Stack (most recent call first):
/llvm-project/libc/cmake/modules/LLVMLibCLibraryRules.cmake:36 (collect_object_file_deps)
/llvm-project/libc/cmake/modules/LLVMLibCLibraryRules.cmake:36 (collect_object_file_deps)
/llvm-project/libc/cmake/modules/LLVMLibCLibraryRules.cmake:85 (collect_object_file_deps)
/llvm-project/libc/lib/CMakeLists.txt:26 (add_entrypoint_library)
```
To address these errors, we need to include `abort` in the list of
baremetal entrypoints. We also need to provide `write_to_stderr`
baremetal implementation, but this is challenging since there is no
uniform way to print a message on these platforms (sometimes there may
not be any way to print a message). We instead defer to
`__libc_log_write` which can be provided by the underlying platform. We
use a similar approach for `quick_exit`, defering to
`__libc_quick_exit`.
|
|
__stack_chk_fail should be provided by libc.a, not startup files.
Add __stack_chk_fail to existing linux and arm entrypoints. On Windows
(when
not targeting MinGW), it seems that the corresponding function
identifier is
__security_check_cookie, so no entrypoint is added for Windows.
Baremetal
targets also ought to be compileable with `-fstack-protector*`
There is no common header for this prototype, since calls to
__stack_chk_fail
are meant to be inserted by the compiler upon function return when
compiled
`-fstack-protector*`.
|
|
64 bits versions
This patch enables the compilation of libc for rv32 by unifying the
current rv64 and rv32 implementation into a single rv implementation.
We updated the cmake file to match the new riscv32 arch and force
LIBC_TARGET_ARCHITECTURE to be "riscv" whenever we find "riscv32" or
"riscv64". This is required as LIBC_TARGET_ARCHITECTURE is used in the
path for several platform specific implementations.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D148797
|