Blame SOURCES/redhat-lsb-aarch64.patch

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