Add support for getenv as defined by the Open Group's "System Interface &
Header" in https://pubs.opengroup.org/onlinepubs/7908799/xsh/getenv.html
getenv requires a standard way of accessing the environment,
so a pointer to the environment is added to the startup in crt1.
Consquently, this function is not usable on top of other libcs.
Added starts_with method to StringView. getenv function uses it.
Co-authored-by: Jeff Bailey <jeffbailey@google.com>
Reviewed By: sivachandra, rtenneti
Differential Revision: https://reviews.llvm.org/D119403
Previously, allocator functions were only available if they were included
from scudo or by using the system libc headers (i.e. by turning off the
full build). This patch changes the logic to include the prototypes for
the allocator functitons in all cases, which allows the linker to link
in the system's allocator.
Reviewed By: sivachandra, abrachet
Differential Revision: https://reviews.llvm.org/D119587
the vector class, due to being dynamically resized, needs malloc. This
fixes the build so that it only includes it when malloc should be
available.
Differential Revision: https://reviews.llvm.org/D119464
Add a basic implementation of the vector class for use internally to
LLVM-libc.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D118954
GCC complains about undefined reference in LibcTest.cpp and indeed the wrong version of the template has been explicitly instanciated.
This is necessary to get llvm-libc compile with GCC.
Mentionning D119002 here for navigability.
Differential Revision: https://reviews.llvm.org/D119242
Although type punning is defined for union in C, it is UB in C++.
This patch introduces a bit_cast function to convert between types in a safe way.
This is necessary to get llvm-libc compile with GCC.
This patch is extracted from D119002.
Differential Revision: https://reviews.llvm.org/D119145
These were all the non OS agnostic implementations I could find in general directories.
Currently none of these functions are actually enabled, but for when they do it makes sense that they be in linux/ specific directories.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D119164
This implementation relies on storing data in registers for sizes up to 128B.
Then depending on whether `dst` is less (resp. greater) than `src` we move data forward (resp. backward) by chunks of 32B.
We first make sure one of the pointers is aligned to increase performance on large move sizes.
Differential Revision: https://reviews.llvm.org/D114637
llvm-libc exhibits a C interface but its source is C++.
This patch explicitly disables the use of exceptions and RTTI when compiling the entrypoints.
Differential Revision: https://reviews.llvm.org/D118889
CMAKE_CXX_STANDARD 14 is set in the llvm-project/llvm folder overriding all COMPILE_OPTIONS -std=c++17. We need to override the CXX_STANDARD property of the target in order to set the correct C++ standard flags.
Reviewed By: gchatelet
Differential Revision: https://reviews.llvm.org/D118871
The LLVM Libc project is no longer just a proposal and should have
a webpage tracking the status of the project. This changes
puts the pieces into the right place so that the webpage can be
created.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D117436
They are implemented as simple syscall wrappers. The file creation
macros have been put in a header file as a temporary solution until we
have a cleaner approach to listing platform relevant macros.
Reviewed By: abrachet
Differential Revision: https://reviews.llvm.org/D118396
Guard sqrt_80_bit_long_double.h header to not be included with aarch64.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D118389
The type names in the spec are just sugar used by the header generator to
generate the function prototype. Giving the VarArgType a name of "..."
allows the header generator to treat and generate the "type name" for var
arg parameters similar to how it does for any other type.
Refactor sqrt implementations:
- Move architecture specific instructions from `src/math/<arch>` to `src/__support/FPUtil/<arch>` folder.
- Move generic implementation of `sqrt` to `src/__support/FPUtil/generic` folder and add it as a header library.
- Use `src/__support/FPUtil/sqrt.h` for architecture/generic selections.
- Add unit tests for generic implementation of `sqrt`.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D118173
Make logf function correctly rounded for all rounding modes.
Reviewed By: sivachandra, zimmermann6, santoshn, jpl169
Differential Revision: https://reviews.llvm.org/D118149
Based on RLIBM implementation similar to logf and log2f. Most of the exceptional inputs are the exact powers of 10.
Reviewed By: sivachandra, zimmermann6, santoshn, jpl169
Differential Revision: https://reviews.llvm.org/D118093
in all the other `add_tablegen` calls, the project name is so transformed so it
can be a prefix of a CMake variable. I think it is better to do do that here
too for consistency.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D117979