MB is failing to compile stating "ret" variable is a register. However renaming
the variable from ret to any other name fixes this issue. I think it might be a
GCC issue, but I am unable to re-create this corner case to report it to GCC.

Signed-off-by: Manjukumar Matha <[email protected]>
---
 .../glibc/files/microblaze-gcc-ret-fix.patch       | 120 +++++++++++++++++++++
 recipes-microblaze/glibc/glibc_2.24.bbappend       |   5 +
 2 files changed, 125 insertions(+)
 create mode 100644 recipes-microblaze/glibc/files/microblaze-gcc-ret-fix.patch
 create mode 100644 recipes-microblaze/glibc/glibc_2.24.bbappend

diff --git a/recipes-microblaze/glibc/files/microblaze-gcc-ret-fix.patch 
b/recipes-microblaze/glibc/files/microblaze-gcc-ret-fix.patch
new file mode 100644
index 0000000..12ed783
--- /dev/null
+++ b/recipes-microblaze/glibc/files/microblaze-gcc-ret-fix.patch
@@ -0,0 +1,120 @@
+diff --git a/sysdeps/unix/sysv/linux/spawni.c 
b/sysdeps/unix/sysv/linux/spawni.c
+index ee05de5..08aecee 100644
+--- a/sysdeps/unix/sysv/linux/spawni.c
++++ b/sysdeps/unix/sysv/linux/spawni.c
+@@ -126,7 +126,7 @@ __spawni_child (void *arguments)
+   const posix_spawnattr_t *restrict attr = args->attr;
+   const posix_spawn_file_actions_t *file_actions = args->fa;
+   int p = args->pipe[1];
+-  int ret;
++  int retVal;
+ 
+   close_not_cancel (args->pipe[0]);
+ 
+@@ -171,25 +171,25 @@ __spawni_child (void *arguments)
+   if ((attr->__flags & (POSIX_SPAWN_SETSCHEDPARAM | POSIX_SPAWN_SETSCHEDULER))
+       == POSIX_SPAWN_SETSCHEDPARAM)
+     {
+-      if ((ret = __sched_setparam (0, &attr->__sp)) == -1)
++      if ((retVal = __sched_setparam (0, &attr->__sp)) == -1)
+       goto fail;
+     }
+   else if ((attr->__flags & POSIX_SPAWN_SETSCHEDULER) != 0)
+     {
+-      if ((ret = __sched_setscheduler (0, attr->__policy, &attr->__sp)) == -1)
++      if ((retVal = __sched_setscheduler (0, attr->__policy, &attr->__sp)) == 
-1)
+       goto fail;
+     }
+ #endif
+ 
+   /* Set the process group ID.  */
+   if ((attr->__flags & POSIX_SPAWN_SETPGROUP) != 0
+-      && (ret = __setpgid (0, attr->__pgrp)) != 0)
++      && (retVal = __setpgid (0, attr->__pgrp)) != 0)
+     goto fail;
+ 
+   /* Set the effective user and group IDs.  */
+   if ((attr->__flags & POSIX_SPAWN_RESETIDS) != 0
+-      && ((ret = local_seteuid (__getuid ())) != 0
+-        || (ret = local_setegid (__getgid ())) != 0))
++      && ((retVal = local_seteuid (__getuid ())) != 0
++        || (retVal = local_setegid (__getgid ())) != 0))
+     goto fail;
+ 
+   /* Execute the file actions.  */
+@@ -209,15 +209,15 @@ __spawni_child (void *arguments)
+             || (action->action.open_action.fd == p)
+             || (action->action.dup2_action.fd == p))
+           {
+-            if ((ret = __dup (p)) < 0)
++            if ((retVal = __dup (p)) < 0)
+               goto fail;
+-            p = ret;
++            p = retVal;
+           }
+ 
+         switch (action->tag)
+           {
+           case spawn_do_close:
+-            if ((ret =
++            if ((retVal =
+                  close_not_cancel (action->action.close_action.fd)) != 0)
+               {
+                 if (!have_fdlimit)
+@@ -235,31 +235,31 @@ __spawni_child (void *arguments)
+ 
+           case spawn_do_open:
+             {
+-              ret = open_not_cancel (action->action.open_action.path,
++              retVal = open_not_cancel (action->action.open_action.path,
+                                      action->action.
+                                      open_action.oflag | O_LARGEFILE,
+                                      action->action.open_action.mode);
+ 
+-              if (ret == -1)
++              if (retVal == -1)
+                 goto fail;
+ 
+-              int new_fd = ret;
++              int new_fd = retVal;
+ 
+               /* Make sure the desired file descriptor is used.  */
+-              if (ret != action->action.open_action.fd)
++              if (retVal != action->action.open_action.fd)
+                 {
+-                  if ((ret = __dup2 (new_fd, action->action.open_action.fd))
++                  if ((retVal = __dup2 (new_fd, 
action->action.open_action.fd))
+                       != action->action.open_action.fd)
+                     goto fail;
+ 
+-                  if ((ret = close_not_cancel (new_fd)) != 0)
++                  if ((retVal = close_not_cancel (new_fd)) != 0)
+                     goto fail;
+                 }
+             }
+             break;
+ 
+           case spawn_do_dup2:
+-            if ((ret = __dup2 (action->action.dup2_action.fd,
++            if ((retVal = __dup2 (action->action.dup2_action.fd,
+                                action->action.dup2_action.newfd))
+                 != action->action.dup2_action.newfd)
+               goto fail;
+@@ -280,13 +280,13 @@ __spawni_child (void *arguments)
+      (2.15).  */
+   maybe_script_execute (args);
+ 
+-  ret = -errno;
++  retVal = -errno;
+ 
+ fail:
+   /* Since sizeof errno < PIPE_BUF, the write is atomic. */
+-  ret = -ret;
+-  if (ret)
+-    while (write_not_cancel (p, &ret, sizeof ret) < 0)
++  retVal = -retVal;
++  if (retVal)
++    while (write_not_cancel (p, &retVal, sizeof retVal) < 0)
+       continue;
+   exit (SPAWN_ERROR);
+ }
diff --git a/recipes-microblaze/glibc/glibc_2.24.bbappend 
b/recipes-microblaze/glibc/glibc_2.24.bbappend
new file mode 100644
index 0000000..bf54619
--- /dev/null
+++ b/recipes-microblaze/glibc/glibc_2.24.bbappend
@@ -0,0 +1,5 @@
+# Add MicroBlaze Patches
+FILESEXTRAPATHS_append := "${THISDIR}/files:"
+SRC_URI_append_microblaze = " \
+               file://microblaze-gcc-ret-fix.patch \
+               "
-- 
2.7.4

-- 
_______________________________________________
meta-xilinx mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-xilinx

Reply via email to