| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
This patch updates the struct dirent to be on par with glibc (by adding
a missing d_type member) and update the readdir call to use SYS_getdents64
instead of SYS_getdents.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D147738
|
|
|
|
|
|
|
|
|
|
|
| |
The previous patches added the necessary support for global constructors
used to register tests. This patch enables the AMDGPU target to build
and run the unit tests on the GPU. Currently this only tests the `ctype`
tests, but adding more should be straightforward from here on.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D149517
|
|
|
|
|
|
|
|
|
|
| |
This patch adds the function "socket" from the header "sys/socket". It's
a simple syscall wrapper, and I plan on adding the related functions in
a followup patch.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D149622
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch implements the `exit` function on the GPU. This required
breaking the entrypoints calling eachother on `linux` since this doesn't
work with a non-aliased target. This is only partial support because
full support requires a malloc / free implementation for the exit
callbacks array.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D149363
|
|
|
|
|
|
|
|
|
| |
This patch simply enables building the integer `abs` functions for the
GPU.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D149317
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch enables us to use the existing `libc` support for string
conversion functions on the GPU. This required setting the `fenv_t` and
long double configuration. As far as I am aware, long doubles are
converted to doubles on the GPU and the floating point environment is
just an `uint32_t`.
This code is still untested as we are still working out how to run the
unit tests on the GPU.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D149306
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The `atexit` function controls registering functions to call at the end
of the program. This is difficult to do in general on the GPU because of
the lack of a real mutex implementation. We primarily provide this for
testing where we can explicitly restrict how the `atexit` registration
functions are called. So we simply create a passthrough Mutex to get
past the usage of it as per @sivachandra's suggestion.
Depends on D149225
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D149226
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The previous patch in D149216 allows us to use the internal `<stdlib.h>`
include for the GPU build. However, we currently don't provide the
memory functions so the header wasn't resolving them. This patch adds
these as entrypoints. They don't cause any entrypoints to be emitted
because they are not implemented, but they provide it in the header so
that we can rely on the test's implementation of them.
Depends on D149216
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D149217
|
|
|
|
|
|
|
|
| |
Summary:
The previous GPU `libc` patch added support for `atoi`. However, it
didn't also enable generating the errno header. This caused including it
to use the system's header which invariably will cause compiler
problems.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The 'errno' value is most likely not useful on the GPU and it prevents
us from providing certain functions on the GPU that depend on it, like
`atoi`. This patch makes the necessary changes to support `errno` by
simple replacing it with a consumer class.
Supporting `errno` on the GPU is possible in some aspects. The first
approach would be to use a buffer of shared memory that has enough space
for all threads. Another option would be to change code generation to
support `thread_local` using `address_space(5)` memory allocated at
kernel launch. The former could look like the following, which could be
implemented in a later patch:
```
template <typename T>
using SharedBuffer = T[gpu::MAX_THREADS] [[clang::address_space(3)]];
template <typename T> struct ErrnoSetter {
constexpr ErrnoSetter(SharedBuffer<T> &storage) : storage(storage) {}
SharedBuffer<T> &storage;
void operator=(const T &val) { storage[gpu::get_thread_id()] = val; }
};
static SharedBuffer<int> thread_local_buffer [[clang::loader_uninitialized]];
ErrnoSetter<int> __llvmlibc_internal_errno(thread_local_buffer);
```
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D149107
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Includes macros:
linux/SCHED_OTHER // posix req
linux/SCHED_FIFO // posix req
linux/SCHED_RR // posix req
linux/SCHED_BATCH
linux/SCHED_ISO
linux/SCHED_IDLE
linux/SCHED_DEADLINE
Includes types:
struct sched_param { int sched_priority; }
Includes functions:
sched_setparam
sched_getparam
sched_setscheduler
sched_getscheduler
sched_get_priority_max
sched_get_priority_min
sched_rr_get_interval
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D148069
|
|
|
|
|
|
| |
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D148781
|
|
|
|
|
|
|
| |
Partial revert of commit ee917996708c936dd7f275de06b7895f5e3c11ec.
I can't reproduce the error locally, so let's revert it to keep the bots
happy.
|
|
|
|
|
|
|
|
| |
This patch updates the list of supported libs according to the latest changes to x86_64
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D147961
|
|
|
|
|
|
|
|
| |
added getchar and getchar_unlocked which are just wrappers getc and getc_unlocked respectively.
Reviewed By: sivachandra, lntue, michaelrj
Differential Revision: https://reviews.llvm.org/D147919
|
|
|
|
|
|
|
|
|
|
|
| |
Implements: https://linux.die.net/man/2/sched_yield
Possibly we don't need the return value check / errno as according to
both the manpage (and current linux source) `sched_yield` cannot fail.
Reviewed By: sivachandra, michaelrj
Differential Revision: https://reviews.llvm.org/D147985
|
|
|
|
|
|
|
|
|
|
| |
Introduce the `memmem` libc string function.
`memmem_implementation` performs shared logic for `strstr`,
`strcasestr`, and `memmem`; essentially reconfiguring what was the
`strstr_implementation` to support length parameters.
Differential Revision: https://reviews.llvm.org/D147822
|
|
|
|
|
|
|
|
| |
Per https://reviews.llvm.org/D147970#4256889, swab.cpp is moved out of
the /linux subdirectory and cmake specifications are amended to reflect
that swab is not OS-specific.
Differential Revision: https://reviews.llvm.org/D147988
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D147464
|
|
|
|
| |
This reverts commit a0a141fcbe1dfd35032fa5c052e6906180a37fb1.
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D147464
|
|
|
|
|
|
| |
Swab implementation is added to libc/src/unistd.
Differential Revision: https://reviews.llvm.org/D147970
|
|
|
|
|
|
|
|
|
|
|
|
| |
Introduce `strxfrm` and unit tests. The current implementation is
introduced without locale support.
The simplified function performs a `memcpy` if the `n` value is large
enough to store the source len + '\0', otherwise `dest` is unmodified.
Ticket: https://fxbug.dev/124217
Differential Revision: https://reviews.llvm.org/D147478
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D147503
|
|
|
|
|
|
|
|
| |
Introduce strchrnul implementation and unit tests.
Submitting on behalf of Caslyn@
Differential Revision: https://reviews.llvm.org/D147346
|
|
|
|
|
|
| |
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D146203
|
|
|
|
|
|
|
|
|
| |
The stdio test failures were due to headers potentially not being built
in the correct order. This should set up the dependencies correctly.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D146551
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch implements setjmp and longjmp in riscv using inline asm. The
following changes were required:
* Omit frame pointer: otherwise gcc won't allow us to use s0
* Use __attribute__((naked)): otherwise both gcc and clang will generate
function prologue and epilogue in both functions. This doesn't happen
in x86_64, so we guard it to only riscv
Furthermore, using __attribute__((naked)) causes two problems: we
can't use `return 0` (both gcc and clang) and the function arguments in
the function body (clang only), so we had to use a0 and a1 directly.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D145584
|
|
|
|
|
|
|
|
|
|
| |
The printf and fprintf implementations use our internal implementation
to improve performance when it's available, but this patch enables using
the public FILE API for overlay mode.
Reviewed By: sivachandra, lntue
Differential Revision: https://reviews.llvm.org/D146001
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D146484
|
|
|
|
|
|
|
|
|
|
| |
This patch adds the wchar header, as well as the functions to convert to
and from wide chars. The header also sets up the definitions for wint
and wchar.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D145995
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch enables the remaining calls from unistd.
The test cases had to be updated to:
1. Use SYS_symlinkat if SYS_symlink is not available
2. Use SYS_readlinkat if SYS_readlink is not available
3. Use SYS_unlinkat if SYS_unlink is not available
4. Use SYS_openat if SYS_open is not available
We also abort compilation if neither of the syscalls mentioned above are
available.
Differential Revision: https://reviews.llvm.org/D146161
|
|
|
|
|
|
|
|
|
|
| |
In this patch we add support for the spawn lib in riscv.
Only small changes were required, the biggest one was to use of dup3
instead of dup2, if the latter is not available. This follows our
implementation of dup2.
Differential Revision: https://reviews.llvm.org/D146145
|
|
|
|
|
|
|
| |
This patch removes some duplicated libs added to entrypoints.txt, adds
new libs supported to entrypoints.txt and updates header.txt
Differential Revision: https://reviews.llvm.org/D146065
|
|
|
|
|
| |
The list of headers has also been updated. Some duplicated entrypoints
have been removed.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Also, added riscv64 startup code for static linking which is used
by the integration tests. Functions from the C standard threads
library have been enabled.
Reviewed By: mikhail.ramalho
Differential Revision: https://reviews.llvm.org/D145670
|
| |
|
|
|
|
| |
Its test is currently failing of real riscv64 hardware.
|
|
|
|
|
|
| |
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D145444
|
|
|
|
|
|
| |
Reviewed By: mikhail.ramalho
Differential Revision: https://reviews.llvm.org/D145560
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch includes:
1. Better error message when cmake finds incompatible triple
2. Added missing header dependencies libc/include/CMakeLists.txt as per
app.td
3. Removed unused $LLVM_LIBC_INCLUDE_DIRS cmake variable
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D145496
|
|
|
|
|
|
|
|
| |
All syscall wrapper functions which have unit tests have been enabled.
Reviewed By: kito-cheng
Differential Revision: https://reviews.llvm.org/D145452
|
|
|
|
|
|
|
|
| |
Also, an "arm" subfolder for baremetal config has been added.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D145476
|
|
|
|
|
|
| |
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D145475
|
| |
|
|
|
|
|
|
|
|
|
| |
Memory functions get the basic implementation. They can be tuned
as a follow up.
Reviewed By: michaelrj, lntue
Differential Revision: https://reviews.llvm.org/D145433
|
|
|
|
|
|
| |
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D145347
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The entrypoint has been added to the various entrypoint lists. The libc
code style doc has been updated with information on how errno should be
set from the libc runtime code.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D145179
|