diff options
Diffstat (limited to 'meta-microblaze/recipes-core')
23 files changed, 3568 insertions, 0 deletions
diff --git a/meta-microblaze/recipes-core/glibc/glibc_%.bbappend b/meta-microblaze/recipes-core/glibc/glibc_%.bbappend new file mode 100644 index 00000000..d42bcca5 --- /dev/null +++ b/meta-microblaze/recipes-core/glibc/glibc_%.bbappend @@ -0,0 +1 @@ +INSANE_SKIP:${PN}:append:microblaze = " textrel" diff --git a/meta-microblaze/recipes-core/newlib/files/0001-Patch-microblaze-Add-config-microblaze.mt-for-target.patch b/meta-microblaze/recipes-core/newlib/files/0001-Patch-microblaze-Add-config-microblaze.mt-for-target.patch new file mode 100644 index 00000000..31076208 --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/files/0001-Patch-microblaze-Add-config-microblaze.mt-for-target.patch @@ -0,0 +1,88 @@ +From d3b09cb319fb1af1bcb83aa50d559ccccdeac639 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Mon, 23 Jan 2017 15:27:25 +0530 +Subject: [PATCH 01/11] [Patch, microblaze]: Add config/microblaze.mt for + target_makefile_frag Mirror MIPS method of creating copy of default.mt which + drops the compilation of generic sbrk.c to instead continue using the + microblaze provided version. + +[Libgloss] + +Changelog + +2013-07-15 David Holsgrove <david.holsgrove@xilinx.com> + + * config/microblaze.mt: New file. + * microblaze/configure.in: Switch default.mt to microblaze.mt. + * microblaze/configure: Likewise. + +Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> + +Upstream-Status: Pending + +--- + libgloss/config/microblaze.mt | 30 ++++++++++++++++++++++++++++++ + libgloss/microblaze/configure | 2 +- + libgloss/microblaze/configure.ac | 2 +- + 3 files changed, 32 insertions(+), 2 deletions(-) + create mode 100644 libgloss/config/microblaze.mt + +Index: git/libgloss/config/microblaze.mt +=================================================================== +--- /dev/null ++++ git/libgloss/config/microblaze.mt +@@ -0,0 +1,30 @@ ++# ++# Match default.mt to compile generic objects but continue building ++# MicroBlaze specific sbrk.c ++# ++close.o: ${srcdir}/../close.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++fstat.o: ${srcdir}/../fstat.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++getpid.o: ${srcdir}/../getpid.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++isatty.o: ${srcdir}/../isatty.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++kill.o: ${srcdir}/../kill.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++lseek.o: ${srcdir}/../lseek.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++open.o: ${srcdir}/../open.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++print.o: ${srcdir}/../print.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++putnum.o: ${srcdir}/../putnum.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++read.o: ${srcdir}/../read.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++stat.o: ${srcdir}/../stat.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++unlink.o: ${srcdir}/../unlink.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++write.o: ${srcdir}/../write.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +Index: git/libgloss/configure +=================================================================== +--- git.orig/libgloss/configure ++++ git/libgloss/configure +@@ -2909,6 +2909,7 @@ case "${target}" in + ac_config_files="$ac_config_files microblaze/Makefile" + + subdirs="$subdirs microblaze" ++ target_makefile_frag=${srcdir}/config/microblaze.mt + ;; + mt-*-*) + ac_config_files="$ac_config_files mt/Makefile" +Index: git/libgloss/configure.ac +=================================================================== +--- git.orig/libgloss/configure.ac ++++ git/libgloss/configure.ac +@@ -172,6 +172,7 @@ case "${target}" in + microblaze*-*-*) + AC_CONFIG_FILES([microblaze/Makefile]) + subdirs="$subdirs microblaze" ++ target_makefile_frag=${srcdir}/config/microblaze.mt + ;; + mt-*-*) + AC_CONFIG_FILES([mt/Makefile]) diff --git a/meta-microblaze/recipes-core/newlib/files/0002-Patch-microblaze-Modified-_exceptional_handler.patch b/meta-microblaze/recipes-core/newlib/files/0002-Patch-microblaze-Modified-_exceptional_handler.patch new file mode 100644 index 00000000..3c940329 --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/files/0002-Patch-microblaze-Modified-_exceptional_handler.patch @@ -0,0 +1,27 @@ +From c96521b00af5259e1404c921cc6a22fbb16c1ace Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Mon, 23 Jan 2017 15:30:02 +0530 +Subject: [PATCH 02/11] [Patch, microblaze]: Modified _exceptional_handler + Modified the _exceptional_handler to support the changes made in GCC related + to Superviosry call + +Signed-off-by:Nagaraju Mekala<nmekala@xilix.com> + +Upstream-Status: Pending +--- + libgloss/microblaze/_exception_handler.S | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/libgloss/microblaze/_exception_handler.S b/libgloss/microblaze/_exception_handler.S +index 59385ad9b..7a91a781e 100644 +--- a/libgloss/microblaze/_exception_handler.S ++++ b/libgloss/microblaze/_exception_handler.S +@@ -36,5 +36,4 @@ + .type _exception_handler, @function + + _exception_handler: +- addi r11,r11,8 + bra r11 +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-core/newlib/files/0003-LOCAL-Add-missing-declarations-for-xil_printf-to-std.patch b/meta-microblaze/recipes-core/newlib/files/0003-LOCAL-Add-missing-declarations-for-xil_printf-to-std.patch new file mode 100644 index 00000000..96b83269 --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/files/0003-LOCAL-Add-missing-declarations-for-xil_printf-to-std.patch @@ -0,0 +1,33 @@ +From 765f715f4077780395d381bf25870b61008f8013 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Mon, 23 Jan 2017 15:39:45 +0530 +Subject: [PATCH 03/11] [LOCAL]: Add missing declarations for xil_printf to + stdio.h for inclusion in toolchain and use in c++ apps + +Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> + +Upstream-Status: Pending + +Conflicts: + newlib/libc/include/stdio.h +--- + newlib/libc/include/stdio.h | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h +index 7748351f0..fd95f1344 100644 +--- a/newlib/libc/include/stdio.h ++++ b/newlib/libc/include/stdio.h +@@ -245,6 +245,9 @@ int sprintf (char *__restrict, const char *__restrict, ...) + _ATTRIBUTE ((__format__ (__printf__, 2, 3))); + int remove (const char *); + int rename (const char *, const char *); ++void xil_printf (const char*, ...); ++void putnum (unsigned int ); ++void print (const char* ); + #ifdef _LIBC + int _rename (const char *, const char *); + #endif +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-core/newlib/files/0004-Local-deleting-the-xil_printf.c-file-as-now-it-part-.patch b/meta-microblaze/recipes-core/newlib/files/0004-Local-deleting-the-xil_printf.c-file-as-now-it-part-.patch new file mode 100644 index 00000000..6d398bdc --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/files/0004-Local-deleting-the-xil_printf.c-file-as-now-it-part-.patch @@ -0,0 +1,306 @@ +From edf132aae14fadd15630916781a14a29cafd37ef Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Mon, 23 Jan 2017 15:42:11 +0530 +Subject: [PATCH 04/11] [Local]: deleting the xil_printf.c file as now it part + of BSP + +Upstream-Status: Pending + +--- + libgloss/microblaze/xil_printf.c | 284 ------------------------------- + 1 file changed, 284 deletions(-) + delete mode 100644 libgloss/microblaze/xil_printf.c + +diff --git a/libgloss/microblaze/xil_printf.c b/libgloss/microblaze/xil_printf.c +deleted file mode 100644 +index f18ee8446..000000000 +--- a/libgloss/microblaze/xil_printf.c ++++ /dev/null +@@ -1,284 +0,0 @@ +-/* Copyright (c) 1995-2013 Xilinx, Inc. All rights reserved. +- * +- * Redistribution and use in source and binary forms, with or without +- * modification, are permitted provided that the following conditions are +- * met: +- * +- * 1. Redistributions source code must retain the above copyright notice, +- * this list of conditions and the following disclaimer. +- * +- * 2. Redistributions in binary form must reproduce the above copyright +- * notice, this list of conditions and the following disclaimer in the +- * documentation and/or other materials provided with the distribution. +- * +- * 3. Neither the name of Xilinx nor the names of its contributors may be +- * used to endorse or promote products derived from this software without +- * specific prior written permission. +- * +- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS +- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +- * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- */ +- +-#include <ctype.h> +-#include <string.h> +-#include <stdarg.h> +- +-extern void outbyte (char); +- +-/*----------------------------------------------------*/ +-/* Use the following parameter passing structure to */ +-/* make xil_printf re-entrant. */ +-/*----------------------------------------------------*/ +-typedef struct params_s { +- int len; +- int num1; +- int num2; +- char pad_character; +- int do_padding; +- int left_flag; +-} params_t; +- +-/*---------------------------------------------------*/ +-/* The purpose of this routine is to output data the */ +-/* same as the standard printf function without the */ +-/* overhead most run-time libraries involve. Usually */ +-/* the printf brings in many kilobytes of code and */ +-/* that is unacceptable in most embedded systems. */ +-/*---------------------------------------------------*/ +- +-typedef char* charptr; +-typedef int (*func_ptr)(int c); +- +-/*---------------------------------------------------*/ +-/* */ +-/* This routine puts pad characters into the output */ +-/* buffer. */ +-/* */ +-static void padding( const int l_flag, params_t *par) +-{ +- int i; +- +- if (par->do_padding && l_flag && (par->len < par->num1)) +- for (i=par->len; i<par->num1; i++) +- outbyte( par->pad_character); +-} +- +-/*---------------------------------------------------*/ +-/* */ +-/* This routine moves a string to the output buffer */ +-/* as directed by the padding and positioning flags. */ +-/* */ +-static void outs( charptr lp, params_t *par) +-{ +- /* pad on left if needed */ +- par->len = strlen( lp); +- padding( !(par->left_flag), par); +- +- /* Move string to the buffer */ +- while (*lp && (par->num2)--) +- outbyte( *lp++); +- +- /* Pad on right if needed */ +- /* CR 439175 - elided next stmt. Seemed bogus. */ +- /* par->len = strlen( lp); */ +- padding( par->left_flag, par); +-} +- +-/*---------------------------------------------------*/ +-/* */ +-/* This routine moves a number to the output buffer */ +-/* as directed by the padding and positioning flags. */ +-/* */ +- +-static void outnum( const long n, const long base, params_t *par) +-{ +- charptr cp; +- int negative; +- char outbuf[32]; +- const char digits[] = "0123456789ABCDEF"; +- unsigned long num; +- +- /* Check if number is negative */ +- if (base == 10 && n < 0L) { +- negative = 1; +- num = -(n); +- } +- else{ +- num = (n); +- negative = 0; +- } +- +- /* Build number (backwards) in outbuf */ +- cp = outbuf; +- do { +- *cp++ = digits[(int)(num % base)]; +- } while ((num /= base) > 0); +- if (negative) +- *cp++ = '-'; +- *cp-- = 0; +- +- /* Move the converted number to the buffer and */ +- /* add in the padding where needed. */ +- par->len = strlen(outbuf); +- padding( !(par->left_flag), par); +- while (cp >= outbuf) +- outbyte( *cp--); +- padding( par->left_flag, par); +-} +- +-/*---------------------------------------------------*/ +-/* */ +-/* This routine gets a number from the format */ +-/* string. */ +-/* */ +-static int getnum( charptr* linep) +-{ +- int n; +- charptr cp; +- +- n = 0; +- cp = *linep; +- while (isdigit(*cp)) +- n = n*10 + ((*cp++) - '0'); +- *linep = cp; +- return(n); +-} +- +-/*---------------------------------------------------*/ +-/* */ +-/* This routine operates just like a printf/sprintf */ +-/* routine. It outputs a set of data under the */ +-/* control of a formatting string. Not all of the */ +-/* standard C format control are supported. The ones */ +-/* provided are primarily those needed for embedded */ +-/* systems work. Primarily the floaing point */ +-/* routines are omitted. Other formats could be */ +-/* added easily by following the examples shown for */ +-/* the supported formats. */ +-/* */ +- +-/* void esp_printf( const func_ptr f_ptr, +- const charptr ctrl1, ...) */ +-void xil_printf( const charptr ctrl1, ...) +-{ +- +- int long_flag; +- int dot_flag; +- +- params_t par; +- +- char ch; +- va_list argp; +- charptr ctrl = ctrl1; +- +- va_start( argp, ctrl1); +- +- for ( ; *ctrl; ctrl++) { +- +- /* move format string chars to buffer until a */ +- /* format control is found. */ +- if (*ctrl != '%') { +- outbyte(*ctrl); +- continue; +- } +- +- /* initialize all the flags for this format. */ +- dot_flag = long_flag = par.left_flag = par.do_padding = 0; +- par.pad_character = ' '; +- par.num2=32767; +- +- try_next: +- ch = *(++ctrl); +- +- if (isdigit(ch)) { +- if (dot_flag) +- par.num2 = getnum(&ctrl); +- else { +- if (ch == '0') +- par.pad_character = '0'; +- +- par.num1 = getnum(&ctrl); +- par.do_padding = 1; +- } +- ctrl--; +- goto try_next; +- } +- +- switch (tolower(ch)) { +- case '%': +- outbyte( '%'); +- continue; +- +- case '-': +- par.left_flag = 1; +- break; +- +- case '.': +- dot_flag = 1; +- break; +- +- case 'l': +- long_flag = 1; +- break; +- +- case 'd': +- if (long_flag || ch == 'D') { +- outnum( va_arg(argp, long), 10L, &par); +- continue; +- } +- else { +- outnum( va_arg(argp, int), 10L, &par); +- continue; +- } +- case 'x': +- outnum((long)va_arg(argp, int), 16L, &par); +- continue; +- +- case 's': +- outs( va_arg( argp, charptr), &par); +- continue; +- +- case 'c': +- outbyte( va_arg( argp, int)); +- continue; +- +- case '\\': +- switch (*ctrl) { +- case 'a': +- outbyte( 0x07); +- break; +- case 'h': +- outbyte( 0x08); +- break; +- case 'r': +- outbyte( 0x0D); +- break; +- case 'n': +- outbyte( 0x0D); +- outbyte( 0x0A); +- break; +- default: +- outbyte( *ctrl); +- break; +- } +- ctrl++; +- break; +- +- default: +- continue; +- } +- goto try_next; +- } +- va_end( argp); +-} +- +-/*---------------------------------------------------*/ +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-core/newlib/files/0005-Local-deleting-the-xil_printf.o-from-MAKEFILE.patch b/meta-microblaze/recipes-core/newlib/files/0005-Local-deleting-the-xil_printf.o-from-MAKEFILE.patch new file mode 100644 index 00000000..1576e54d --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/files/0005-Local-deleting-the-xil_printf.o-from-MAKEFILE.patch @@ -0,0 +1,27 @@ +From 250aa479da0b688b87f1fa42f45ecd4536194a45 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Mon, 23 Jan 2017 15:44:17 +0530 +Subject: [PATCH 05/11] [Local]: deleting the xil_printf.o from MAKEFILE + +Upstream-Status: Pending + +--- + libgloss/microblaze/Makefile.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libgloss/microblaze/Makefile.in b/libgloss/microblaze/Makefile.in +index fe04a08c9..32aafda37 100644 +--- a/libgloss/microblaze/Makefile.in ++++ b/libgloss/microblaze/Makefile.in +@@ -81,7 +81,7 @@ GENOBJS = fstat.o getpid.o isatty.o kill.o lseek.o print.o putnum.o stat.o unlin + open.o close.o read.o write.o + OBJS = ${GENOBJS} sbrk.o timer.o _exception_handler.o _hw_exception_handler.o \ + _interrupt_handler.o _program_clean.o _program_init.o \ +- xil_malloc.o xil_sbrk.o xil_printf.o ++ xil_malloc.o xil_sbrk.o + SCRIPTS = xilinx.ld + + # Tiny Linux BSP. +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-core/newlib/files/0006-MB-X-intial-commit.patch b/meta-microblaze/recipes-core/newlib/files/0006-MB-X-intial-commit.patch new file mode 100644 index 00000000..779580b6 --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/files/0006-MB-X-intial-commit.patch @@ -0,0 +1,196 @@ +From 97684eb81807189dbcdca560d086100ba8bfa906 Mon Sep 17 00:00:00 2001 +From: Nagaraju Mekala <nmekala@xilix.com> +Date: Fri, 27 Jul 2018 16:10:36 +0530 +Subject: [PATCH 06/11] MB-X intial commit + +Upstream-Status: Pending + +--- + libgloss/microblaze/crt0.S | 2 +- + libgloss/microblaze/crt1.S | 2 +- + libgloss/microblaze/crt2.S | 2 +- + libgloss/microblaze/crt3.S | 2 +- + libgloss/microblaze/crt4.S | 2 +- + libgloss/microblaze/crtinit.S | 4 ++-- + libgloss/microblaze/pgcrtinit.S | 4 ++-- + libgloss/microblaze/sim-crtinit.S | 4 ++-- + libgloss/microblaze/sim-pgcrtinit.S | 4 ++-- + newlib/libc/machine/microblaze/strcmp.c | 8 ++++---- + 10 files changed, 17 insertions(+), 17 deletions(-) + +diff --git a/libgloss/microblaze/crt0.S b/libgloss/microblaze/crt0.S +index b39ea90b3..865a8c269 100644 +--- a/libgloss/microblaze/crt0.S ++++ b/libgloss/microblaze/crt0.S +@@ -84,7 +84,7 @@ _vector_hw_exception: + _start1: + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ +- la r1, r0, _stack-16 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brlid r15, _crtinit /* Initialize BSS and run program */ + nop +diff --git a/libgloss/microblaze/crt1.S b/libgloss/microblaze/crt1.S +index 20323ff6d..a8bf74937 100644 +--- a/libgloss/microblaze/crt1.S ++++ b/libgloss/microblaze/crt1.S +@@ -75,7 +75,7 @@ _vector_hw_exception: + _start: + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ +- la r1, r0, _stack-16 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brlid r15, _crtinit /* Initialize BSS and run program */ + nop +diff --git a/libgloss/microblaze/crt2.S b/libgloss/microblaze/crt2.S +index e3fb15b26..34d9f951d 100644 +--- a/libgloss/microblaze/crt2.S ++++ b/libgloss/microblaze/crt2.S +@@ -73,7 +73,7 @@ _vector_hw_exception: + _start: + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ +- la r1, r0, _stack-16 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brlid r15, _crtinit /* Initialize BSS and run program */ + nop +diff --git a/libgloss/microblaze/crt3.S b/libgloss/microblaze/crt3.S +index 452ea5265..ebcf207f5 100644 +--- a/libgloss/microblaze/crt3.S ++++ b/libgloss/microblaze/crt3.S +@@ -59,7 +59,7 @@ + _start: + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ +- la r1, r0, _stack-16 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brlid r15, _crtinit /* Initialize BSS and run program */ + nop +diff --git a/libgloss/microblaze/crt4.S b/libgloss/microblaze/crt4.S +index 475acecfd..4cf0b01a4 100644 +--- a/libgloss/microblaze/crt4.S ++++ b/libgloss/microblaze/crt4.S +@@ -59,7 +59,7 @@ + _start: + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ +- la r1, r0, _stack-16 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brlid r15, _crtinit /* Initialize BSS and run program */ + nop +diff --git a/libgloss/microblaze/crtinit.S b/libgloss/microblaze/crtinit.S +index 78eb76df6..86c6dfcb0 100644 +--- a/libgloss/microblaze/crtinit.S ++++ b/libgloss/microblaze/crtinit.S +@@ -33,7 +33,7 @@ + .ent _crtinit + .type _crtinit, @function + _crtinit: +- addi r1, r1, -20 /* Save Link register */ ++ addi r1, r1, -40 /* Save Link register */ + swi r15, r1, 0 + + addi r6, r0, __sbss_start /* clear SBSS */ +@@ -82,6 +82,6 @@ _crtinit: + + addik r3, r19, 0 /* Restore return value */ + rtsd r15, 8 +- addi r1, r1, 20 ++ addi r1, r1, 40 + .end _crtinit + +diff --git a/libgloss/microblaze/pgcrtinit.S b/libgloss/microblaze/pgcrtinit.S +index fca1bc45e..25930821c 100644 +--- a/libgloss/microblaze/pgcrtinit.S ++++ b/libgloss/microblaze/pgcrtinit.S +@@ -33,7 +33,7 @@ + .ent _crtinit + + _crtinit: +- addi r1, r1, -20 /* Save Link register */ ++ addi r1, r1, -40 /* Save Link register */ + swi r15, r1, 0 + + addi r6, r0, __sbss_start /* clear SBSS */ +@@ -87,6 +87,6 @@ _crtinit: + lw r15, r1, r0 /* Return back to CRT */ + addik r3, r19, 0 /* Restore return value */ + rtsd r15, 8 +- addi r1, r1, 20 ++ addi r1, r1, 40 + .end _crtinit + +diff --git a/libgloss/microblaze/sim-crtinit.S b/libgloss/microblaze/sim-crtinit.S +index d2f59fe6d..74586d9a7 100644 +--- a/libgloss/microblaze/sim-crtinit.S ++++ b/libgloss/microblaze/sim-crtinit.S +@@ -39,7 +39,7 @@ + .ent _crtinit + + _crtinit: +- addi r1, r1, -20 /* Save Link register */ ++ addi r1, r1, -40 /* Save Link register */ + swi r15, r1, 0 + + brlid r15, _program_init /* Initialize the program */ +@@ -64,6 +64,6 @@ _crtinit: + lw r15, r1, r0 /* Return back to CRT */ + addik r3, r19, 0 /* Restore return value */ + rtsd r15, 8 +- addi r1, r1, 20 ++ addi r1, r1, 40 + .end _crtinit + +diff --git a/libgloss/microblaze/sim-pgcrtinit.S b/libgloss/microblaze/sim-pgcrtinit.S +index 3c6ba8371..82ebccad4 100644 +--- a/libgloss/microblaze/sim-pgcrtinit.S ++++ b/libgloss/microblaze/sim-pgcrtinit.S +@@ -39,7 +39,7 @@ + .ent _crtinit + + _crtinit: +- addi r1, r1, -20 /* Save Link register */ ++ addi r1, r1, -40 /* Save Link register */ + swi r15, r1, 0 + + brlid r15, _program_init /* Initialize the program */ +@@ -67,6 +67,6 @@ _crtinit: + + lw r15, r1, r0 /* Return back to CRT */ + rtsd r15, 8 +- addi r1, r1, 20 ++ addi r1, r1, 40 + .end _crtinit + +diff --git a/newlib/libc/machine/microblaze/strcmp.c b/newlib/libc/machine/microblaze/strcmp.c +index 434195e2c..3119d82c5 100644 +--- a/newlib/libc/machine/microblaze/strcmp.c ++++ b/newlib/libc/machine/microblaze/strcmp.c +@@ -96,15 +96,15 @@ strcmp (const char *s1, + + return (*(unsigned char *) s1) - (*(unsigned char *) s2); + #else +- unsigned long *a1; +- unsigned long *a2; ++ unsigned int *a1; ++ unsigned int *a2; + + /* If s1 or s2 are unaligned, then compare bytes. */ + if (!UNALIGNED (s1, s2)) + { + /* If s1 and s2 are word-aligned, compare them a word at a time. */ +- a1 = (unsigned long*)s1; +- a2 = (unsigned long*)s2; ++ a1 = (unsigned int*)s1; ++ a2 = (unsigned int*)s2; + while (*a1 == *a2) + { + /* To get here, *a1 == *a2, thus if we find a null in *a1, +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-core/newlib/files/0007-Patch-Microblaze-newlib-port-for-microblaze-m64-flag.patch b/meta-microblaze/recipes-core/newlib/files/0007-Patch-Microblaze-newlib-port-for-microblaze-m64-flag.patch new file mode 100644 index 00000000..f3e20253 --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/files/0007-Patch-Microblaze-newlib-port-for-microblaze-m64-flag.patch @@ -0,0 +1,1139 @@ +From e7b0c93274c2f51adc7c20c24a28d3cd5974fddc Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 11 Sep 2018 14:32:20 +0530 +Subject: [PATCH 07/11] [Patch, Microblaze]: newlib port for microblaze m64 + flag... + +Upstream-Status: Pending + +Conflicts: + libgloss/microblaze/_hw_exception_handler.S + libgloss/microblaze/_interrupt_handler.S +--- + libgloss/microblaze/_exception_handler.S | 6 +- + libgloss/microblaze/_hw_exception_handler.S | 7 +- + libgloss/microblaze/_interrupt_handler.S | 7 +- + libgloss/microblaze/_program_clean.S | 6 +- + libgloss/microblaze/_program_init.S | 6 +- + libgloss/microblaze/crt0.S | 53 ++++++++- + libgloss/microblaze/crt1.S | 54 +++++++-- + libgloss/microblaze/crt2.S | 52 +++++++-- + libgloss/microblaze/crt3.S | 32 +++++- + libgloss/microblaze/crt4.S | 37 +++++- + libgloss/microblaze/crtinit.S | 120 ++++++++++++++------ + libgloss/microblaze/linux-crt0.S | 60 ++++++++-- + libgloss/microblaze/linux-syscalls.S | 15 ++- + libgloss/microblaze/pgcrtinit.S | 59 +++++++++- + libgloss/microblaze/sim-crtinit.S | 31 +++++ + libgloss/microblaze/sim-pgcrtinit.S | 31 +++++ + newlib/libc/machine/microblaze/longjmp.S | 45 ++++++-- + newlib/libc/machine/microblaze/setjmp.S | 33 +++++- + 18 files changed, 563 insertions(+), 91 deletions(-) + +diff --git a/libgloss/microblaze/_exception_handler.S b/libgloss/microblaze/_exception_handler.S +index 7a91a781e..0fdff3fec 100644 +--- a/libgloss/microblaze/_exception_handler.S ++++ b/libgloss/microblaze/_exception_handler.S +@@ -30,7 +30,11 @@ + */ + + .text +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .weakext _exception_handler + .ent _exception_handler + .type _exception_handler, @function +diff --git a/libgloss/microblaze/_hw_exception_handler.S b/libgloss/microblaze/_hw_exception_handler.S +index 47df945c4..b951a6325 100644 +--- a/libgloss/microblaze/_hw_exception_handler.S ++++ b/libgloss/microblaze/_hw_exception_handler.S +@@ -32,8 +32,11 @@ + .text + .weakext _hw_exception_handler # HW Exception Handler Label + .type _hw_exception_handler, %function +- .align 2 +- ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + _hw_exception_handler: + rted r17, 0 + nop +diff --git a/libgloss/microblaze/_interrupt_handler.S b/libgloss/microblaze/_interrupt_handler.S +index 5bb7329cc..a0ef92df0 100644 +--- a/libgloss/microblaze/_interrupt_handler.S ++++ b/libgloss/microblaze/_interrupt_handler.S +@@ -32,8 +32,11 @@ + .text + .weakext _interrupt_handler # Interrupt Handler Label + .type _interrupt_handler, %function +- .align 2 +- ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + _interrupt_handler: + rtid r14, 0 + nop +diff --git a/libgloss/microblaze/_program_clean.S b/libgloss/microblaze/_program_clean.S +index c46059434..0d55d8ab8 100644 +--- a/libgloss/microblaze/_program_clean.S ++++ b/libgloss/microblaze/_program_clean.S +@@ -33,7 +33,11 @@ + # + + .text +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .globl _program_clean + .ent _program_clean + _program_clean: +diff --git a/libgloss/microblaze/_program_init.S b/libgloss/microblaze/_program_init.S +index 0daa42e14..862ef786b 100644 +--- a/libgloss/microblaze/_program_init.S ++++ b/libgloss/microblaze/_program_init.S +@@ -32,7 +32,11 @@ + # Dummy file to be replaced by LibGen + + .text +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .globl _program_init + .ent _program_init + _program_init: +diff --git a/libgloss/microblaze/crt0.S b/libgloss/microblaze/crt0.S +index 865a8c269..e4df73b66 100644 +--- a/libgloss/microblaze/crt0.S ++++ b/libgloss/microblaze/crt0.S +@@ -54,7 +54,11 @@ + + .globl _start + .section .vectors.reset, "ax" +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .ent _start + .type _start, @function + _start: +@@ -62,36 +66,64 @@ _start: + .end _start + + .section .vectors.sw_exception, "ax" ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif + _vector_sw_exception: + brai _exception_handler + + .section .vectors.interrupt, "ax" ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif ++ + _vector_interrupt: + brai _interrupt_handler + + .section .vectors.hw_exception, "ax" ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif ++ + _vector_hw_exception: + brai _hw_exception_handler + + .section .text + .globl _start1 ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif ++ + .ent _start1 + .type _start1, @function + _start1: ++#ifdef __arch64__ ++ lli r13, r0, _SDA_BASE_ ++ lli r2, r0, _SDA2_BASE_ ++ lli r1, r0, _stack-32 ++ brealid r15, _crtinit ++ nop ++ addlik r5, r3, 0 ++ brealid r15, exit ++ nop ++#else + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ + la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ +- + brlid r15, _crtinit /* Initialize BSS and run program */ + nop + +- brlid r15, exit /* Call exit with the return value of main */ +- addik r5, r3, 0 +- ++ brlid r15, exit /* Call exit with the return value of main */ ++ addik r5, r3, 0 ++#endif + /* Control does not reach here */ + .end _start1 + +@@ -101,9 +133,18 @@ _start1: + Our simple _exit + */ + .globl _exit ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif ++ + .ent _exit + .type _exit, @function + _exit: +- bri 0 ++#ifdef __arch64__ ++ breai 0 ++#else ++ bri 0 ++#endif + .end _exit +diff --git a/libgloss/microblaze/crt1.S b/libgloss/microblaze/crt1.S +index a8bf74937..b24eeb531 100644 +--- a/libgloss/microblaze/crt1.S ++++ b/libgloss/microblaze/crt1.S +@@ -53,36 +53,67 @@ + + + .section .vectors.sw_exception, "ax" +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + _vector_sw_exception: + brai _exception_handler + + .section .vectors.interrupt, "ax" +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + _vector_interrupt: + brai _interrupt_handler + + .section .vectors.hw_exception, "ax" +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + _vector_hw_exception: + brai _hw_exception_handler + + .section .text + .globl _start +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + .ent _start + .type _start, @function + _start: ++#ifdef __arch64__ ++ lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ lli r2, r0, _SDA2_BASE_ ++ lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ ++ brealid r15, _crtinit /* Initialize BSS and run program */ ++ nop ++ addlik r5, r3, 0 ++ brealid r15, exit ++ nop ++#else + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ +- la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brlid r15, _crtinit /* Initialize BSS and run program */ + nop + + brlid r15, exit /* Call exit with the return value of main */ + addik r5, r3, 0 +- ++#endif + /* Control does not reach here */ + .end _start + +@@ -92,11 +123,18 @@ _start: + Our simple _exit + */ + .globl _exit +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .ent _exit + .type _exit, @function + _exit: ++#ifdef __arch64__ ++ addl r3, r0, r5 ++#else + add r3, r0, r5 ++#endif + brki r16, 0x4 /* Return to hook in XMDSTUB */ + .end _exit +- +diff --git a/libgloss/microblaze/crt2.S b/libgloss/microblaze/crt2.S +index 34d9f951d..ae4c89ee0 100644 +--- a/libgloss/microblaze/crt2.S ++++ b/libgloss/microblaze/crt2.S +@@ -51,26 +51,56 @@ + */ + + .section .vectors.sw_exception, "ax" +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + _vector_sw_exception: + brai _exception_handler + + .section .vectors.interrupt, "ax" +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + _vector_interrupt: + brai _interrupt_handler + + .section .vectors.hw_exception, "ax" +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + _vector_hw_exception: + brai _hw_exception_handler + + .section .text + .globl _start +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + .ent _start + .type _start, @function + _start: ++#ifdef __arch64__ ++ lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ lli r2, r0, _SDA2_BASE_ ++ lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ brealid r15, _crtinit /* Initialize BSS and run program */ ++ nop ++ addlik r5, r3, 0 ++ brealid r15, exit ++ nop ++#else + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ + la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ +@@ -80,7 +110,7 @@ _start: + + brlid r15, exit /* Call exit with the return value of main */ + addik r5, r3, 0 +- ++#endif + /* Control does not reach here */ + + .end _start +@@ -90,9 +120,17 @@ _start: + Our simple _exit + */ + .globl _exit +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .ent _exit + .type _exit, @function + _exit: +- bri 0 ++#ifdef __arch64__ ++ breai 0 ++#else ++ bri 0 ++#endif + .end _exit +diff --git a/libgloss/microblaze/crt3.S b/libgloss/microblaze/crt3.S +index ebcf207f5..a8bc7839b 100644 +--- a/libgloss/microblaze/crt3.S ++++ b/libgloss/microblaze/crt3.S +@@ -53,10 +53,26 @@ + + .section .text + .globl _start +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .ent _start + .type _start, @function + _start: ++#ifdef __arch64__ ++ lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ lli r2, r0, _SDA2_BASE_ ++ lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ ++ brealid r15, _crtinit /* Initialize BSS and run program */ ++ nop ++ ++ addlik r5, r3, 0 ++ brealid r15, exit /* Call exit with the return value of main */ ++ nop ++#else + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ + la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ +@@ -66,7 +82,7 @@ _start: + + brlid r15, exit /* Call exit with the return value of main */ + addik r5, r3, 0 +- ++#endif + /* Control does not reach here */ + .end _start + +@@ -76,9 +92,17 @@ _start: + Our simple _exit + */ + .globl _exit +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .ent _exit + .type _exit, @function + _exit: +- bri 0 ++#ifdef __arch64__ ++ breai 0 ++#else ++ bri 0 ++#endif + .end _exit +diff --git a/libgloss/microblaze/crt4.S b/libgloss/microblaze/crt4.S +index 4cf0b01a4..54ba473ea 100644 +--- a/libgloss/microblaze/crt4.S ++++ b/libgloss/microblaze/crt4.S +@@ -53,10 +53,27 @@ + + .section .text + .globl _start +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + .ent _start + .type _start, @function + _start: ++#ifdef __arch64__ ++ lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ lli r2, r0, _SDA2_BASE_ ++ lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ ++ brealid r15, _crtinit /* Initialize BSS and run program */ ++ nop ++ ++ addlik r5, r3, 0 ++ brealid r15, exit /* Call exit with the return value of main */ ++ nop ++#else + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ + la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ +@@ -68,19 +85,27 @@ _start: + addik r5, r3, 0 + + /* Control does not reach here */ +- ++#endif + .end _start + +- + /* + _exit + Our simple _exit + */ + .globl _exit +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .ent _exit + .type _exit, @function + _exit: +- brlid r15,elf_process_exit +- nop ++#ifdef __arch64__ ++ brealid r15,elf_process_exit ++ nop ++#else ++ brlid r15,elf_process_exit ++ nop ++#endif + .end _exit +diff --git a/libgloss/microblaze/crtinit.S b/libgloss/microblaze/crtinit.S +index 86c6dfcb0..854117536 100644 +--- a/libgloss/microblaze/crtinit.S ++++ b/libgloss/microblaze/crtinit.S +@@ -29,59 +29,115 @@ + */ + + .globl _crtinit ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif + .ent _crtinit + .type _crtinit, @function + _crtinit: +- addi r1, r1, -40 /* Save Link register */ +- swi r15, r1, 0 ++#ifdef __arch64__ ++ addli r1, r1, -40 /* Save Link register */ ++ sli r15, r1, 0 + +- addi r6, r0, __sbss_start /* clear SBSS */ +- addi r7, r0, __sbss_end +- rsub r18, r6, r7 +- blei r18, .Lendsbss ++ addli r6, r0, __sbss_start /* clear SBSS */ ++ addli r7, r0, __sbss_end ++ rsubl r18, r6, r7 ++ bealei r18, .Lendsbss + + .Lloopsbss: +- swi r0, r6, 0 +- addi r6, r6, 4 +- rsub r18, r6, r7 +- bgti r18, .Lloopsbss ++ sli r0, r6, 0 ++ addli r6, r6, 4 ++ rsubl r18, r6, r7 ++ beagti r18, .Lloopsbss + .Lendsbss: +- +- addi r6, r0, __bss_start /* clear BSS */ +- addi r7, r0, __bss_end +- rsub r18, r6, r7 +- blei r18, .Lendbss ++ addli r6, r0, __bss_start /* clear BSS */ ++ addli r7, r0, __bss_end ++ rsubl r18, r6, r7 ++ bealei r18, .Lendbss + .Lloopbss: +- swi r0, r6, 0 +- addi r6, r6, 4 +- rsub r18, r6, r7 +- bgti r18, .Lloopbss ++ sli r0, r6, 0 ++ addli r6, r6, 4 ++ rsubl r18, r6, r7 ++ beagti r18, .Lloopbss + .Lendbss: + +- brlid r15, _program_init /* Initialize the program */ ++ brealid r15, _program_init /* Initialize the program */ ++ nop ++ brealid r15, __init /* Invoke language initialization functions */ ++ nop ++ ++ addli r6, r0, 0 /* Initialize argc = 1 and argv = NULL and envp = NULL */ ++ addli r7, r0, 0 ++ addli r5, r0, 0 ++ brealid r15, main /* Execute the program */ + nop ++ addlik r19, r3, 0 /* Save return value */ ++ ++ brealid r15, __fini /* Invoke language cleanup functions */ ++ nop ++ ++ brealid r15, _program_clean /* Cleanup the program */ ++ nop ++ ++ ll r15, r1, r0 /* Return back to CRT */ ++ ++ addlik r3, r19, 0 /* Restore return value */ ++ addli r1, r1, 40 ++ rtsd r15, 8 ++ nop ++#else ++ addi r1, r1, -40 /* Save Link register */ ++ swi r15, r1, 0 ++ ++ addi r6, r0, __sbss_start /* clear SBSS */ ++ addi r7, r0, __sbss_end ++ rsub r18, r6, r7 ++ blei r18, .Lendsbss ++ ++.Lloopsbss: ++ swi r0, r6, 0 ++ addi r6, r6, 4 ++ rsub r18, r6, r7 ++ bgti r18, .Lloopsbss ++.Lendsbss: ++ ++ addi r6, r0, __bss_start /* clear BSS */ ++ addi r7, r0, __bss_end ++ rsub r18, r6, r7 ++ blei r18, .Lendbss ++.Lloopbss: ++ swi r0, r6, 0 ++ addi r6, r6, 4 ++ rsub r18, r6, r7 ++ bgti r18, .Lloopbss ++.Lendbss: ++ ++ brlid r15, _program_init /* Initialize the program */ ++ nop + + brlid r15, __init /* Invoke language initialization functions */ + nop +- +- addi r6, r0, 0 /* Initialize argc = 1 and argv = NULL and envp = NULL */ +- addi r7, r0, 0 +- brlid r15, main /* Execute the program */ +- addi r5, r0, 0 ++ ++ addi r6, r0, 0 /* Initialize argc = 1 and argv = NULL and envp = NULL */ ++ addi r7, r0, 0 ++ brlid r15, main /* Execute the program */ ++ addi r5, r0, 0 + + addik r19, r3, 0 /* Save return value */ +- ++ + brlid r15, __fini /* Invoke language cleanup functions */ + nop +- +- brlid r15, _program_clean /* Cleanup the program */ +- nop + +- lw r15, r1, r0 /* Return back to CRT */ ++ brlid r15, _program_clean /* Cleanup the program */ ++ nop ++ ++ lw r15, r1, r0 /* Return back to CRT */ + + addik r3, r19, 0 /* Restore return value */ +- rtsd r15, 8 +- addi r1, r1, 40 ++ rtsd r15, 8 ++ addi r1, r1, 40 ++#endif + .end _crtinit + +diff --git a/libgloss/microblaze/linux-crt0.S b/libgloss/microblaze/linux-crt0.S +index 8650bb5d2..503439b2e 100644 +--- a/libgloss/microblaze/linux-crt0.S ++++ b/libgloss/microblaze/linux-crt0.S +@@ -18,26 +18,50 @@ + .ent _start + .type _start, @function + _start: +- la r13, r0, _SDA_BASE_ +- la r2, r0, _SDA2_BASE_ ++#ifdef __arch64__ ++ lli r13, r0, _SDA_BASE_ ++ lli r2, r0, _SDA2_BASE_ + +- brlid r15, __init ++ brealid r15, __init + nop + +- lwi r5, r1, 0 +- addik r6, r1, 4 ++ lli r5, r1, 0 ++ addlik r6, r1, 4 + + # Add argc * 4. +- addk r7, r5, r5 +- addk r7, r7, r7 ++ addlk r7, r5, r5 ++ addlk r7, r7, r7 + +- brlid r15, main + # Now add 4 + r1 (i.e r6) in the delayslot. +- addk r7, r7, r6 ++ addlk r7, r7, r6 ++ brealid r15, main ++ nop ++ addlik r5, r3, 0 ++ brealid r15, exit ++ nop ++ .size _start, . - _start ++#else ++ la r13, r0, _SDA_BASE_ ++ la r2, r0, _SDA2_BASE_ ++ ++ brlid r15, __init ++ nop ++ ++ lwi r5, r1, 0 ++ addik r6, r1, 4 + +- brlid r15, exit ++ # Add argc * 4. ++ addk r7, r5, r5 ++ addk r7, r7, r7 ++ ++ brlid r15, main ++ # Now add 4 + r1 (i.e r6) in the delayslot. ++ addk r7, r7, r6 ++ ++ brlid r15, exit + addik r5, r3, 0 +- .size _start, . - _start ++ .size _start, . - _start ++#endif + .end _start + + /* Replacement for the GCC provided crti.S. This one avoids the +@@ -45,14 +69,28 @@ _start: + insn exceptions when running in user-space). */ + .section .init, "ax" + .global __init ++#ifdef __arch64__ ++ .align 3 ++__init: ++ addlik r1, r1, -8 ++ sl r15, r0, r1 ++#else + .align 2 + __init: + addik r1, r1, -8 + sw r15, r0, r1 + ++#endif + .section .fini, "ax" + .global __fini ++#ifdef __arch64__ ++ .align 3 ++__fini: ++ addlik r1, r1, -8 ++ sl r15, r0, r1 ++#else + .align 2 + __fini: + addik r1, r1, -8 + sw r15, r0, r1 ++#endif +diff --git a/libgloss/microblaze/linux-syscalls.S b/libgloss/microblaze/linux-syscalls.S +index 506de78fd..8594f136e 100644 +--- a/libgloss/microblaze/linux-syscalls.S ++++ b/libgloss/microblaze/linux-syscalls.S +@@ -20,8 +20,9 @@ + #define GLOBAL(name) .global name; FUNC(name) + #define SIZE(name) .size name, .-name + ++#ifdef __arch64__ + # define SYSCALL_BODY(name) \ +- addik r12, r0, SYS_ ## name; \ ++ addlik r12, r0, SYS_ ## name; \ + brki r14, 8; \ + rtsd r15, 8; \ + nop; +@@ -31,6 +32,18 @@ + SYSCALL_BODY(name); \ + SIZE(_ ## name) + ++#else ++# define SYSCALL_BODY(name) \ ++ addik r12, r0, SYS_ ## name; \ ++ brki r14, 8; \ ++ rtsd r15, 8; \ ++ nop; ++ ++# define SYSCALL(name) \ ++ GLOBAL(_ ## name); \ ++ SYSCALL_BODY(name); \ ++ SIZE(_ ## name) ++#endif + SYSCALL(brk) + SYSCALL(exit) + SYSCALL(read) +diff --git a/libgloss/microblaze/pgcrtinit.S b/libgloss/microblaze/pgcrtinit.S +index 25930821c..638dbd383 100644 +--- a/libgloss/microblaze/pgcrtinit.S ++++ b/libgloss/microblaze/pgcrtinit.S +@@ -29,10 +29,66 @@ + + + .globl _crtinit ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif + .ent _crtinit + + _crtinit: ++#ifdef __arch64__ ++ ++ addli r1, r1, -40 /* Save Link register */ ++ sli r15, r1, 0 ++ ++ addli r6, r0, __sbss_start /* clear SBSS */ ++ addli r7, r0, __sbss_end ++ rsubl r18, r6, r7 ++ bealei r18, .Lendsbss ++.Lloopsbss: ++ sli r0, r6, 0 ++ addli r6, r6, 4 ++ rsubl r18, r6, r7 ++ beagti r18, .Lloopsbss ++.Lendsbss: ++ ++ addli r6, r0, __bss_start /* clear BSS */ ++ addli r7, r0, __bss_end ++ rsubl r18, r6, r7 ++ bealei r18, .Lendbss ++.Lloopbss: ++ sli r0, r6, 0 ++ addli r6, r6, 4 ++ rsubl r18, r6, r7 ++ beagti r18, .Lloopbss ++.Lendbss: ++ ++ brealid r15, _program_init /* Initialize the program */ ++ nop ++ brealid r15, _profile_init /* Initialize profiling library */ ++ nop ++ brealid r15, __init /* Invoke language initialization functions */ ++ nop ++ addli r6, r0, 0 /* Initialize argc = 1 and argv = NULL and envp = NULL */ ++ addli r7, r0, 0 ++ addli r5, r0, 0 ++ brealid r15, main /* Execute the program */ ++ nop ++ addlik r19, r3, 0 /* Save return value */ ++ ++ brealid r15, __fini /* Invoke language cleanup functions */ ++ nop ++ brealid r15, _profile_clean /* Cleanup profiling library */ ++ nop ++ brealid r15, _program_clean /* Cleanup the program */ ++ nop ++ ll r15, r1, r0 /* Return back to CRT */ ++ addlik r3, r19, 0 /* Restore return value */ ++ addli r1, r1, 40 ++ rtsd r15, 8 ++ nop ++#else + addi r1, r1, -40 /* Save Link register */ + swi r15, r1, 0 + +@@ -86,7 +142,8 @@ _crtinit: + + lw r15, r1, r0 /* Return back to CRT */ + addik r3, r19, 0 /* Restore return value */ +- rtsd r15, 8 ++ rtsd r15, 8 + addi r1, r1, 40 ++#endif + .end _crtinit + +diff --git a/libgloss/microblaze/sim-crtinit.S b/libgloss/microblaze/sim-crtinit.S +index 74586d9a7..9892cb0bd 100644 +--- a/libgloss/microblaze/sim-crtinit.S ++++ b/libgloss/microblaze/sim-crtinit.S +@@ -35,10 +35,39 @@ + # + + .globl _crtinit ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif + .ent _crtinit + + _crtinit: ++#ifdef __arch64__ ++ addli r1, r1, -40 /* Save Link register */ ++ sli r15, r1, 0 ++ ++ brealid r15, _program_init /* Initialize the program */ ++ nop ++ brealid r15, __init /* Invoke language initialization functions */ ++ nop ++ addli r6, r0, 0 /* Initialize argc = 1 and argv = NULL and envp = NULL */ ++ addli r7, r0, 0 ++ addli r5, r0, 0 ++ brealid r15, main /* Execute the program */ ++ nop ++ addlik r19, r3, 0 /* Save return value */ ++ ++ brealid r15, __fini /* Invoke language cleanup functions */ ++ nop ++ brealid r15, _program_clean /* Cleanup the program */ ++ nop ++ ll r15, r1, r0 /* Return back to CRT */ ++ addlik r3, r19, 0 /* Restore return value */ ++ addli r1, r1, 40 ++ rtsd r15, 8 ++ nop ++#else + addi r1, r1, -40 /* Save Link register */ + swi r15, r1, 0 + +@@ -63,7 +92,9 @@ _crtinit: + + lw r15, r1, r0 /* Return back to CRT */ + addik r3, r19, 0 /* Restore return value */ ++ + rtsd r15, 8 + addi r1, r1, 40 ++#endif + .end _crtinit + +diff --git a/libgloss/microblaze/sim-pgcrtinit.S b/libgloss/microblaze/sim-pgcrtinit.S +index 82ebccad4..939f5372f 100644 +--- a/libgloss/microblaze/sim-pgcrtinit.S ++++ b/libgloss/microblaze/sim-pgcrtinit.S +@@ -35,10 +35,40 @@ + # + + .globl _crtinit ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif + .ent _crtinit + + _crtinit: ++#ifdef __arch64__ ++ addli r1, r1, -40 /* Save Link register */ ++ sli r15, r1, 0 ++ ++ brealid r15, _program_init /* Initialize the program */ ++ nop ++ brealid r15, _profile_init /* Initialize profiling library */ ++ nop ++ brealid r15, __init /* Invoke language initialization functions */ ++ nop ++ addli r6, r0, 0 /* Initialize argc = 1 and argv = NULL and envp = NULL */ ++ addli r7, r0, 0 ++ addli r5, r0, 0 ++ brealid r15, main /* Execute the program */ ++ nop ++ brealid r15, __fini /* Invoke language cleanup functions */ ++ nop ++ brealid r15, _profile_clean /* Cleanup profiling library */ ++ nop ++ brealid r15, _program_clean /* Cleanup the program */ ++ nop ++ ll r15, r1, r0 /* Return back to CRT */ ++ addli r1, r1, 40 ++ rtsd r15, 8 ++ nop ++#else + addi r1, r1, -40 /* Save Link register */ + swi r15, r1, 0 + +@@ -68,5 +98,6 @@ _crtinit: + lw r15, r1, r0 /* Return back to CRT */ + rtsd r15, 8 + addi r1, r1, 40 ++#endif + .end _crtinit + +diff --git a/newlib/libc/machine/microblaze/longjmp.S b/newlib/libc/machine/microblaze/longjmp.S +index f972bbd88..5ed1c2626 100644 +--- a/newlib/libc/machine/microblaze/longjmp.S ++++ b/newlib/libc/machine/microblaze/longjmp.S +@@ -51,16 +51,46 @@ + + .globl longjmp + .section .text +-.align 2 ++#ifdef __arch64__ ++.align 3 ++#else ++.align 2 ++#endif + .ent longjmp + longjmp: ++#ifdef __arch64__ ++ lli r1, r5, 0 ++ lli r13, r5, 4 ++ lli r14, r5, 8 ++ lli r15, r5, 12 ++ lli r16, r5, 16 ++ lli r17, r5, 20 ++ lli r18, r5, 24 ++ lli r19, r5, 28 ++ lli r20, r5, 32 ++ lli r21, r5, 36 ++ lli r22, r5, 40 ++ lli r23, r5, 44 ++ lli r24, r5, 48 ++ lli r25, r5, 52 ++ lli r26, r5, 56 ++ lli r27, r5, 60 ++ lli r28, r5, 64 ++ lli r29, r5, 68 ++ lli r30, r5, 72 ++ lli r31, r5, 76 ++ ++ or r3, r0, r6 ++ rtsd r15, 8 ++ nop ++#else + lwi r1, r5, 0 + lwi r13, r5, 4 + lwi r14, r5, 8 +- lwi r15, r5, 12 ++ lwi r15, r5, 12 + lwi r16, r5, 16 + lwi r17, r5, 20 +- lwi r18, r5, 24 ++ lwi r18, r5, 24 + lwi r19, r5, 28 + lwi r20, r5, 32 + lwi r21, r5, 36 +@@ -69,12 +99,13 @@ longjmp: + lwi r24, r5, 48 + lwi r25, r5, 52 + lwi r26, r5, 56 +- lwi r27, r5, 60 +- lwi r28, r5, 64 +- lwi r29, r5, 68 ++ lwi r27, r5, 60 ++ lwi r28, r5, 64 ++ lwi r29, r5, 68 + lwi r30, r5, 72 +- lwi r31, r5, 76 ++ lwi r31, r5, 76 + + rtsd r15, 8 + or r3, r0, r6 ++#endif + .end longjmp +diff --git a/newlib/libc/machine/microblaze/setjmp.S b/newlib/libc/machine/microblaze/setjmp.S +index cdd87c76f..971862bcb 100644 +--- a/newlib/libc/machine/microblaze/setjmp.S ++++ b/newlib/libc/machine/microblaze/setjmp.S +@@ -50,9 +50,39 @@ + + .globl setjmp + .section .text +-.align 2 ++#ifdef __arch64__ ++.align 3 ++#else ++.align 2 ++#endif + .ent setjmp + setjmp: ++#ifdef __arch64__ ++ sli r1, r5, 0 ++ sli r13, r5, 4 ++ sli r14, r5, 8 ++ sli r15, r5, 12 ++ sli r16, r5, 16 ++ sli r17, r5, 20 ++ sli r18, r5, 24 ++ sli r19, r5, 28 ++ sli r20, r5, 32 ++ sli r21, r5, 36 ++ sli r22, r5, 40 ++ sli r23, r5, 44 ++ sli r24, r5, 48 ++ sli r25, r5, 52 ++ sli r26, r5, 56 ++ sli r27, r5, 60 ++ sli r28, r5, 64 ++ sli r29, r5, 68 ++ sli r30, r5, 72 ++ sli r31, r5, 76 ++ ++ or r3, r0, r0 ++ rtsd r15, 8 ++ nop ++#else + swi r1, r5, 0 + swi r13, r5, 4 + swi r14, r5, 8 +@@ -76,4 +106,5 @@ setjmp: + + rtsd r15, 8 + or r3, r0, r0 ++#endif + .end setjmp +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-core/newlib/files/0008-fixing-the-bug-in-crt-files-added-addlik-instead-of-.patch b/meta-microblaze/recipes-core/newlib/files/0008-fixing-the-bug-in-crt-files-added-addlik-instead-of-.patch new file mode 100644 index 00000000..b82d7b5c --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/files/0008-fixing-the-bug-in-crt-files-added-addlik-instead-of-.patch @@ -0,0 +1,104 @@ +From 924721fdb8eed60fe58c8a7976955bac02efc200 Mon Sep 17 00:00:00 2001 +From: Nagaraju Mekala <nmekala@xilix.com> +Date: Fri, 28 Sep 2018 12:07:43 +0530 +Subject: [PATCH 08/11] fixing the bug in crt files, added addlik instead of + lli insn + +Upstream-Status: Pending + +--- + libgloss/microblaze/crt0.S | 6 +++--- + libgloss/microblaze/crt1.S | 6 +++--- + libgloss/microblaze/crt2.S | 6 +++--- + libgloss/microblaze/crt3.S | 6 +++--- + libgloss/microblaze/crt4.S | 6 +++--- + 5 files changed, 15 insertions(+), 15 deletions(-) + +diff --git a/libgloss/microblaze/crt0.S b/libgloss/microblaze/crt0.S +index e4df73b66..25e7c4af3 100644 +--- a/libgloss/microblaze/crt0.S ++++ b/libgloss/microblaze/crt0.S +@@ -106,9 +106,9 @@ _vector_hw_exception: + .type _start1, @function + _start1: + #ifdef __arch64__ +- lli r13, r0, _SDA_BASE_ +- lli r2, r0, _SDA2_BASE_ +- lli r1, r0, _stack-32 ++ addlik r13, r0, _SDA_BASE_ ++ addlik r2, r0, _SDA2_BASE_ ++ addlik r1, r0, _stack-32 + brealid r15, _crtinit + nop + addlik r5, r3, 0 +diff --git a/libgloss/microblaze/crt1.S b/libgloss/microblaze/crt1.S +index b24eeb531..38440c957 100644 +--- a/libgloss/microblaze/crt1.S ++++ b/libgloss/microblaze/crt1.S +@@ -94,9 +94,9 @@ _vector_hw_exception: + .type _start, @function + _start: + #ifdef __arch64__ +- lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ +- lli r2, r0, _SDA2_BASE_ +- lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ addlik r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ addlik r2, r0, _SDA2_BASE_ ++ addlik r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brealid r15, _crtinit /* Initialize BSS and run program */ + nop +diff --git a/libgloss/microblaze/crt2.S b/libgloss/microblaze/crt2.S +index ae4c89ee0..352927dab 100644 +--- a/libgloss/microblaze/crt2.S ++++ b/libgloss/microblaze/crt2.S +@@ -92,9 +92,9 @@ _vector_hw_exception: + .type _start, @function + _start: + #ifdef __arch64__ +- lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ +- lli r2, r0, _SDA2_BASE_ +- lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ addlik r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ addlik r2, r0, _SDA2_BASE_ ++ addlik r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + brealid r15, _crtinit /* Initialize BSS and run program */ + nop + addlik r5, r3, 0 +diff --git a/libgloss/microblaze/crt3.S b/libgloss/microblaze/crt3.S +index a8bc7839b..bc32cda86 100644 +--- a/libgloss/microblaze/crt3.S ++++ b/libgloss/microblaze/crt3.S +@@ -62,9 +62,9 @@ + .type _start, @function + _start: + #ifdef __arch64__ +- lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ +- lli r2, r0, _SDA2_BASE_ +- lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ addlik r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ addlik r2, r0, _SDA2_BASE_ ++ addlik r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brealid r15, _crtinit /* Initialize BSS and run program */ + nop +diff --git a/libgloss/microblaze/crt4.S b/libgloss/microblaze/crt4.S +index 54ba473ea..a25c84734 100644 +--- a/libgloss/microblaze/crt4.S ++++ b/libgloss/microblaze/crt4.S +@@ -63,9 +63,9 @@ + .type _start, @function + _start: + #ifdef __arch64__ +- lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ +- lli r2, r0, _SDA2_BASE_ +- lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ addlik r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ addlik r2, r0, _SDA2_BASE_ ++ addlik r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brealid r15, _crtinit /* Initialize BSS and run program */ + nop +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-core/newlib/files/0009-Patch-MicroBlaze-Added-MB-64-support-to-strcmp-strcp.patch b/meta-microblaze/recipes-core/newlib/files/0009-Patch-MicroBlaze-Added-MB-64-support-to-strcmp-strcp.patch new file mode 100644 index 00000000..1a89c31b --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/files/0009-Patch-MicroBlaze-Added-MB-64-support-to-strcmp-strcp.patch @@ -0,0 +1,232 @@ +From e7a5086bc3e38cf5bc5c5943de6cf5135ed6a77b Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 17 Nov 2020 13:06:41 +0530 +Subject: [PATCH 09/11] [Patch,MicroBlaze] : Added MB-64 support to + strcmp/strcpy/strlen files Signed-off-by:Mahesh Bodapati<mbodapat@xilinx.com> + +Upstream-Status: Pending + +--- + newlib/libc/machine/microblaze/strcmp.c | 63 ++++++++++++++++++++++++- + newlib/libc/machine/microblaze/strcpy.c | 57 ++++++++++++++++++++++ + newlib/libc/machine/microblaze/strlen.c | 38 +++++++++++++++ + 3 files changed, 157 insertions(+), 1 deletion(-) + +diff --git a/newlib/libc/machine/microblaze/strcmp.c b/newlib/libc/machine/microblaze/strcmp.c +index 3119d82c5..2cfef7388 100644 +--- a/newlib/libc/machine/microblaze/strcmp.c ++++ b/newlib/libc/machine/microblaze/strcmp.c +@@ -133,6 +133,66 @@ strcmp (const char *s1, + + #include "mb_endian.h" + ++#ifdef __arch64__ ++ asm volatile (" \n\ ++ orl r9, r0, r0 /* Index register */ \n\ ++check_alignment: \n\ ++ andli r3, r5, 3 \n\ ++ andli r4, r6, 3 \n\ ++ beanei r3, try_align_args \n\ ++ beanei r4, regular_strcmp /* At this point we don't have a choice */ \n\ ++cmp_loop: \n" ++ LOAD4BYTES("r3", "r5", "r9") ++ LOAD4BYTES("r4", "r6", "r9") ++" \n\ ++ pcmplbf r7, r3, r0 /* See if there is Null byte */ \n\ ++ beanei r7, end_cmp_loop /* IF yes (r7 > 0) use byte compares in end_cmp_loop */ \n\ ++ cmplu r7, r4, r3 /* ELSE compare whole word */ \n\ ++ beanei r7, end_cmp \n\ ++ addlik r9, r9, 4 /* delay slot */ \n\ ++ breaid cmp_loop \n\ ++ nop /* delay slot */ \n\ ++end_cmp_loop: \n\ ++ lbu r3, r5, r9 /* byte compare loop */ \n\ ++ lbu r4, r6, r9 \n\ ++ cmplu r7, r4, r3 /* Compare bytes */ \n\ ++ beanei r7, end_cmp_early \n\ ++ addlik r9, r9, 1 /* delay slot */ \n\ ++ beaneid r3, end_cmp_loop /* If reached null on one string, terminate */ \n\ ++ nop \n\ ++end_cmp_early: \n\ ++ orl r3, r0, r7 /* delay slot */ \n\ ++ rtsd r15, 8 \n\ ++ nop \n\ ++try_align_args: \n\ ++ xorl r7, r4, r3 \n\ ++ beanei r7, regular_strcmp /* cannot align args */ \n\ ++ rsublik r10, r3, 4 /* Number of initial bytes to align */ \n\ ++align_loop: \n\ ++ lbu r3, r5, r9 \n\ ++ lbu r4, r6, r9 \n\ ++ cmplu r7, r4, r3 \n\ ++ beanei r7, end_cmp \n\ ++ beaeqi r3, end_cmp \n\ ++ addlik r10, r10, -1 \n\ ++ addlik r9, r9, 1 \n\ ++ beaeqid r10, cmp_loop \n\ ++ nop \n\ ++ breai align_loop \n\ ++regular_strcmp: \n\ ++ lbu r3, r5, r9 \n\ ++ lbu r4, r6, r9 \n\ ++ cmplu r7, r4, r3 \n\ ++ beanei r7, end_cmp \n\ ++ beaeqi r3, end_cmp \n\ ++ addlik r9, r9, 1 \n\ ++ breaid regular_strcmp \n\ ++ nop \n\ ++end_cmp: \n\ ++ orl r3, r0, r7 \n\ ++ rtsd r15, 8 \n\ ++ nop /* Return strcmp result */"); ++#else + asm volatile (" \n\ + or r9, r0, r0 /* Index register */\n\ + check_alignment: \n\ +@@ -181,11 +241,12 @@ regular_strcmp: + bnei r7, end_cmp \n\ + beqi r3, end_cmp \n\ + brid regular_strcmp \n\ +- addik r9, r9, 1 \n\ ++ addik r9, r9, 1 + end_cmp: \n\ + rtsd r15, 8 \n\ + or r3, r0, r7 /* Return strcmp result */"); + ++#endif + #endif /* ! HAVE_HW_PCMP */ + } + +diff --git a/newlib/libc/machine/microblaze/strcpy.c b/newlib/libc/machine/microblaze/strcpy.c +index 62072fa28..6dbc60d77 100644 +--- a/newlib/libc/machine/microblaze/strcpy.c ++++ b/newlib/libc/machine/microblaze/strcpy.c +@@ -125,6 +125,62 @@ strcpy (char *__restrict dst0, + #else + + #include "mb_endian.h" ++#ifdef __arch64__ ++ ++ asm volatile (" \n\ ++ orl r9, r0, r0 /* Index register */ \n\ ++check_alignment: \n\ ++ andli r3, r5, 3 \n\ ++ andli r4, r6, 3 \n\ ++ beanei r3, try_align_args \n\ ++ beanei r4, regular_strcpy /* At this point we dont have a choice */ \n\ ++cpy_loop: \n" ++ LOAD4BYTES("r3", "r6", "r9") ++" \n\ ++ pcmplbf r4, r0, r3 \n\ ++ beanei r4, cpy_bytes /* If r4 != 0, then null present within string */\n" ++ STORE4BYTES("r3", "r5", "r9") ++" \n\ ++ addlik r9, r9, 4 \n\ ++ breaid cpy_loop \n\ ++ nop \n\ ++cpy_bytes: \n\ ++ lbu r3, r6, r9 \n\ ++ sb r3, r5, r9 \n\ ++ addlik r4, r4, -1 \n\ ++ addlik r9, r9, 1 /* delay slot */\n\ ++ beaneid r4, cpy_bytes \n\ ++ nop \n\ ++cpy_null: \n\ ++ orl r3, r0, r5 /* Return strcpy result */\n\ ++ rtsd r15, 8 \n\ ++ nop \n\ ++try_align_args: \n\ ++ xorl r7, r4, r3 \n\ ++ beanei r7, regular_strcpy /* cannot align args */\n\ ++ rsublik r10, r3, 4 /* Number of initial bytes to align */\n\ ++align_loop: \n\ ++ lbu r3, r6, r9 \n\ ++ sb r3, r5, r9 \n\ ++ addlik r10, r10, -1 \n\ ++ beaeqid r3, end_cpy /* Break if we have seen null character */\n\ ++ nop \n\ ++ addlik r9, r9, 1 \n\ ++ beaneid r10, align_loop \n\ ++ nop \n\ ++ breai cpy_loop \n\ ++regular_strcpy: \n\ ++ lbu r3, r6, r9 \n\ ++ sb r3, r5, r9 \n\ ++ addlik r9, r9, 1 \n\ ++ beaneid r3, regular_strcpy \n\ ++ nop \n\ ++end_cpy: \n\ ++ orl r3, r0, r5 \n\ ++ rtsd r15, 8 \n\ ++ nop /* Return strcpy result */"); ++ ++#else + + asm volatile (" \n\ + or r9, r0, r0 /* Index register */ \n\ +@@ -171,6 +227,7 @@ regular_strcpy: \n\ + end_cpy: \n\ + rtsd r15, 8 \n\ + or r3, r0, r5 /* Return strcpy result */"); ++#endif + #endif /* ! HAVE_HW_PCMP */ + } + +diff --git a/newlib/libc/machine/microblaze/strlen.c b/newlib/libc/machine/microblaze/strlen.c +index acb4464bc..b6f2d3c13 100644 +--- a/newlib/libc/machine/microblaze/strlen.c ++++ b/newlib/libc/machine/microblaze/strlen.c +@@ -116,6 +116,43 @@ strlen (const char *str) + + #include "mb_endian.h" + ++#ifdef __arch64__ ++ asm volatile (" \n\ ++ orl r9, r0, r0 /* Index register */ \n\ ++check_alignment: \n\ ++ andli r3, r5, 3 \n\ ++ beanei r3, align_arg \n\ ++len_loop: \n" ++ LOAD4BYTES("r3", "r5", "r9") ++" \n\ ++ pcmplbf r4, r3, r0 \n\ ++ beanei r4, end_len \n\ ++ addlik r9, r9, 4 \n\ ++ breaid len_loop \n\ ++ nop \n\ ++end_len: \n\ ++ lbu r3, r5, r9 \n\ ++ beaeqi r3, done_len \n\ ++ addlik r9, r9, 1 \n\ ++ breaid end_len \n\ ++ nop \n\ ++done_len: \n\ ++ orl r3, r0, r9 /* Return len */ \n\ ++ rtsd r15, 8 \n\ ++ nop \n\ ++align_arg: \n\ ++ rsublik r10, r3, 4 \n\ ++align_loop: \n\ ++ lbu r3, r5, r9 \n\ ++ addlik r10, r10, -1 \n\ ++ beaeqid r3, done_len \n\ ++ nop \n\ ++ addlik r9, r9, 1 \n\ ++ beaneid r10, align_loop \n\ ++ nop \n\ ++ breai len_loop"); ++ ++#else + asm volatile (" \n\ + or r9, r0, r0 /* Index register */ \n\ + check_alignment: \n\ +@@ -146,5 +183,6 @@ align_loop: \n\ + addik r9, r9, 1 \n\ + bri len_loop"); + ++#endif + #endif /* ! HAVE_HW_PCMP */ + } +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-core/newlib/files/0010-Patch-MicroBlaze-Removing-the-Assembly-implementatio.patch b/meta-microblaze/recipes-core/newlib/files/0010-Patch-MicroBlaze-Removing-the-Assembly-implementatio.patch new file mode 100644 index 00000000..aaa2a009 --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/files/0010-Patch-MicroBlaze-Removing-the-Assembly-implementatio.patch @@ -0,0 +1,341 @@ +From 6b8e5c7a773de4609f9c855aa714eca5a3f8b4ab Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 9 Nov 2021 22:53:44 +0530 +Subject: [PATCH 10/11] [Patch,MicroBlaze] : Removing the Assembly + implementation of 64bit string function. + +Revisit in next release and fix it + +Upstream-Status: Pending +--- + newlib/libc/machine/microblaze/mb_endian.h | 4 + + newlib/libc/machine/microblaze/strcmp.c | 95 ++++++++-------------- + newlib/libc/machine/microblaze/strcpy.c | 82 ++++++------------- + newlib/libc/machine/microblaze/strlen.c | 59 +++++--------- + 4 files changed, 82 insertions(+), 158 deletions(-) + +diff --git a/newlib/libc/machine/microblaze/mb_endian.h b/newlib/libc/machine/microblaze/mb_endian.h +index fb217ec85..17772c88f 100644 +--- a/newlib/libc/machine/microblaze/mb_endian.h ++++ b/newlib/libc/machine/microblaze/mb_endian.h +@@ -8,8 +8,12 @@ + #ifdef __LITTLE_ENDIAN__ + #define LOAD4BYTES(rD,rA,rB) "\tlwr\t" rD ", " rA ", " rB "\n" + #define STORE4BYTES(rD,rA,rB) "\tswr\t" rD ", " rA ", " rB "\n" ++#define LOAD8BYTES(rD,rA,rB) "\tllr\t" rD ", " rA ", " rB "\n" ++#define STORE8BYTES(rD,rA,rB) "\tslr\t" rD ", " rA ", " rB "\n" + #else + #define LOAD4BYTES(rD,rA,rB) "\tlw\t" rD ", " rA ", " rB "\n" + #define STORE4BYTES(rD,rA,rB) "\tsw\t" rD ", " rA ", " rB "\n" ++#define LOAD8BYTES(rD,rA,rB) "\tll\t" rD ", " rA ", " rB "\n" ++#define STORE8BYTES(rD,rA,rB) "\tsl\t" rD ", " rA ", " rB "\n" + #endif + #endif +diff --git a/newlib/libc/machine/microblaze/strcmp.c b/newlib/libc/machine/microblaze/strcmp.c +index 2cfef7388..e34c64a0c 100644 +--- a/newlib/libc/machine/microblaze/strcmp.c ++++ b/newlib/libc/machine/microblaze/strcmp.c +@@ -129,70 +129,42 @@ strcmp (const char *s1, + return (*(unsigned char *) s1) - (*(unsigned char *) s2); + #endif /* not PREFER_SIZE_OVER_SPEED */ + ++#elif __arch64__ ++ unsigned int *a1; ++ unsigned int *a2; ++ ++ /* If s1 or s2 are unaligned, then compare bytes. */ ++ if (!UNALIGNED (s1, s2)) ++ { ++ /* If s1 and s2 are word-aligned, compare them a word at a time. */ ++ a1 = (unsigned int*)s1; ++ a2 = (unsigned int*)s2; ++ while (*a1 == *a2) ++ { ++ /* To get here, *a1 == *a2, thus if we find a null in *a1, ++ then the strings must be equal, so return zero. */ ++ if (DETECTNULL (*a1)) ++ return 0; ++ ++ a1++; ++ a2++; ++ } ++ ++ /* A difference was detected in last few bytes of s1, so search bytewise */ ++ s1 = (char*)a1; ++ s2 = (char*)a2; ++ } ++ ++ while (*s1 != '\0' && *s1 == *s2) ++ { ++ s1++; ++ s2++; ++ } ++ return (*(unsigned char *) s1) - (*(unsigned char *) s2); + #else + + #include "mb_endian.h" + +-#ifdef __arch64__ +- asm volatile (" \n\ +- orl r9, r0, r0 /* Index register */ \n\ +-check_alignment: \n\ +- andli r3, r5, 3 \n\ +- andli r4, r6, 3 \n\ +- beanei r3, try_align_args \n\ +- beanei r4, regular_strcmp /* At this point we don't have a choice */ \n\ +-cmp_loop: \n" +- LOAD4BYTES("r3", "r5", "r9") +- LOAD4BYTES("r4", "r6", "r9") +-" \n\ +- pcmplbf r7, r3, r0 /* See if there is Null byte */ \n\ +- beanei r7, end_cmp_loop /* IF yes (r7 > 0) use byte compares in end_cmp_loop */ \n\ +- cmplu r7, r4, r3 /* ELSE compare whole word */ \n\ +- beanei r7, end_cmp \n\ +- addlik r9, r9, 4 /* delay slot */ \n\ +- breaid cmp_loop \n\ +- nop /* delay slot */ \n\ +-end_cmp_loop: \n\ +- lbu r3, r5, r9 /* byte compare loop */ \n\ +- lbu r4, r6, r9 \n\ +- cmplu r7, r4, r3 /* Compare bytes */ \n\ +- beanei r7, end_cmp_early \n\ +- addlik r9, r9, 1 /* delay slot */ \n\ +- beaneid r3, end_cmp_loop /* If reached null on one string, terminate */ \n\ +- nop \n\ +-end_cmp_early: \n\ +- orl r3, r0, r7 /* delay slot */ \n\ +- rtsd r15, 8 \n\ +- nop \n\ +-try_align_args: \n\ +- xorl r7, r4, r3 \n\ +- beanei r7, regular_strcmp /* cannot align args */ \n\ +- rsublik r10, r3, 4 /* Number of initial bytes to align */ \n\ +-align_loop: \n\ +- lbu r3, r5, r9 \n\ +- lbu r4, r6, r9 \n\ +- cmplu r7, r4, r3 \n\ +- beanei r7, end_cmp \n\ +- beaeqi r3, end_cmp \n\ +- addlik r10, r10, -1 \n\ +- addlik r9, r9, 1 \n\ +- beaeqid r10, cmp_loop \n\ +- nop \n\ +- breai align_loop \n\ +-regular_strcmp: \n\ +- lbu r3, r5, r9 \n\ +- lbu r4, r6, r9 \n\ +- cmplu r7, r4, r3 \n\ +- beanei r7, end_cmp \n\ +- beaeqi r3, end_cmp \n\ +- addlik r9, r9, 1 \n\ +- breaid regular_strcmp \n\ +- nop \n\ +-end_cmp: \n\ +- orl r3, r0, r7 \n\ +- rtsd r15, 8 \n\ +- nop /* Return strcmp result */"); +-#else + asm volatile (" \n\ + or r9, r0, r0 /* Index register */\n\ + check_alignment: \n\ +@@ -241,12 +213,11 @@ regular_strcmp: + bnei r7, end_cmp \n\ + beqi r3, end_cmp \n\ + brid regular_strcmp \n\ +- addik r9, r9, 1 ++ addik r9, r9, 1 \n\ + end_cmp: \n\ + rtsd r15, 8 \n\ + or r3, r0, r7 /* Return strcmp result */"); + +-#endif + #endif /* ! HAVE_HW_PCMP */ + } + +diff --git a/newlib/libc/machine/microblaze/strcpy.c b/newlib/libc/machine/microblaze/strcpy.c +index 6dbc60d77..ddb69227e 100644 +--- a/newlib/libc/machine/microblaze/strcpy.c ++++ b/newlib/libc/machine/microblaze/strcpy.c +@@ -121,67 +121,36 @@ strcpy (char *__restrict dst0, + ; + return dst0; + #endif /* not PREFER_SIZE_OVER_SPEED */ ++#elif __arch64__ ++ char *dst = dst0; ++ const char *src = src0; ++ long *aligned_dst; ++ const long *aligned_src; + +-#else ++ /* If SRC or DEST is unaligned, then copy bytes. */ ++ if (!UNALIGNED (src, dst)) ++ { ++ aligned_dst = (long*)dst; ++ aligned_src = (long*)src; + +-#include "mb_endian.h" +-#ifdef __arch64__ ++ /* SRC and DEST are both "long int" aligned, try to do "long int" ++ sized copies. */ ++ while (!DETECTNULL(*aligned_src)) ++ { ++ *aligned_dst++ = *aligned_src++; ++ } + +- asm volatile (" \n\ +- orl r9, r0, r0 /* Index register */ \n\ +-check_alignment: \n\ +- andli r3, r5, 3 \n\ +- andli r4, r6, 3 \n\ +- beanei r3, try_align_args \n\ +- beanei r4, regular_strcpy /* At this point we dont have a choice */ \n\ +-cpy_loop: \n" +- LOAD4BYTES("r3", "r6", "r9") +-" \n\ +- pcmplbf r4, r0, r3 \n\ +- beanei r4, cpy_bytes /* If r4 != 0, then null present within string */\n" +- STORE4BYTES("r3", "r5", "r9") +-" \n\ +- addlik r9, r9, 4 \n\ +- breaid cpy_loop \n\ +- nop \n\ +-cpy_bytes: \n\ +- lbu r3, r6, r9 \n\ +- sb r3, r5, r9 \n\ +- addlik r4, r4, -1 \n\ +- addlik r9, r9, 1 /* delay slot */\n\ +- beaneid r4, cpy_bytes \n\ +- nop \n\ +-cpy_null: \n\ +- orl r3, r0, r5 /* Return strcpy result */\n\ +- rtsd r15, 8 \n\ +- nop \n\ +-try_align_args: \n\ +- xorl r7, r4, r3 \n\ +- beanei r7, regular_strcpy /* cannot align args */\n\ +- rsublik r10, r3, 4 /* Number of initial bytes to align */\n\ +-align_loop: \n\ +- lbu r3, r6, r9 \n\ +- sb r3, r5, r9 \n\ +- addlik r10, r10, -1 \n\ +- beaeqid r3, end_cpy /* Break if we have seen null character */\n\ +- nop \n\ +- addlik r9, r9, 1 \n\ +- beaneid r10, align_loop \n\ +- nop \n\ +- breai cpy_loop \n\ +-regular_strcpy: \n\ +- lbu r3, r6, r9 \n\ +- sb r3, r5, r9 \n\ +- addlik r9, r9, 1 \n\ +- beaneid r3, regular_strcpy \n\ +- nop \n\ +-end_cpy: \n\ +- orl r3, r0, r5 \n\ +- rtsd r15, 8 \n\ +- nop /* Return strcpy result */"); ++ dst = (char*)aligned_dst; ++ src = (char*)aligned_src; ++ } + +-#else ++ while (*dst++ = *src++) ++ ; ++ return dst0; ++ ++#else + ++#include "mb_endian.h" + asm volatile (" \n\ + or r9, r0, r0 /* Index register */ \n\ + check_alignment: \n\ +@@ -227,7 +196,6 @@ regular_strcpy: \n\ + end_cpy: \n\ + rtsd r15, 8 \n\ + or r3, r0, r5 /* Return strcpy result */"); +-#endif + #endif /* ! HAVE_HW_PCMP */ + } + +diff --git a/newlib/libc/machine/microblaze/strlen.c b/newlib/libc/machine/microblaze/strlen.c +index b6f2d3c13..940753996 100644 +--- a/newlib/libc/machine/microblaze/strlen.c ++++ b/newlib/libc/machine/microblaze/strlen.c +@@ -112,47 +112,29 @@ strlen (const char *str) + return str - start; + #endif /* not PREFER_SIZE_OVER_SPEED */ + +-#else +- +-#include "mb_endian.h" ++#elif __arch64__ ++ const char *start = str; ++ unsigned long *aligned_addr; + +-#ifdef __arch64__ +- asm volatile (" \n\ +- orl r9, r0, r0 /* Index register */ \n\ +-check_alignment: \n\ +- andli r3, r5, 3 \n\ +- beanei r3, align_arg \n\ +-len_loop: \n" +- LOAD4BYTES("r3", "r5", "r9") +-" \n\ +- pcmplbf r4, r3, r0 \n\ +- beanei r4, end_len \n\ +- addlik r9, r9, 4 \n\ +- breaid len_loop \n\ +- nop \n\ +-end_len: \n\ +- lbu r3, r5, r9 \n\ +- beaeqi r3, done_len \n\ +- addlik r9, r9, 1 \n\ +- breaid end_len \n\ +- nop \n\ +-done_len: \n\ +- orl r3, r0, r9 /* Return len */ \n\ +- rtsd r15, 8 \n\ +- nop \n\ +-align_arg: \n\ +- rsublik r10, r3, 4 \n\ +-align_loop: \n\ +- lbu r3, r5, r9 \n\ +- addlik r10, r10, -1 \n\ +- beaeqid r3, done_len \n\ +- nop \n\ +- addlik r9, r9, 1 \n\ +- beaneid r10, align_loop \n\ +- nop \n\ +- breai len_loop"); ++ if (!UNALIGNED (str)) ++ { ++ /* If the string is word-aligned, we can check for the presence of ++ a null in each word-sized block. */ ++ aligned_addr = (unsigned long*)str; ++ while (!DETECTNULL (*aligned_addr)) ++ aligned_addr++; + ++ /* Once a null is detected, we check each byte in that block for a ++ precise position of the null. */ ++ str = (char*)aligned_addr; ++ } ++ ++ while (*str) ++ str++; ++ return str - start; + #else ++ ++#include "mb_endian.h" + asm volatile (" \n\ + or r9, r0, r0 /* Index register */ \n\ + check_alignment: \n\ +@@ -183,6 +165,5 @@ align_loop: \n\ + addik r9, r9, 1 \n\ + bri len_loop"); + +-#endif + #endif /* ! HAVE_HW_PCMP */ + } +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-core/newlib/files/0011-Fixed-the-bug-in-crtinit.s-for-MB-64.patch b/meta-microblaze/recipes-core/newlib/files/0011-Fixed-the-bug-in-crtinit.s-for-MB-64.patch new file mode 100644 index 00000000..5e89db18 --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/files/0011-Fixed-the-bug-in-crtinit.s-for-MB-64.patch @@ -0,0 +1,27 @@ +From bab2eafd2d4ca1f2caacd50120e8ac94aca1b7c4 Mon Sep 17 00:00:00 2001 +From: Nagaraju <nmekala@xilinx.com> +Date: Tue, 14 Jan 2020 22:32:30 +0530 +Subject: [PATCH 11/11] Fixed the bug in crtinit.s for MB-64 + +Upstream-Status: Pending + +--- + libgloss/microblaze/crtinit.S | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libgloss/microblaze/crtinit.S b/libgloss/microblaze/crtinit.S +index 854117536..f79140734 100644 +--- a/libgloss/microblaze/crtinit.S ++++ b/libgloss/microblaze/crtinit.S +@@ -48,7 +48,7 @@ _crtinit: + + .Lloopsbss: + sli r0, r6, 0 +- addli r6, r6, 4 ++ addli r6, r6, 8 + rsubl r18, r6, r7 + beagti r18, .Lloopsbss + .Lendsbss: +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-core/newlib/libgloss_%.bbappend b/meta-microblaze/recipes-core/newlib/libgloss_%.bbappend new file mode 100644 index 00000000..15be1732 --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/libgloss_%.bbappend @@ -0,0 +1,13 @@ +require microblaze-newlib.inc + +do_configure:prepend:microblaze() { + # hack for microblaze, which needs xilinx.ld to literally do any linking (its hard coded in its LINK_SPEC) + export CC="${CC} -L${S}/libgloss/microblaze" +} + +# Libgloss provides various .o files in libdir +# These must NOT be stripped, but for some reason they are installed +x +# which triggers them to be stripped. +do_install:append:microblaze() { + chmod 0644 ${D}${libdir}/*.o +} diff --git a/meta-microblaze/recipes-core/newlib/microblaze-newlib.inc b/meta-microblaze/recipes-core/newlib/microblaze-newlib.inc new file mode 100644 index 00000000..a1e3b92f --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/microblaze-newlib.inc @@ -0,0 +1,19 @@ +# Add MicroBlaze Patches +FILESEXTRAPATHS:append:microblaze := ":${THISDIR}/files" +SRC_URI:append:microblaze = " \ + file://0001-Patch-microblaze-Add-config-microblaze.mt-for-target.patch \ + file://0002-Patch-microblaze-Modified-_exceptional_handler.patch \ + file://0003-LOCAL-Add-missing-declarations-for-xil_printf-to-std.patch \ + file://0004-Local-deleting-the-xil_printf.c-file-as-now-it-part-.patch \ + file://0005-Local-deleting-the-xil_printf.o-from-MAKEFILE.patch \ + file://0006-MB-X-intial-commit.patch \ + file://0007-Patch-Microblaze-newlib-port-for-microblaze-m64-flag.patch \ + file://0008-fixing-the-bug-in-crt-files-added-addlik-instead-of-.patch \ + file://0009-Patch-MicroBlaze-Added-MB-64-support-to-strcmp-strcp.patch \ + file://0010-Patch-MicroBlaze-Removing-the-Assembly-implementatio.patch \ + file://0011-Fixed-the-bug-in-crtinit.s-for-MB-64.patch \ + " + +EXTRA_OECONF:append:xilinx-standalone:microblaze = " \ + --disable-newlib-reent-check-verify \ +" diff --git a/meta-microblaze/recipes-core/newlib/newlib_%.bbappend b/meta-microblaze/recipes-core/newlib/newlib_%.bbappend new file mode 100644 index 00000000..d30e61ec --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/newlib_%.bbappend @@ -0,0 +1,7 @@ +require microblaze-newlib.inc + +do_configure:prepend:microblaze() { + # hack for microblaze, which needs xilinx.ld to literally do any linking (its hard coded in its LINK_SPEC) + export CC="${CC} -L${S}/libgloss/microblaze" +} + diff --git a/meta-microblaze/recipes-core/packagegroups/packagegroup-core-tools-testapps.bbappend b/meta-microblaze/recipes-core/packagegroups/packagegroup-core-tools-testapps.bbappend new file mode 100644 index 00000000..8be39fe2 --- /dev/null +++ b/meta-microblaze/recipes-core/packagegroups/packagegroup-core-tools-testapps.bbappend @@ -0,0 +1,15 @@ +GOTOOLS:microblaze ?= "" +RUSTTOOLS:microblaze ?= "" +GSTEXAMPLES:microblaze ?= "" +X11GLTOOLS:microblaze ?= "" +3GTOOLS:microblaze ?= "" +KEXECTOOLS:microblaze = "" + +RDEPENDS:${PN}:remove:microblaze = "\ +alsa-utils-amixer \ +alsa-utils-aplay \ +ltp \ +connman-tools \ +connman-tests \ +connman-client \ +" diff --git a/meta-microblaze/recipes-core/systemd/files/0001-architecture-Add-Microblaze-architecture-to-systemd-.patch b/meta-microblaze/recipes-core/systemd/files/0001-architecture-Add-Microblaze-architecture-to-systemd-.patch new file mode 100644 index 00000000..88373e2b --- /dev/null +++ b/meta-microblaze/recipes-core/systemd/files/0001-architecture-Add-Microblaze-architecture-to-systemd-.patch @@ -0,0 +1,70 @@ +From 5c3f3f1b1b50d1e2a1a141943b94f08f19f59b6d Mon Sep 17 00:00:00 2001 +From: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com> +Date: Sun, 11 Apr 2021 20:04:06 -0700 +Subject: [PATCH] Add systemd support for microblaze architecture + +Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com> + +Applied to current version of systemd +Reworked to split microblaze and microblazeel + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> +--- + src/basic/architecture.c | 3 +++ + src/basic/architecture.h | 4 ++++ + 2 files changed, 7 insertions(+) + +Index: git/src/basic/architecture.c +=================================================================== +--- git.orig/src/basic/architecture.c ++++ git/src/basic/architecture.c +@@ -49,6 +49,10 @@ Architecture uname_architecture(void) { + #elif defined(__alpha__) + { "alpha" , ARCHITECTURE_ALPHA }, + ++#elif defined(__microblaze__) ++ { "microblaze", ARCHITECTURE_MICROBLAZE }, ++ { "microblazeel", ARCHITECTURE_MICROBLAZE_LE }, ++ + #elif defined(__arc__) + { "arc", ARCHITECTURE_ARC }, + { "arceb", ARCHITECTURE_ARC_BE }, +@@ -147,6 +151,8 @@ static const char *const architecture_ta + [ARCHITECTURE_ALPHA] = "alpha", + [ARCHITECTURE_ARC] = "arc", + [ARCHITECTURE_ARC_BE] = "arc-be", ++ [ARCHITECTURE_MICROBLAZE] = "microblaze", ++ [ARCHITECTURE_MICROBLAZE_LE] = "microblazeel", + [ARCHITECTURE_CRIS] = "cris", + [ARCHITECTURE_X86_64] = "x86-64", + [ARCHITECTURE_X86] = "x86", +Index: git/src/basic/architecture.h +=================================================================== +--- git.orig/src/basic/architecture.h ++++ git/src/basic/architecture.h +@@ -22,6 +22,8 @@ typedef enum { + ARCHITECTURE_IA64, + ARCHITECTURE_LOONGARCH64, + ARCHITECTURE_M68K, ++ ARCHITECTURE_MICROBLAZE, ++ ARCHITECTURE_MICROBLAZE_LE, + ARCHITECTURE_MIPS, + ARCHITECTURE_MIPS64, + ARCHITECTURE_MIPS64_LE, +@@ -239,6 +241,14 @@ Architecture uname_architecture(void); + # define native_architecture() ARCHITECTURE_ARC + # define LIB_ARCH_TUPLE "arc-linux" + # endif ++#elif defined(__microblaze__) ++# if __BYTE_ORDER == __BIG_ENDIAN ++# define native_architecture() ARCHITECTURE_MICROBLAZE ++# define LIB_ARCH_TUPLE "microblaze-linux" ++# else ++# define native_architecture() ARCHITECTURE_MICROBLAZE_LE ++# define LIB_ARCH_TUPLE "microblazeel-linux" ++# endif + #else + # error "Please register your architecture here!" + #endif diff --git a/meta-microblaze/recipes-core/systemd/files/microblaze-disable-stack-protector.patch b/meta-microblaze/recipes-core/systemd/files/microblaze-disable-stack-protector.patch new file mode 100644 index 00000000..157b008a --- /dev/null +++ b/meta-microblaze/recipes-core/systemd/files/microblaze-disable-stack-protector.patch @@ -0,0 +1,37 @@ +From ec286a0b613a9fa487be75b7c1c01e5c8ce62a1a Mon Sep 17 00:00:00 2001 +From: Mark Hatle <mark.hatle@amd.com> +Date: Fri, 22 Sep 2023 11:01:16 -0600 +Subject: [PATCH] meson.build: Microblaze does not support stack-protector + +| cc1: warning: '-fstack-protector' not supported for this target +| ninja: build stopped: subcommand failed. + +Upstream-Status: Inappropriate [Configuration] + +Signed-off-by: Mark Hatle <mark.hatle@xilinx.com> +--- + meson.build | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/meson.build b/meson.build +index 395eca1943..8b87c5b3a2 100644 +--- a/meson.build ++++ b/meson.build +@@ -405,14 +405,11 @@ possible_common_cc_flags = [ + + '-fdiagnostics-show-option', + '-fno-common', +- '-fstack-protector', +- '-fstack-protector-strong', + '-fstrict-flex-arrays', + '--param=ssp-buffer-size=4', + ] + + possible_common_link_flags = [ +- '-fstack-protector', + ] + + c_args = get_option('c_args') +-- +2.34.1 + diff --git a/meta-microblaze/recipes-core/systemd/files/microblaze-once-macro.patch b/meta-microblaze/recipes-core/systemd/files/microblaze-once-macro.patch new file mode 100644 index 00000000..3862803b --- /dev/null +++ b/meta-microblaze/recipes-core/systemd/files/microblaze-once-macro.patch @@ -0,0 +1,56 @@ +From 239d51b5b02ba766f34b3fce9803f8fd13097471 Mon Sep 17 00:00:00 2001 +From: Mark Hatle <mark.hatle@amd.com> +Date: Fri, 22 Sep 2023 11:09:50 -0600 +Subject: [PATCH] macro-funcamental.h: Microblaze does not have atomic + functions + +For some reason the systemd developers decided that needed to hardcode +the usage of __atomic_exchange functions, however not all architectures +define this. Microblaze is one such architecture, so we fall back to +a less safe way of doing the same thing. A quick inspection of +the ONCE users show that even if we end up with a race condition the +worst expected behavior could be multiple log messages. + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> +--- + src/fundamental/macro-fundamental.h | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/src/fundamental/macro-fundamental.h b/src/fundamental/macro-fundamental.h +index 1d49765fce..f45f55cdfe 100644 +--- a/src/fundamental/macro-fundamental.h ++++ b/src/fundamental/macro-fundamental.h +@@ -116,11 +116,28 @@ + * on this macro will run concurrently to all other code conditionalized + * the same way, there's no ordering or completion enforced. */ + #define ONCE __ONCE(UNIQ_T(_once_, UNIQ)) ++#if !defined (__microblaze__) + #define __ONCE(o) \ + ({ \ + static bool (o) = false; \ + __atomic_exchange_n(&(o), true, __ATOMIC_SEQ_CST); \ + }) ++#else ++ /* Microblaze does not contain __atomic_exchange_n*, so we do it ++ * the old fashioned way. Note, it's possible that ONCE may run more ++ * then ONCE due to possible races, however it is not expected to cause ++ * an issue with systemd usage. */ ++#define __ONCE(o) \ ++ ({ \ ++ static bool (o) = false; \ ++ bool rc = false; \ ++ if ((o) == false) { \ ++ (o) = true; \ ++ rc = true; \ ++ } \ ++ rc; \ ++ }) ++#endif + + #undef MAX + #define MAX(a, b) __MAX(UNIQ, (a), UNIQ, (b)) +-- +2.34.1 + diff --git a/meta-microblaze/recipes-core/systemd/files/microblaze-syscalls.patch b/meta-microblaze/recipes-core/systemd/files/microblaze-syscalls.patch new file mode 100644 index 00000000..75e0300b --- /dev/null +++ b/meta-microblaze/recipes-core/systemd/files/microblaze-syscalls.patch @@ -0,0 +1,804 @@ +From 2bd273c3a474b04b60c08c98fb7859fce28eac6d Mon Sep 17 00:00:00 2001 +From: Mark Hatle <mark.hatle@amd.com> +Date: Fri, 22 Sep 2023 10:26:47 -0600 +Subject: [PATCH] syscalls-microblaze.txt: Add microblaze syscalls to systemd + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> +--- + src/basic/meson.build | 1 + + src/basic/missing_syscall_def.h | 33 ++ + src/basic/missing_syscalls.py | 2 + + src/basic/syscalls-microblaze.txt | 598 ++++++++++++++++++++++++++++++ + 4 files changed, 634 insertions(+) + create mode 100644 src/basic/syscalls-microblaze.txt + +diff --git a/src/basic/meson.build b/src/basic/meson.build +index 3af013b014..e77f7cef16 100644 +--- a/src/basic/meson.build ++++ b/src/basic/meson.build +@@ -190,6 +190,7 @@ arch_list = [ + 'ia64', + 'loongarch64', + 'm68k', ++ 'microblaze', + 'mips64', + 'mips64n32', + 'mipso32', +diff --git a/src/basic/missing_syscall_def.h b/src/basic/missing_syscall_def.h +index 402fdd00dc..94f41c1522 100644 +--- a/src/basic/missing_syscall_def.h ++++ b/src/basic/missing_syscall_def.h +@@ -16,6 +16,7 @@ + # elif defined(__ia64__) + # elif defined(__loongarch64) + # elif defined(__m68k__) ++# elif defined(__microblaze__) + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # elif _MIPS_SIM == _MIPS_SIM_NABI32 +@@ -59,6 +60,8 @@ + # define systemd_NR_bpf 280 + # elif defined(__m68k__) + # define systemd_NR_bpf 354 ++# elif defined(__microblaze__) ++# define systemd_NR_bpf 387 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_bpf 4355 +@@ -127,6 +130,8 @@ assert_cc(__NR_bpf == systemd_NR_bpf); + # define systemd_NR_close_range 436 + # elif defined(__m68k__) + # define systemd_NR_close_range 436 ++# elif defined(__microblaze__) ++# define systemd_NR_close_range 436 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_close_range 4436 +@@ -195,6 +200,8 @@ assert_cc(__NR_close_range == systemd_NR_close_range); + # define systemd_NR_copy_file_range 285 + # elif defined(__m68k__) + # define systemd_NR_copy_file_range 376 ++# elif defined(__microblaze__) ++# define systemd_NR_copy_file_range 392 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_copy_file_range 4360 +@@ -263,6 +270,8 @@ assert_cc(__NR_copy_file_range == systemd_NR_copy_file_range); + # define systemd_NR_getrandom 278 + # elif defined(__m68k__) + # define systemd_NR_getrandom 352 ++# elif defined(__microblaze__) ++# define systemd_NR_getrandom 385 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_getrandom 4353 +@@ -331,6 +340,8 @@ assert_cc(__NR_getrandom == systemd_NR_getrandom); + # define systemd_NR_memfd_create 279 + # elif defined(__m68k__) + # define systemd_NR_memfd_create 353 ++# elif defined(__microblaze__) ++# define systemd_NR_memfd_create 386 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_memfd_create 4354 +@@ -399,6 +410,8 @@ assert_cc(__NR_memfd_create == systemd_NR_memfd_create); + # define systemd_NR_mount_setattr 442 + # elif defined(__m68k__) + # define systemd_NR_mount_setattr 442 ++# elif defined(__microblaze__) ++# define systemd_NR_mount_setattr 442 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_mount_setattr 4442 +@@ -467,6 +480,8 @@ assert_cc(__NR_mount_setattr == systemd_NR_mount_setattr); + # define systemd_NR_move_mount 429 + # elif defined(__m68k__) + # define systemd_NR_move_mount 429 ++# elif defined(__microblaze__) ++# define systemd_NR_move_mount 429 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_move_mount 4429 +@@ -535,6 +550,8 @@ assert_cc(__NR_move_mount == systemd_NR_move_mount); + # define systemd_NR_name_to_handle_at 264 + # elif defined(__m68k__) + # define systemd_NR_name_to_handle_at 340 ++# elif defined(__microblaze__) ++# define systemd_NR_name_to_handle_at 371 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_name_to_handle_at 4339 +@@ -603,6 +620,8 @@ assert_cc(__NR_name_to_handle_at == systemd_NR_name_to_handle_at); + # define systemd_NR_open_tree 428 + # elif defined(__m68k__) + # define systemd_NR_open_tree 428 ++# elif defined(__microblaze__) ++# define systemd_NR_open_tree 428 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_open_tree 4428 +@@ -671,6 +690,8 @@ assert_cc(__NR_open_tree == systemd_NR_open_tree); + # define systemd_NR_openat2 437 + # elif defined(__m68k__) + # define systemd_NR_openat2 437 ++# elif defined(__microblaze__) ++# define systemd_NR_openat2 437 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_openat2 4437 +@@ -739,6 +760,8 @@ assert_cc(__NR_openat2 == systemd_NR_openat2); + # define systemd_NR_pidfd_open 434 + # elif defined(__m68k__) + # define systemd_NR_pidfd_open 434 ++# elif defined(__microblaze__) ++# define systemd_NR_pidfd_open 434 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_pidfd_open 4434 +@@ -807,6 +830,8 @@ assert_cc(__NR_pidfd_open == systemd_NR_pidfd_open); + # define systemd_NR_pidfd_send_signal 424 + # elif defined(__m68k__) + # define systemd_NR_pidfd_send_signal 424 ++# elif defined(__microblaze__) ++# define systemd_NR_pidfd_send_signal 424 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_pidfd_send_signal 4424 +@@ -875,6 +900,8 @@ assert_cc(__NR_pidfd_send_signal == systemd_NR_pidfd_send_signal); + # define systemd_NR_pkey_mprotect 288 + # elif defined(__m68k__) + # define systemd_NR_pkey_mprotect 381 ++# elif defined(__microblaze__) ++# define systemd_NR_pkey_mprotect 395 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_pkey_mprotect 4363 +@@ -943,6 +970,8 @@ assert_cc(__NR_pkey_mprotect == systemd_NR_pkey_mprotect); + # define systemd_NR_renameat2 276 + # elif defined(__m68k__) + # define systemd_NR_renameat2 351 ++# elif defined(__microblaze__) ++# define systemd_NR_renameat2 383 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_renameat2 4351 +@@ -1011,6 +1040,8 @@ assert_cc(__NR_renameat2 == systemd_NR_renameat2); + # define systemd_NR_setns 268 + # elif defined(__m68k__) + # define systemd_NR_setns 344 ++# elif defined(__microblaze__) ++# define systemd_NR_setns 375 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_setns 4344 +@@ -1079,6 +1110,8 @@ assert_cc(__NR_setns == systemd_NR_setns); + # define systemd_NR_statx 291 + # elif defined(__m68k__) + # define systemd_NR_statx 379 ++# elif defined(__microblaze__) ++# define systemd_NR_statx 398 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_statx 4366 +diff --git a/src/basic/missing_syscalls.py b/src/basic/missing_syscalls.py +index 5ccf02adec..e09023abe1 100644 +--- a/src/basic/missing_syscalls.py ++++ b/src/basic/missing_syscalls.py +@@ -63,6 +63,8 @@ DEF_TEMPLATE_B = '''\ + # define systemd_NR_{syscall} {nr_loongarch64} + # elif defined(__m68k__) + # define systemd_NR_{syscall} {nr_m68k} ++# elif defined(__microblaze__) ++# define systemd_NR_{syscall} {nr_microblaze} + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_{syscall} {nr_mipso32} +diff --git a/src/basic/syscalls-microblaze.txt b/src/basic/syscalls-microblaze.txt +new file mode 100644 +index 0000000000..3fc4cd6aef +--- /dev/null ++++ b/src/basic/syscalls-microblaze.txt +@@ -0,0 +1,598 @@ ++_llseek 140 ++_newselect 142 ++_sysctl 149 ++accept 349 ++accept4 362 ++access 33 ++acct 51 ++add_key 286 ++adjtimex 124 ++alarm 27 ++arc_gettls ++arc_settls ++arc_usr_cmpxchg ++arch_prctl ++arm_fadvise64_64 ++atomic_barrier ++atomic_cmpxchg_32 ++bdflush 134 ++bind 347 ++bpf 387 ++brk 45 ++cachectl ++cacheflush ++capget 184 ++capset 185 ++chdir 12 ++chmod 15 ++chown 182 ++chown32 212 ++chroot 61 ++clock_adjtime 373 ++clock_adjtime64 405 ++clock_getres 266 ++clock_getres_time64 406 ++clock_gettime 265 ++clock_gettime64 403 ++clock_nanosleep 267 ++clock_nanosleep_time64 407 ++clock_settime 264 ++clock_settime64 404 ++clone 120 ++clone2 ++clone3 435 ++close 6 ++close_range 436 ++connect 350 ++copy_file_range 392 ++creat 8 ++create_module 127 ++delete_module 129 ++dipc ++dup 41 ++dup2 63 ++dup3 342 ++epoll_create 254 ++epoll_create1 341 ++epoll_ctl 255 ++epoll_ctl_old ++epoll_pwait 319 ++epoll_pwait2 441 ++epoll_wait 256 ++epoll_wait_old ++eventfd 323 ++eventfd2 340 ++exec_with_loader ++execv ++execve 11 ++execveat 388 ++exit 1 ++exit_group 252 ++faccessat 307 ++faccessat2 439 ++fadvise64 250 ++fadvise64_64 272 ++fallocate 324 ++fanotify_init 368 ++fanotify_mark 369 ++fchdir 133 ++fchmod 94 ++fchmodat 306 ++fchown 95 ++fchown32 207 ++fchownat 298 ++fcntl 55 ++fcntl64 221 ++fdatasync 148 ++fgetxattr 231 ++finit_module 380 ++flistxattr 234 ++flock 143 ++fork 2 ++fp_udfiex_crtl ++fremovexattr 237 ++fsconfig 431 ++fsetxattr 228 ++fsmount 432 ++fsopen 430 ++fspick 433 ++fstat 108 ++fstat64 197 ++fstatat64 300 ++fstatfs 100 ++fstatfs64 269 ++fsync 118 ++ftruncate 93 ++ftruncate64 194 ++futex 240 ++futex_time64 422 ++futimesat 299 ++get_kernel_syms 130 ++get_mempolicy 275 ++get_robust_list 312 ++get_thread_area 244 ++getcpu 318 ++getcwd 183 ++getdents 141 ++getdents64 220 ++getdomainname ++getdtablesize ++getegid 50 ++getegid32 202 ++geteuid 49 ++geteuid32 201 ++getgid 47 ++getgid32 200 ++getgroups 80 ++getgroups32 205 ++gethostname ++getitimer 105 ++getpagesize ++getpeername 352 ++getpgid 132 ++getpgrp 65 ++getpid 20 ++getpmsg 188 ++getppid 64 ++getpriority 96 ++getrandom 385 ++getresgid 171 ++getresgid32 211 ++getresuid 165 ++getresuid32 209 ++getrlimit 76 ++getrusage 77 ++getsid 147 ++getsockname 351 ++getsockopt 358 ++gettid 224 ++gettimeofday 78 ++getuid 24 ++getuid32 199 ++getunwind ++getxattr 229 ++getxgid ++getxpid ++getxuid ++idle 112 ++init_module 128 ++inotify_add_watch 292 ++inotify_init 291 ++inotify_init1 344 ++inotify_rm_watch 293 ++io_cancel 249 ++io_destroy 246 ++io_getevents 247 ++io_pgetevents 399 ++io_pgetevents_time64 416 ++io_setup 245 ++io_submit 248 ++io_uring_enter 426 ++io_uring_register 427 ++io_uring_setup 425 ++ioctl 54 ++ioperm 101 ++iopl 110 ++ioprio_get 290 ++ioprio_set 289 ++ipc 117 ++kcmp 379 ++kern_features ++kexec_file_load ++kexec_load 283 ++keyctl 288 ++kill 37 ++landlock_add_rule 445 ++landlock_create_ruleset 444 ++landlock_restrict_self 446 ++lchown 16 ++lchown32 198 ++lgetxattr 230 ++link 9 ++linkat 303 ++listen 348 ++listxattr 232 ++llistxattr 233 ++lookup_dcookie 253 ++lremovexattr 236 ++lseek 19 ++lsetxattr 227 ++lstat 107 ++lstat64 196 ++madvise 219 ++mbind 274 ++membarrier 390 ++memfd_create 386 ++memory_ordering ++migrate_pages 294 ++mincore 218 ++mkdir 39 ++mkdirat 296 ++mknod 14 ++mknodat 297 ++mlock 150 ++mlock2 391 ++mlockall 152 ++mmap 90 ++mmap2 192 ++modify_ldt 123 ++mount 21 ++mount_setattr 442 ++move_mount 429 ++move_pages 317 ++mprotect 125 ++mq_getsetattr 282 ++mq_notify 281 ++mq_open 277 ++mq_timedreceive 280 ++mq_timedreceive_time64 419 ++mq_timedsend 279 ++mq_timedsend_time64 418 ++mq_unlink 278 ++mremap 163 ++msgctl 331 ++msgget 332 ++msgrcv 333 ++msgsnd 334 ++msync 144 ++multiplexer ++munlock 151 ++munlockall 153 ++munmap 91 ++name_to_handle_at 371 ++nanosleep 162 ++newfstatat ++nfsservctl 169 ++nice 34 ++old_adjtimex ++old_getpagesize ++oldfstat 28 ++oldlstat 84 ++oldolduname 59 ++oldstat 18 ++oldumount ++olduname 109 ++open 5 ++open_by_handle_at 372 ++open_tree 428 ++openat 295 ++openat2 437 ++or1k_atomic ++osf_adjtime ++osf_afs_syscall ++osf_alt_plock ++osf_alt_setsid ++osf_alt_sigpending ++osf_asynch_daemon ++osf_audcntl ++osf_audgen ++osf_chflags ++osf_execve ++osf_exportfs ++osf_fchflags ++osf_fdatasync ++osf_fpathconf ++osf_fstat ++osf_fstatfs ++osf_fstatfs64 ++osf_fuser ++osf_getaddressconf ++osf_getdirentries ++osf_getdomainname ++osf_getfh ++osf_getfsstat ++osf_gethostid ++osf_getitimer ++osf_getlogin ++osf_getmnt ++osf_getrusage ++osf_getsysinfo ++osf_gettimeofday ++osf_kloadcall ++osf_kmodcall ++osf_lstat ++osf_memcntl ++osf_mincore ++osf_mount ++osf_mremap ++osf_msfs_syscall ++osf_msleep ++osf_mvalid ++osf_mwakeup ++osf_naccept ++osf_nfssvc ++osf_ngetpeername ++osf_ngetsockname ++osf_nrecvfrom ++osf_nrecvmsg ++osf_nsendmsg ++osf_ntp_adjtime ++osf_ntp_gettime ++osf_old_creat ++osf_old_fstat ++osf_old_getpgrp ++osf_old_killpg ++osf_old_lstat ++osf_old_open ++osf_old_sigaction ++osf_old_sigblock ++osf_old_sigreturn ++osf_old_sigsetmask ++osf_old_sigvec ++osf_old_stat ++osf_old_vadvise ++osf_old_vtrace ++osf_old_wait ++osf_oldquota ++osf_pathconf ++osf_pid_block ++osf_pid_unblock ++osf_plock ++osf_priocntlset ++osf_profil ++osf_proplist_syscall ++osf_reboot ++osf_revoke ++osf_sbrk ++osf_security ++osf_select ++osf_set_program_attributes ++osf_set_speculative ++osf_sethostid ++osf_setitimer ++osf_setlogin ++osf_setsysinfo ++osf_settimeofday ++osf_shmat ++osf_signal ++osf_sigprocmask ++osf_sigsendset ++osf_sigstack ++osf_sigwaitprim ++osf_sstk ++osf_stat ++osf_statfs ++osf_statfs64 ++osf_subsys_info ++osf_swapctl ++osf_swapon ++osf_syscall ++osf_sysinfo ++osf_table ++osf_uadmin ++osf_usleep_thread ++osf_uswitch ++osf_utc_adjtime ++osf_utc_gettime ++osf_utimes ++osf_utsname ++osf_wait4 ++osf_waitid ++pause 29 ++pciconfig_iobase ++pciconfig_read ++pciconfig_write ++perf_event_open 366 ++perfctr ++perfmonctl ++personality 136 ++pidfd_getfd 438 ++pidfd_open 434 ++pidfd_send_signal 424 ++pipe 42 ++pipe2 343 ++pivot_root 217 ++pkey_alloc 396 ++pkey_free 397 ++pkey_mprotect 395 ++poll 168 ++ppoll 309 ++ppoll_time64 414 ++prctl 172 ++pread64 180 ++preadv 363 ++preadv2 393 ++prlimit64 370 ++process_madvise 440 ++process_vm_readv 377 ++process_vm_writev 378 ++pselect6 308 ++pselect6_time64 413 ++ptrace 26 ++pwrite64 181 ++pwritev 364 ++pwritev2 394 ++query_module 167 ++quotactl 131 ++quotactl_path ++read 3 ++readahead 225 ++readdir 89 ++readlink 85 ++readlinkat 305 ++readv 145 ++reboot 88 ++recv 356 ++recvfrom 355 ++recvmmsg 367 ++recvmmsg_time64 417 ++recvmsg 361 ++remap_file_pages 257 ++removexattr 235 ++rename 38 ++renameat 302 ++renameat2 383 ++request_key 287 ++restart_syscall 0 ++riscv_flush_icache ++rmdir 40 ++rseq 400 ++rt_sigaction 174 ++rt_sigpending 176 ++rt_sigprocmask 175 ++rt_sigqueueinfo 178 ++rt_sigreturn 173 ++rt_sigsuspend 179 ++rt_sigtimedwait 177 ++rt_sigtimedwait_time64 421 ++rt_tgsigqueueinfo 365 ++rtas ++s390_guarded_storage ++s390_pci_mmio_read ++s390_pci_mmio_write ++s390_runtime_instr ++s390_sthyi ++sched_get_affinity ++sched_get_priority_max 159 ++sched_get_priority_min 160 ++sched_getaffinity 242 ++sched_getattr 382 ++sched_getparam 155 ++sched_getscheduler 157 ++sched_rr_get_interval 161 ++sched_rr_get_interval_time64 423 ++sched_set_affinity ++sched_setaffinity 241 ++sched_setattr 381 ++sched_setparam 154 ++sched_setscheduler 156 ++sched_yield 158 ++seccomp 384 ++select 82 ++semctl 328 ++semget 329 ++semop 330 ++semtimedop 325 ++semtimedop_time64 420 ++send 354 ++sendfile 187 ++sendfile64 239 ++sendmmsg 376 ++sendmsg 360 ++sendto 353 ++set_mempolicy 276 ++set_robust_list 311 ++set_thread_area 243 ++set_tid_address 258 ++setdomainname 121 ++setfsgid 139 ++setfsgid32 216 ++setfsuid 138 ++setfsuid32 215 ++setgid 46 ++setgid32 214 ++setgroups 81 ++setgroups32 206 ++sethae ++sethostname 74 ++setitimer 104 ++setns 375 ++setpgid 57 ++setpgrp ++setpriority 97 ++setregid 71 ++setregid32 204 ++setresgid 170 ++setresgid32 210 ++setresuid 164 ++setresuid32 208 ++setreuid 70 ++setreuid32 203 ++setrlimit 75 ++setsid 66 ++setsockopt 357 ++settimeofday 79 ++setuid 23 ++setuid32 213 ++setxattr 226 ++sgetmask 68 ++shmat 335 ++shmctl 336 ++shmdt 337 ++shmget 338 ++shutdown 359 ++sigaction 67 ++sigaltstack 186 ++signal 48 ++signalfd 321 ++signalfd4 339 ++sigpending 73 ++sigprocmask 126 ++sigreturn 119 ++sigsuspend 72 ++socket 345 ++socketcall 102 ++socketpair 346 ++splice 313 ++spu_create ++spu_run ++ssetmask 69 ++stat 106 ++stat64 195 ++statfs 99 ++statfs64 268 ++statx 398 ++stime 25 ++subpage_prot ++swapcontext ++swapoff 115 ++swapon 87 ++switch_endian ++symlink 83 ++symlinkat 304 ++sync 36 ++sync_file_range 314 ++sync_file_range2 ++syncfs 374 ++sys_debug_setcontext ++syscall ++sysfs 135 ++sysinfo 116 ++syslog 103 ++sysmips ++tee 315 ++tgkill 270 ++time 13 ++timer_create 259 ++timer_delete 263 ++timer_getoverrun 262 ++timer_gettime 261 ++timer_gettime64 408 ++timer_settime 260 ++timer_settime64 409 ++timerfd ++timerfd_create 322 ++timerfd_gettime 327 ++timerfd_gettime64 410 ++timerfd_settime 326 ++timerfd_settime64 411 ++times 43 ++tkill 238 ++truncate 92 ++truncate64 193 ++ugetrlimit 191 ++umask 60 ++umount 22 ++umount2 52 ++uname 122 ++unlink 10 ++unlinkat 301 ++unshare 310 ++uselib 86 ++userfaultfd 389 ++ustat 62 ++utime 30 ++utimensat 320 ++utimensat_time64 412 ++utimes 271 ++utrap_install ++vfork 190 ++vhangup 111 ++vm86 166 ++vm86old 113 ++vmsplice 316 ++wait4 114 ++waitid 284 ++waitpid 7 ++write 4 ++writev 146 +-- +2.34.1 + diff --git a/meta-microblaze/recipes-core/systemd/systemd_%.bbappend b/meta-microblaze/recipes-core/systemd/systemd_%.bbappend new file mode 100644 index 00000000..0d31eb8f --- /dev/null +++ b/meta-microblaze/recipes-core/systemd/systemd_%.bbappend @@ -0,0 +1,7 @@ +FILESEXTRAPATHS:append:microblaze := ":${THISDIR}/files" +SRC_URI:append:microblaze = " \ + file://0001-architecture-Add-Microblaze-architecture-to-systemd-.patch \ + file://microblaze-syscalls.patch \ + file://microblaze-disable-stack-protector.patch \ + file://microblaze-once-macro.patch \ +" diff --git a/meta-microblaze/recipes-core/util-linux/util-linux/util-linux-microblaze.patch b/meta-microblaze/recipes-core/util-linux/util-linux/util-linux-microblaze.patch new file mode 100644 index 00000000..07712c98 --- /dev/null +++ b/meta-microblaze/recipes-core/util-linux/util-linux/util-linux-microblaze.patch @@ -0,0 +1,17 @@ +SECCOMP / Audit support needs to know about the microblaze architecture. + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- util-linux-2.39.1/include/audit-arch.h.orig 2023-08-23 14:55:54.318732126 -0600 ++++ util-linux-2.39.1/include/audit-arch.h 2023-08-23 15:02:51.058552660 -0600 +@@ -57,6 +57,8 @@ + # else + # define SECCOMP_ARCH_NATIVE AUDIT_ARCH_LOONGARCH64 + # endif ++#elif __microblaze__ ++# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_MICROBLAZE + #else + # error Unknown target architecture + #endif diff --git a/meta-microblaze/recipes-core/util-linux/util-linux_%.bbappend b/meta-microblaze/recipes-core/util-linux/util-linux_%.bbappend new file mode 100644 index 00000000..7774dda5 --- /dev/null +++ b/meta-microblaze/recipes-core/util-linux/util-linux_%.bbappend @@ -0,0 +1,2 @@ +FILESEXTRAPATHS:append:microblaze := ":${THISDIR}/util-linux" +SRC_URI:append:microblaze = " file://util-linux-microblaze.patch" |