]> xenbits.xensource.com Git - unikraft/libs/newlib.git/commitdiff
Fix newlib ARM64 support
authorSantiago Pagani <santiago.pagani@neclab.eu>
Thu, 19 Dec 2019 11:20:26 +0000 (12:20 +0100)
committerFelipe Huici <felipe.huici@neclab.eu>
Wed, 15 Jan 2020 10:40:50 +0000 (11:40 +0100)
At the moment newlib compiles for ARM64 but fails at runtime.  This
patch changes some generic newlib files for the machine specific
newlib files for ARM64.

Signed-off-by: Santiago Pagani <santiagopagani@gmail.com>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
Makefile.uk

index a963e821e67a56a5cd837c5465943bf37ee7adf8..7ccc7715d549141af387654efbcf3c7d79182017 100644 (file)
@@ -106,10 +106,12 @@ LIBNEWLIB_SUPPRESS_FLAGS-$(call gcc_version_ge,6,0) += -Wno-misleading-indentati
 LIBNEWLIB_SUPPRESS_FLAGS-$(call gcc_version_ge,6,0) += -Wno-shift-negative-value
 LIBNEWLIB_SUPPRESS_FLAGS-$(call gcc_version_ge,7,0) += -Wno-implicit-fallthrough
 
-LIBNEWLIBC_CFLAGS-y   += $(LIBNEWLIB_SUPPRESS_FLAGS-y)
-LIBNEWLIBM_CFLAGS-y   += $(LIBNEWLIB_SUPPRESS_FLAGS-y)
-LIBNEWLIBC_CXXFLAGS-y += $(LIBNEWLIB_SUPPRESS_FLAGS-y)
-LIBNEWLIBM_CXXFLAGS-y += $(LIBNEWLIB_SUPPRESS_FLAGS-y)
+LIBNEWLIB_NO_BUILTINS          += -D__NO_SYSCALLS__ -fno-builtin
+
+LIBNEWLIBC_CFLAGS-y   += $(LIBNEWLIB_SUPPRESS_FLAGS-y) $(LIBNEWLIB_NO_BUILTINS)
+LIBNEWLIBM_CFLAGS-y   += $(LIBNEWLIB_SUPPRESS_FLAGS-y) $(LIBNEWLIB_NO_BUILTINS)
+LIBNEWLIBC_CXXFLAGS-y += $(LIBNEWLIB_SUPPRESS_FLAGS-y) $(LIBNEWLIB_NO_BUILTINS)
+LIBNEWLIBM_CXXFLAGS-y += $(LIBNEWLIB_SUPPRESS_FLAGS-y) $(LIBNEWLIB_NO_BUILTINS)
 
 LIBNEWLIBGLUE_SUPPRESS_FLAGS-y += -Wno-unused-parameter
 LIBNEWLIBGLUE_CFLAGS-y   += $(LIBNEWLIBGLUE_SUPPRESS_FLAGS-y)
@@ -732,10 +734,13 @@ LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/memmem.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/rindex.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strcasecmp.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strcat.c
-LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strchr.c
-LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strcmp.c
+LIBNEWLIBC_SRCS-$(CONFIG_ARCH_X86_64) += $(LIBNEWLIB_LIBC)/string/strchr.c
+LIBNEWLIBC_SRCS-$(CONFIG_ARCH_ARM_64) += $(LIBNEWLIB_LIBC)/machine/aarch64/strchr.S
+LIBNEWLIBC_SRCS-$(CONFIG_ARCH_X86_64) += $(LIBNEWLIB_LIBC)/string/strcmp.c
+LIBNEWLIBC_SRCS-$(CONFIG_ARCH_ARM_64) += $(LIBNEWLIB_LIBC)/machine/aarch64/strcmp.S
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strcoll.c
-LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strcpy.c
+LIBNEWLIBC_SRCS-$(CONFIG_ARCH_X86_64) += $(LIBNEWLIB_LIBC)/string/strcpy.c
+LIBNEWLIBC_SRCS-$(CONFIG_ARCH_ARM_64) += $(LIBNEWLIB_LIBC)/machine/aarch64/strcpy.S
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strcspn.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strdup.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strdup_r.c
@@ -743,17 +748,21 @@ LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strerror.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strerror_r.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strlcat.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strlcpy.c
-LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strlen.c
+LIBNEWLIBC_SRCS-$(CONFIG_ARCH_X86_64) += $(LIBNEWLIB_LIBC)/string/strlen.c
+LIBNEWLIBC_SRCS-$(CONFIG_ARCH_ARM_64) += $(LIBNEWLIB_LIBC)/machine/aarch64/strlen.S
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strlwr.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strncasecmp.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strncasecmp_l.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strncat.c
-LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strncmp.c
+LIBNEWLIBC_SRCS-$(CONFIG_ARCH_X86_64) += $(LIBNEWLIB_LIBC)/string/strncmp.c
+LIBNEWLIBC_SRCS-$(CONFIG_ARCH_ARM_64) += $(LIBNEWLIB_LIBC)/machine/aarch64/strncmp.S
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strncpy.c
-LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strnlen.c
+LIBNEWLIBC_SRCS-$(CONFIG_ARCH_X86_64) += $(LIBNEWLIB_LIBC)/string/strnlen.c
+LIBNEWLIBC_SRCS-$(CONFIG_ARCH_ARM_64) += $(LIBNEWLIB_LIBC)/machine/aarch64/strnlen.S
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strnstr.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strpbrk.c
-LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strrchr.c
+LIBNEWLIBC_SRCS-$(CONFIG_ARCH_X86_64) += $(LIBNEWLIB_LIBC)/string/strrchr.c
+LIBNEWLIBC_SRCS-$(CONFIG_ARCH_ARM_64) += $(LIBNEWLIB_LIBC)/machine/aarch64/strrchr.S
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strsep.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strsignal.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strspn.c
@@ -796,11 +805,13 @@ LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/xpg_strerror_r.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/bcmp.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/memccpy.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/mempcpy.c
-LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/stpcpy.c
+LIBNEWLIBC_SRCS-$(CONFIG_ARCH_X86_64) += $(LIBNEWLIB_LIBC)/string/stpcpy.c
+LIBNEWLIBC_SRCS-$(CONFIG_ARCH_ARM_64) += $(LIBNEWLIB_LIBC)/machine/aarch64/stpcpy.S
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/stpncpy.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strndup.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strcasestr.c
-LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strchrnul.c
+LIBNEWLIBC_SRCS-$(CONFIG_ARCH_X86_64) += $(LIBNEWLIB_LIBC)/string/strchrnul.c
+LIBNEWLIBC_SRCS-$(CONFIG_ARCH_ARM_64) += $(LIBNEWLIB_LIBC)/machine/aarch64/strchrnul.S
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/strndup_r.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/wcpcpy.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/string/wcpncpy.c