[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[UNIKRAFT PATCH 2/3] libdruntime: Add Makefile.uk



From: Baciu Marius-Cristian <marius.baciu@xxxxxxxxxxxxxxx>

---
 Makefile.uk | 123 ++++++++++++++++++++--------------------------------
 1 file changed, 48 insertions(+), 75 deletions(-)

diff --git a/Makefile.uk b/Makefile.uk
index ed4ee5a..141cb74 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -1,6 +1,6 @@
 #  SPDX-License-Identifier: BSD-3-Clause
 #
-#  druntime Makefile.uk
+#  D Runtime Library Makefile.uk
 #
 #  Authors: Marius-Cristian Baciu <marius.baciu@xxxxxxxxxxxxxxx>
 #
@@ -50,59 +50,63 @@ 
LIBDRUNTIME_URL=https://ftp.gnu.org/gnu/gcc/gcc-$(LIBGCC_VERSION)/gcc-$(LIBGCC_V
 LIBDRUNTIME_PATCHDIR=$(LIBDRUNTIME_BASE)/patches
 LIBDRUNTIME_SUBDIR=gcc-$(LIBDRUNTIME_VERSION)
 
-# For now, we will be working with manually-copied sources, so they can be more
-# easily managed
-#$(eval $(call fetch,libdruntime,$(LIBDRUNTIME_URL)))
+$(eval $(call fetch,libdruntime,$(LIBDRUNTIME_URL)))
 
-#$(eval $(call 
patch,libdruntime,$(LIBDRUNTIME_PATCHDIR),$(LIBDRUNTIME_SUBDIR)))
+$(eval $(call patch,libdruntime,$(LIBDRUNTIME_PATCHDIR),$(LIBDRUNTIME_SUBDIR)))
 
 
################################################################################
 # Helpers
 
################################################################################
-# This variable will be automatically set during the fetch routine call. For 
now,
-# hard-coding it should work
-LIBDRUNTIME_ORIGIN = 
/home/me/Faculty_work/Diploma/unikraft_fork/apps/app-helloworld/build/libdruntime/origin
 LIBDRUNTIME_EXTRACTED = $(LIBDRUNTIME_ORIGIN)/druntime
+
 
################################################################################
 # Library includes
 
################################################################################
-LIBDRUNTIME_COMMON_INCLUDES-y = 
-I$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime #\
-# The following are includes used in the Go port. It is worth analyzing 
whether their
-# motivation also applies here
-#      -I$(LIBDRUNTIME_EXTRACTED)/libffi/include \
-#      -I$(LIBDRUNTIME_EXTRACTED)/libgcc \
-#      -I$(LIBDRUNTIME_EXTRACTED)/gcc/include \
-#      -I$(LIBDRUNTIME_EXTRACTED)/gcc/
-#LIBDRUNTIME_COMMON_INCLUDES-$(CONFIG_ARCH_X86_64) += 
-I$(LIBDRUNTIME_EXTRACTED)/libffi/src/x86
-#LIBDRUNTIME_COMMON_INCLUDES-$(CONFIG_ARCH_X86_64) += 
-I$(LIBDRUNTIME_EXTRACTED)/gcc/config/i386
+LIBDRUNTIME_COMMON_INCLUDES-y = 
-I$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime \
+                                       
-I$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/posix/ \
+                                       -I$(LIBDRUNTIME_BASE)
+
 LIBDRUNTIME_ASINCLUDES-y = $(LIBDRUNTIME_COMMON_INCLUDES-y)
 LIBDRUNTIME_CINCLUDES-y  = $(LIBDRUNTIME_COMMON_INCLUDES-y)
 
-LIBDRUNTIME_INCLUDES-y += $(LIBDRUNTIME_COMMON_INCLUDES-y)
+################################################################################
+# Global flags
+GDCINCLUDES-y += $(LIBDRUNTIME_COMMON_INCLUDES-y)
 
-LIBDRUNTIME_GDCINCLUDES        += $(LIBDRUNTIME_INCLUDES-y)
+DMDINCLUDES-y += -I$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/
 
+CFLAGS += -DDRUNTIME
 
-################################################################################
-# Global flags
 
################################################################################
 # Suppress flags
-LIBDRUNTIME_SUPPRESS_FLAGS += -Wno-cast-qual -Wno-unused-value 
-Wno-unused-parameter
+LIBDRUNTIME_SUPPRESS_FLAGS_C += -Wno-cast-qual -Wno-unused-value 
-Wno-unused-parameter
+LIBDRUNTIME_SUPPRESS_FLAGS_GDC += -Wno-unused-value -Wno-unused-parameter
 
-LIBDRUNTIME_CFLAGS-y   += $(LIBDRUNTIME_SUPPRESS_FLAGS)
+LIBDRUNTIME_CFLAGS-y   += $(LIBDRUNTIME_SUPPRESS_FLAGS_C)
 LIBDRUNTIME_CFLAGS-y   += -fexceptions -fnon-call-exceptions \
        -fplan9-extensions -fno-split-stack -Wall -Wextra -Wwrite-strings \
        -Wcast-qual -Wno-unused-function -minline-all-stringops \
        -Wno-implicit-function-declaration -D_GNU_SOURCE -D_LARGEFILE_SOURCE \
        -D_FILE_OFFSET_BITS=64
 
-# Here you may add any version symbols, as needed
-LIBDRUNTIME_GDCFLAGS += #-fversion=CRuntime_Glibc
-LIBDRUNTIME_GDCFLAGS-y +=
+LIBDRUNTIME_GDCFLAGS += $(LIBDRUNTIME_SUPPRESS_FLAGS_GDC)
+LIBDRUNTIME_GDCFLAGS += -fexceptions -fnon-call-exceptions \
+       -fno-split-stack -Wall -Wextra -Wno-unused-function 
-minline-all-stringops
+LIBDRUNTIME_GDCFLAGS += -fversion=UNIKRAFT
 
 
################################################################################
 # druntime code
 
################################################################################
+ifeq ($(D_COMPILER),gdc)
+
+LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/config/x86/switchcontext.S
+LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/config/common/threadasm.S
+
+LIBDRUNTIME_SRCS-y += $(LIBDRUNTIME_BASE)/gluecode.c
+LIBDRUNTIME_SRCS-y += $(LIBDRUNTIME_BASE)/htons_.c
+
+LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/gcc/config.d|gcc
+LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/gcc/libbacktrace.d|gcc
 
 LIBDRUNTIME_SRCS-y += $(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/object.d
 LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/math.d
@@ -126,7 +130,7 @@ LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/intern
 LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/internal/traits.d
 LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/internal/hash.d|internal
 LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/internal/convert.d
-#LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/stdc/math.d|stdc
+LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/stdc/math.d|stdc
 LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/stdc/tgmath.d
 LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/stdc/errno.d|stdc
 LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/stdc/wchar_.d
@@ -207,52 +211,6 @@ LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/po
 LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/posix/grp.d
 LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/posix/termios.d|posix
 LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/posix/config.d|posix
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/fcntl.d|linux
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/epoll.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/errno.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/sched.d|linux
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/tipc.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/elf.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/timerfd.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/time.d|linux
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/netinet/in_.d|linux
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/netinet/tcp.d|linux
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/unistd.d|linux
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/stdio.d|linux
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/sys/xattr.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/sys/eventfd.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/sys/prctl.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/sys/file.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/sys/time.d|linux_sys
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/sys/netinet/tcp.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/sys/mman.d|linux
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/sys/signalfd.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/sys/inotify.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/sys/socket.d|sys
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/sys/sysinfo.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/sys/auxv.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/ifaddrs.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/dlfcn.d|linux
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/termios.d|linux
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/config.d|linux
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/execinfo.d|linux
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/linux/link.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/bionic/fcntl.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/bionic/unistd.d|bionic
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/darwin/mach/semaphore.d|mach
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/darwin/mach/kern_return.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/darwin/mach/getsect.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/darwin/mach/loader.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/darwin/mach/dyld.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/darwin/mach/port.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/darwin/mach/thread_act.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/darwin/netinet/in_.d|darwin
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/darwin/sys/event.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/darwin/sys/cdefs.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/darwin/sys/mman.d|darwin
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/darwin/pthread.d|darwin
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/darwin/dlfcn.d|darwin
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/core/sys/darwin/execinfo.d|darwin
 LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/gcc/attribute.d|gcc
 LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/gcc/unwind/package.d
 LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/gcc/unwind/arm_common.d
@@ -265,7 +223,6 @@ LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/gcc/section
 LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/gcc/builtins.d
 LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/gcc/backtrace.d
 LIBDRUNTIME_SRCS-y += $(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/gcc/deh.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/gcc/drtstuff.c
 LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/gcc/emutls.d
 LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/gcc/gthread.d
 LIBDRUNTIME_SRCS-y += $(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/gc/os.d
@@ -343,4 +300,20 @@ LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/rt/config.d
 LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/rt/arraycat.d
 LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/rt/aApply.d
 LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/rt/monitor_.d
-LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/rt/dylib_fixes.c
+#LIBDRUNTIME_SRCS-y += 
$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/rt/dylib_fixes.c
+LIBDRUNTIME_SRCS-y += $(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/rt/qsort.d
+
+endif
+
+# Instantiate the config.d.in and libbacktrace.d.in templates
+$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/gcc/config.d: 
$(LIBDRUNTIME_EXTRACTED)/libphobos/config.status
+       $(call build_cmd,GEN,libdruntime,$(notdir $@),cd 
$(LIBDRUNTIME_EXTRACTED)/libphobos && ./config.status -q 
libdruntime/gcc/config.d)
+
+$(LIBDRUNTIME_EXTRACTED)/libphobos/libdruntime/gcc/libbacktrace.d: 
$(LIBDRUNTIME_EXTRACTED)/libphobos/config.status
+       $(call build_cmd,GEN,libdruntime,$(notdir $@),cd 
$(LIBDRUNTIME_EXTRACTED)/libphobos && ./config.status -q 
libdruntime/gcc/libbacktrace.d)
+
+
+# Generate config.status script
+$(LIBDRUNTIME_EXTRACTED)/libphobos/config.status: 
$(LIBDRUNTIME_EXTRACTED)/libphobos/configure
+       $(call build_cmd,GEN,libdruntime,$(notdir $@),cd 
$(LIBDRUNTIME_EXTRACTED)/libphobos && ./configure -q --no-create --no-recursion)
+
-- 
2.17.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.