Commit Graph

9 Commits

Author SHA1 Message Date
Alex Brachet 2c73c26666 [libc] Add Convenience syscall Template Function
Summary: This patch adds a convenience template function so we don't need to cast all types to `long` manually when calling `__llvm_libc::syscall`.

Reviewers: sivachandra, MaskRay, gchatelet

Reviewed By: sivachandra

Subscribers: libc-commits, tschuett

Differential Revision: https://reviews.llvm.org/D74530
2020-02-13 14:39:16 -05:00
Guillaume Chatelet 961aeb7a15
Fix unneeded semi column 2020-02-13 11:18:28 +01:00
Siva Chandra Reddy 2a6ef2aecf [libc] Use cpp::Array instead of cpp::ArrayRef in memory/utils_test.
Building with address-sanitizer shows that using ArrayRef ends up
accessing a temporary outside its scope.
2020-01-31 11:45:09 -08:00
Guillaume Chatelet 85314e9b7a [libc] Add utils for memory functions
Summary: This patch adds a few low level functions needed to build libc memory functions.

Reviewers: sivachandra, jfb

Subscribers: mgorny, MaskRay, tschuett, libc-commits, ckennelly

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D73472
2020-01-31 10:15:02 +01:00
Siva Chandra Reddy ec62bf2fd3 [libc] Move the implementation of mmap and munmap into a linux specific area.
This allows us to get rid of the PAGE_SIZE macro and use EXEC_PAGESIZE
from linux/param.h.

Few other points about this change:
1. The linux syscall functions have been moved into a linux specific area
instead of src/unistd/syscall.h. The Linux syscall function from unistd.h
is a public vararg function. What we have currently are linux speciif internal
overloaded C++ functions. So, moving them to a Linux only area is more
meaningful.
2. The implementations of mmap and munmap are now in a 'linux' directory
within src/sys/mman. The idea here is that platform specific
implementations will live in a platform specific subdirectories like these.
Infrastructure common to a platform will live in the platform's config
directory. For example, the linux syscall implementations live in
config/linux.

Reviewers: abrachet

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D73302
2020-01-24 15:42:28 -08:00
Siva Chandra Reddy c7453fad06 [libc] Replace the use of gtest with a new light weight unittest framework.
Header files included wrongly using <...> are now included using the
internal path names as the new unittest framework allows us to do so.

Reviewers: phosek, abrachet

Differential Revision: https://reviews.llvm.org/D72743
2020-01-17 16:24:53 -08:00
Siva Chandra Reddy 880734aebb [libc] Add a convenience CMake rule to add testsuites.
Summary:
This rule helps avoid repeated setting of check-libc's dependency on the
various testsuites.

Reviewers: abrachet

Subscribers: mgorny, MaskRay, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D72353
2020-01-07 23:04:52 -08:00
Siva Chandra Reddy 188f72ab20 [libc] Move implementations of strcat and strcpy to the string directory.
Summary:
Now that tests live in separate top-level directory, keeping the
implementations of individual functions in a directory of their own is
not meaningful. Hence, this change moves them into the higher level
string directory.

NFC intended.

Reviewers: MaskRay

Subscribers: mgorny, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D72295
2020-01-06 22:20:42 -08:00
Siva Chandra Reddy 5b24c08817 [libc] Move all tests to a top level `test` directory.
A toplevel target, `check-libc` has also been added.

Reviewers: abrachet, phosek

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D72177
2020-01-06 10:14:43 -08:00