Makefile.uk: fix compilation warnings for gcc >= 9.0
In GCC 9.0, a new type of warning was introduced
(-Waddress-of-packed-member), which shows up multiple times in Ruby
code. This was disabled for GCC versions >= 9.0.
Signed-off-by: Stefan Teodorescu <stefanl.teodorescu@gmail.com> Reviewed-by: Costin Lupu <costin.lupu@cs.pub.ro>
Costin Lupu [Mon, 16 Dec 2019 13:47:52 +0000 (15:47 +0200)]
Provide main() function if configured to do so
We provide a configurable main() function for running Ruby out-of-the-box and
also for showing an example of such a function to be used by custom
applications. It also sets the necessary Ruby environment variables.
Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro> Reviewed-by: Stefan Teodorescu <stefanl.teodorescu@gmail.com>
Costin Lupu [Mon, 16 Dec 2019 13:47:51 +0000 (15:47 +0200)]
Makefile.uk: Add rule for creating root filesystem
The Ruby interpreter needs a filesystem where to keep its libraries. This patch
creates a root filesystem and installs the Ruby libraries in `/lib/ruby/2.6.0/`
directory. For creating the filesystem the following command has to be run:
$ make ruby-rootfs path=<directory>
Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro> Reviewed-by: Stefan Teodorescu <stefanl.teodorescu@gmail.com>
Costin Lupu [Mon, 16 Dec 2019 13:47:50 +0000 (15:47 +0200)]
tests: Build tests
The Ruby unit testing depends on both extensions and encodings. We currently
add support for running only the time and file tests. Enabling the rest of the
tests is subject of further work.
Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro> Reviewed-by: Stefan Teodorescu <stefanl.teodorescu@gmail.com>
Costin Lupu [Mon, 16 Dec 2019 13:47:49 +0000 (15:47 +0200)]
encodings: Build encodings
All encodings are included in a new library, libruby_enc. Given that the
extensions files are generated at build time by the origin build system, we
also have to run `./configure` and `make` for the original build before
building them for Unikraft. This is done once for both extensions and
encodings.
Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro> Reviewed-by: Stefan Teodorescu <stefanl.teodorescu@gmail.com>
Costin Lupu [Mon, 16 Dec 2019 13:47:48 +0000 (15:47 +0200)]
extensions: Build extensions
All extensions are included in a new library, libruby_ext. Each extension has
its own configuration option and a <extconf.h> header. Given that the
extensions files are generated at build time by the origin build system, we
also have to run `./configure` and `make` for the original build before
building them for Unikraft.
Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro> Reviewed-by: Stefan Teodorescu <stefanl.teodorescu@gmail.com>
Costin Lupu [Thu, 12 Dec 2019 17:42:33 +0000 (19:42 +0200)]
extensions/socket: Disable unavailable features
This is an example of disabling features in the <extconf.h> header of an
extension. Here we disable the flags for `accept4()` and `ifaddrs` structure
and its associated functions.
Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro> Reviewed-by: Stefan Teodorescu <stefanl.teodorescu@gmail.com>
Costin Lupu [Thu, 12 Dec 2019 17:42:32 +0000 (19:42 +0200)]
extensions: Add generated files
Each extensions has its own <extconf.h> header, which is generated based on the
build system configuration. We choose to add this header for `socket` extension
into the glue code because we need to change some of its configurations in the
next patch. All the extensions are registered in the `extinit.c` file.
Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro> Reviewed-by: Stefan Teodorescu <stefanl.teodorescu@gmail.com>
Andrei Gogonea [Fri, 6 Dec 2019 18:14:56 +0000 (20:14 +0200)]
patches: Limit all memory allocations to maximum 4K bytes
We currently do not support allocations greater than 4K and that is because we
do not have a proper page tables implementation yet and a complete mmap()
implementation. Therefore this patch should be removed when we will have these
in Unikraft.
Signed-off-by: Andrei Gogonea <andrei.gogonea09@gmail.com> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro> Reviewed-by: Stefan Teodorescu <stefanl.teodorescu@gmail.com>
Costin Lupu [Sat, 7 Dec 2019 08:29:37 +0000 (10:29 +0200)]
core: Add thread related definitions
With pthread-embedded library, special care has to be taken when dealing with
conversions from `pthread_t` to scalar values. Therefore we have to define our
own conversion functions.
We also copy `ruby_fill_thread_id_string()` function from origin to glue in
order to avoid patching the origin code. The function is copied here because of
a bug in the Ruby implementation, which only defines it if THREAD_DEBUG is
enabled. When this bug is fixed in Ruby, this is no long necessary.
Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro> Reviewed-by: Stefan Teodorescu <stefanl.teodorescu@gmail.com>
Andrei Gogonea [Sat, 7 Dec 2019 06:25:01 +0000 (08:25 +0200)]
core: Build core functionality
With these changes we only build the Ruby interpreter. In the following patches
we will add Ruby extensions and encodings as well. The original Ruby build
provides what is called 'miniruby' - the minimalistic variant of the Ruby
intepretor and which doesn't have any extensions. We used the same idea to
provide a minimalistic version for Unikraft when the mini configuration is
checked via menuconfig.
Some of the sources need to be generated by the origin build system, that's why
we are running both `./configure` and `make` on the origin code before building
for Unikraft.
Signed-off-by: Andrei Gogonea <andrei.gogonea09@gmail.com> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro> Reviewed-by: Stefan Teodorescu <stefanl.teodorescu@gmail.com>