about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2016-07-19 21:39:36 +0530
committerMike Frysinger <vapier@gentoo.org>2016-07-19 21:42:05 +0530
commit4f69cc45bcbed1619b15c9632f3eb6a36590c7dd (patch)
tree6feb0a3152787e6c62002d3dc22f007363fa28f8
parent2c3d888304642a2241a84491eeac9344be507ea4 (diff)
downloadglibc-4f69cc45bcbed1619b15c9632f3eb6a36590c7dd.tar.gz
glibc-4f69cc45bcbed1619b15c9632f3eb6a36590c7dd.tar.xz
glibc-4f69cc45bcbed1619b15c9632f3eb6a36590c7dd.zip
microblaze: fix variable name collision with syscall macros
If a function passes in a variable named "ret", the code will miscompile
when it declares a local ret variable.  In some cases, it's even a build
failure like so:
../sysdeps/unix/sysv/linux/spawni.c: In function '__spawni_child':
../sysdeps/unix/sysv/linux/spawni.c:289:5: error: address of register variable 'ret' requested
	while (write_not_cancel (p, &ret, sizeof ret) < 0)
-rw-r--r--ChangeLog7
-rw-r--r--sysdeps/unix/sysv/linux/microblaze/sysdep.h42
2 files changed, 28 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 639630facd..a2939995d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-07-19  Mike Frysinger  <vapier@gentoo.org>
+
+	* sysdeps/unix/sysv/linux/microblaze/sysdep.h (inline_syscall0):
+	Rename "ret" to "__ret".
+	(inline_syscall1, inline_syscall2, inline_syscall3, inline_syscall4,
+	inline_syscall5, inline_syscall6): Likewise.
+
 2016-07-19   Will Newton  <will.newton@gmail.com>
 
 	* elf/elf.h (R_METAG_REL8, R_METAG_REL16, R_METAG_TLS_GD
diff --git a/sysdeps/unix/sysv/linux/microblaze/sysdep.h b/sysdeps/unix/sysv/linux/microblaze/sysdep.h
index abc13c25ca..b83c436d0c 100644
--- a/sysdeps/unix/sysv/linux/microblaze/sysdep.h
+++ b/sysdeps/unix/sysv/linux/microblaze/sysdep.h
@@ -209,70 +209,70 @@ SYSCALL_ERROR_LABEL_DCL:                            \
 
 # define inline_syscall0(name,dummy)                                          \
   ({                                                                          \
-    register long ret __asm__("r3");                                          \
+    register long __ret __asm__("r3");                                        \
     register long __r12 __asm__("r12") = name;                                \
     __asm__ __volatile__( "brki r14,8; nop;"                                  \
-      : "=r"(ret)                                                             \
+      : "=r"(__ret)                                                           \
       : "r"(__r12)                                                            \
-      : SYSCALL_CLOBBERS_0 ); ret;                                            \
+      : SYSCALL_CLOBBERS_0 ); __ret;                                          \
   })
 
 # define inline_syscall1(name,arg1)                                           \
   ({                                                                          \
-    register long ret __asm__("r3");                                          \
+    register long __ret __asm__("r3");                                        \
     register long __r12 __asm__("r12") = name;                                \
     register long __r5 __asm__("r5") = (long)(arg1);                          \
     __asm__ __volatile__( "brki r14,8; nop;"                                  \
-      : "=r"(ret)                                                             \
+      : "=r"(__ret)                                                           \
       : "r"(__r5), "r"(__r12)                                                 \
-      : SYSCALL_CLOBBERS_1 ); ret;                                            \
+      : SYSCALL_CLOBBERS_1 ); __ret;                                          \
   })
 
 # define inline_syscall2(name,arg1,arg2)                                      \
   ({                                                                          \
-    register long ret __asm__("r3");                                          \
+    register long __ret __asm__("r3");                                        \
     register long __r12 __asm__("r12") = name;                                \
     register long __r5 __asm__("r5") = (long)(arg1);                          \
     register long __r6 __asm__("r6") = (long)(arg2);                          \
     __asm__ __volatile__( "brki r14,8; nop;"                                  \
-      : "=r"(ret)                                                             \
+      : "=r"(__ret)                                                           \
       : "r"(__r5), "r"(__r6), "r"(__r12)                                      \
-      : SYSCALL_CLOBBERS_2 ); ret;                                            \
+      : SYSCALL_CLOBBERS_2 ); __ret;                                          \
   })
 
 
 # define inline_syscall3(name,arg1,arg2,arg3)                                 \
   ({                                                                          \
-    register long ret __asm__("r3");                                          \
+    register long __ret __asm__("r3");                                        \
     register long __r12 __asm__("r12") = name;                                \
     register long __r5 __asm__("r5") = (long)(arg1);                          \
     register long __r6 __asm__("r6") = (long)(arg2);                          \
     register long __r7 __asm__("r7") = (long)(arg3);                          \
     __asm__ __volatile__( "brki r14,8; nop;"                                  \
-      : "=r"(ret)                                                             \
+      : "=r"(__ret)                                                           \
       : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r12)                           \
-      : SYSCALL_CLOBBERS_3 ); ret;                                            \
+      : SYSCALL_CLOBBERS_3 ); __ret;                                          \
   })
 
 
 # define inline_syscall4(name,arg1,arg2,arg3,arg4)                            \
   ({                                                                          \
-    register long ret __asm__("r3");                                          \
+    register long __ret __asm__("r3");                                        \
     register long __r12 __asm__("r12") = name;                                \
     register long __r5 __asm__("r5") = (long)(arg1);                          \
     register long __r6 __asm__("r6") = (long)(arg2);                          \
     register long __r7 __asm__("r7") = (long)(arg3);                          \
     register long __r8 __asm__("r8") = (long)(arg4);                          \
     __asm__ __volatile__( "brki r14,8; nop;"                                  \
-      : "=r"(ret)                                                             \
+      : "=r"(__ret)                                                           \
       : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r12)                 \
-      : SYSCALL_CLOBBERS_4 ); ret;                                            \
+      : SYSCALL_CLOBBERS_4 ); __ret;                                          \
   })
 
 
 # define inline_syscall5(name,arg1,arg2,arg3,arg4,arg5)                       \
   ({                                                                          \
-    register long ret __asm__("r3");                                          \
+    register long __ret __asm__("r3");                                        \
     register long __r12 __asm__("r12") = name;                                \
     register long __r5 __asm__("r5") = (long)(arg1);                          \
     register long __r6 __asm__("r6") = (long)(arg2);                          \
@@ -280,15 +280,15 @@ SYSCALL_ERROR_LABEL_DCL:                            \
     register long __r8 __asm__("r8") = (long)(arg4);                          \
     register long __r9 __asm__("r9") = (long)(arg5);                          \
     __asm__ __volatile__( "brki r14,8; nop;"                                  \
-      : "=r"(ret)                                                             \
+      : "=r"(__ret)                                                           \
       : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r9), "r"(__r12)      \
-      : SYSCALL_CLOBBERS_5 ); ret;                                            \
+      : SYSCALL_CLOBBERS_5 ); __ret;                                          \
   })
 
 
 # define inline_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6)                  \
   ({                                                                          \
-    register long ret __asm__("r3");                                          \
+    register long __ret __asm__("r3");                                        \
     register long __r12 __asm__("r12") = name;                                \
     register long __r5 __asm__("r5") = (long)(arg1);                          \
     register long __r6 __asm__("r6") = (long)(arg2);                          \
@@ -297,10 +297,10 @@ SYSCALL_ERROR_LABEL_DCL:                            \
     register long __r9 __asm__("r9") = (long)(arg5);                          \
     register long __r10 __asm__("r10") = (long)(arg6);                        \
     __asm__ __volatile__( "brki r14,8; nop;"                                  \
-      : "=r"(ret)                                                             \
+      : "=r"(__ret)                                                           \
       : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r9), "r"(__r10),     \
       "r"(__r12)                                                              \
-      : SYSCALL_CLOBBERS_6 ); ret;                                            \
+      : SYSCALL_CLOBBERS_6 ); __ret;                                          \
   })