Blame SOURCES/redhat-lsb-aarch64.patch

3f3c6f
diff --git a/redhat_lsb_trigger.c b/redhat_lsb_trigger.c
3f3c6f
index 76db260..f76e5a5 100644
3f3c6f
--- a/redhat_lsb_trigger.c
3f3c6f
+++ b/redhat_lsb_trigger.c
3f3c6f
@@ -424,6 +424,102 @@ register void *__thread_self __asm ("g7");
3f3c6f
 	   : inline_syscall_clobbers, "$20", "$21");		\
3f3c6f
 	_sc_ret = _sc_0, _sc_err = _sc_19;			\
3f3c6f
 }
3f3c6f
+#elif defined __aarch64__
3f3c6f
+#undef SYS_ify
3f3c6f
+#define SYS_ify(syscall_name)	(__NR_##syscall_name)
3f3c6f
+
3f3c6f
+# undef INLINE_SYSCALL
3f3c6f
+# define INLINE_SYSCALL(name, nr, args...)				\
3f3c6f
+  ({ unsigned long _sys_result = INTERNAL_SYSCALL (name, , nr, args);	\
3f3c6f
+     if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\
3f3c6f
+       {								\
3f3c6f
+	 __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, ));		\
3f3c6f
+	 _sys_result = (unsigned long) -1;				\
3f3c6f
+       }								\
3f3c6f
+     (long) _sys_result; })
3f3c6f
+
3f3c6f
+# undef INTERNAL_SYSCALL_DECL
3f3c6f
+# define INTERNAL_SYSCALL_DECL(err) do { } while (0)
3f3c6f
+
3f3c6f
+# undef INTERNAL_SYSCALL_RAW
3f3c6f
+# define INTERNAL_SYSCALL_RAW(name, err, nr, args...)		\
3f3c6f
+  ({ unsigned long _sys_result;					\
3f3c6f
+     {								\
3f3c6f
+       LOAD_ARGS_##nr (args)					\
3f3c6f
+       register long _x8 asm ("x8") = (name);			\
3f3c6f
+       asm volatile ("svc	0	// syscall " # name     \
3f3c6f
+		     : "+r" (_x0), "+r" (_x8)			\
3f3c6f
+		     : ASM_ARGS_##nr				\
3f3c6f
+		     : "memory", CLOBBER_ARGS_##nr);		\
3f3c6f
+       _sys_result = _x0;					\
3f3c6f
+     }								\
3f3c6f
+     (long) _sys_result; })
3f3c6f
+
3f3c6f
+# undef INTERNAL_SYSCALL
3f3c6f
+# define INTERNAL_SYSCALL(name, err, nr, args...)		\
3f3c6f
+	INTERNAL_SYSCALL_RAW(SYS_ify(name), err, nr, args)
3f3c6f
+
3f3c6f
+# undef INTERNAL_SYSCALL_ERROR_P
3f3c6f
+# define INTERNAL_SYSCALL_ERROR_P(val, err) \
3f3c6f
+  ((unsigned long) (val) >= (unsigned long) -4095)
3f3c6f
+
3f3c6f
+# undef INTERNAL_SYSCALL_ERRNO
3f3c6f
+# define INTERNAL_SYSCALL_ERRNO(val, err)	(-(val))
3f3c6f
+
3f3c6f
+# define CLOBBER_ARGS_0       CLOBBER_ARGS_1
3f3c6f
+# define CLOBBER_ARGS_1 "x1", CLOBBER_ARGS_2
3f3c6f
+# define CLOBBER_ARGS_2 "x2", CLOBBER_ARGS_3
3f3c6f
+# define CLOBBER_ARGS_3 "x3", CLOBBER_ARGS_4
3f3c6f
+# define CLOBBER_ARGS_4 "x4", CLOBBER_ARGS_5
3f3c6f
+# define CLOBBER_ARGS_5 "x5", CLOBBER_ARGS_6
3f3c6f
+# define CLOBBER_ARGS_6 "x6", CLOBBER_ARGS_7
3f3c6f
+# define CLOBBER_ARGS_7 \
3f3c6f
+  "x7", "x9", "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18"
3f3c6f
+
3f3c6f
+# define LOAD_ARGS_0()				\
3f3c6f
+  register long _x0 asm ("x0");
3f3c6f
+
3f3c6f
+# define ASM_ARGS_0
3f3c6f
+# define LOAD_ARGS_1(x0)			\
3f3c6f
+  long _x0tmp = (long) (x0);			\
3f3c6f
+  LOAD_ARGS_0 ()				\
3f3c6f
+  _x0 = _x0tmp;
3f3c6f
+# define ASM_ARGS_1	"r" (_x0)
3f3c6f
+# define LOAD_ARGS_2(x0, x1)			\
3f3c6f
+  long _x1tmp = (long) (x1);			\
3f3c6f
+  LOAD_ARGS_1 (x0)				\
3f3c6f
+  register long _x1 asm ("x1") = _x1tmp;
3f3c6f
+# define ASM_ARGS_2	ASM_ARGS_1, "r" (_x1)
3f3c6f
+# define LOAD_ARGS_3(x0, x1, x2)		\
3f3c6f
+  long _x2tmp = (long) (x2);			\
3f3c6f
+  LOAD_ARGS_2 (x0, x1)				\
3f3c6f
+  register long _x2 asm ("x2") = _x2tmp;
3f3c6f
+# define ASM_ARGS_3	ASM_ARGS_2, "r" (_x2)
3f3c6f
+# define LOAD_ARGS_4(x0, x1, x2, x3)		\
3f3c6f
+  long _x3tmp = (long) (x3);			\
3f3c6f
+  LOAD_ARGS_3 (x0, x1, x2)			\
3f3c6f
+  register long _x3 asm ("x3") = _x3tmp;
3f3c6f
+# define ASM_ARGS_4	ASM_ARGS_3, "r" (_x3)
3f3c6f
+# define LOAD_ARGS_5(x0, x1, x2, x3, x4)	\
3f3c6f
+  long _x4tmp = (long) (x4);			\
3f3c6f
+  LOAD_ARGS_4 (x0, x1, x2, x3)			\
3f3c6f
+  register long _x4 asm ("x4") = _x4tmp;
3f3c6f
+# define ASM_ARGS_5	ASM_ARGS_4, "r" (_x4)
3f3c6f
+# define LOAD_ARGS_6(x0, x1, x2, x3, x4, x5)	\
3f3c6f
+  long _x5tmp = (long) (x5);			\
3f3c6f
+  LOAD_ARGS_5 (x0, x1, x2, x3, x4)		\
3f3c6f
+  register long _x5 asm ("x5") = _x5tmp;
3f3c6f
+# define ASM_ARGS_6	ASM_ARGS_5, "r" (_x5)
3f3c6f
+# define LOAD_ARGS_7(x0, x1, x2, x3, x4, x5, x6)\
3f3c6f
+  long _x6tmp = (long) (x6);			\
3f3c6f
+  LOAD_ARGS_6 (x0, x1, x2, x3, x4, x5)		\
3f3c6f
+  register long _x6 asm ("x6") = _x6tmp;
3f3c6f
+# define ASM_ARGS_7	ASM_ARGS_6, "r" (_x6)
3f3c6f
+
3f3c6f
+# undef INTERNAL_SYSCALL_NCS
3f3c6f
+# define INTERNAL_SYSCALL_NCS(number, err, nr, args...)	\
3f3c6f
+	INTERNAL_SYSCALL_RAW (number, err, nr, args)
3f3c6f
+
3f3c6f
 #endif
3f3c6f
 
3f3c6f
 #ifdef __i386__
3f3c6f
@@ -539,10 +635,14 @@ int main (int argc, char **argv)
3f3c6f
       p = mempcpy (p, LSBLDSO, sizeof LSBLDSO - 1);
3f3c6f
       *p++ = '.';
3f3c6f
       strcpy (p, LSBVER);
3f3c6f
+#if defined(__NR_symlink)
3f3c6f
       if (is_ia64 ())
3f3c6f
 	INTERNAL_SYSCALL (symlink, err, 2, "/emul/ia32-linux/lib/" LDSO, buf);
3f3c6f
       else
3f3c6f
 	INTERNAL_SYSCALL (symlink, err, 2, LDSO, buf);
3f3c6f
+#elif defined(__NR_symlinkat)
3f3c6f
+      INTERNAL_SYSCALL (symlinkat, err, 3, AT_FDCWD, LDSO, buf);
3f3c6f
+#endif
3f3c6f
       p = NULL;
3f3c6f
     }
3f3c6f
   INTERNAL_SYSCALL (exit, err, 1, 0);
3f3c6f
@@ -682,7 +682,7 @@ int __libc_start_main (int argc, char **argv, char **ev,
3f3c6f
 		       void *auxvec, void (*rtld_fini) (void),
3f3c6f
 		       struct startup_info *stinfo,
3f3c6f
 		       char **stack_on_entry)
3f3c6f
-#elif defined __arm__
3f3c6f
+#elif defined __arm__ || defined __aarch64__
3f3c6f
 
3f3c6f
 int ___libc_start_main (int (*main) (int argc, char **argv),
3f3c6f
                        int argc, char **argv,