fix build on aarch64 (#973343), fix the defines for arm and aarch64 (may need adjustment)

This commit is contained in:
Ondřej Vašík 2013-06-11 14:51:00 -04:00
parent 85b071a0f6
commit d8dec5998f
2 changed files with 151 additions and 4 deletions

125
redhat-lsb-aarch64.patch Normal file
View File

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

View File

@ -36,6 +36,16 @@
%define lsbldso ld-lsb-x86-64.so %define lsbldso ld-lsb-x86-64.so
%endif %endif
%ifarch %{arm}
%define ldso ld-linux.so.2
%define lsbldso ld-lsb-arm.so
%endif
%ifarch aarch64
%define ldso ld-linux.so.2
%define lsbldso ld-lsb-aarch64.so
%endif
%define upstreamlsbrelver 2.0 %define upstreamlsbrelver 2.0
%define lsbrelver 4.1 %define lsbrelver 4.1
%define srcrelease 1 %define srcrelease 1
@ -43,13 +53,14 @@
Summary: Implementation of Linux Standard Base specification Summary: Implementation of Linux Standard Base specification
Name: redhat-lsb Name: redhat-lsb
Version: 4.1 Version: 4.1
Release: 14%{?dist} Release: 15%{?dist}
URL: http://www.linuxfoundation.org/collaborate/workgroups/lsb URL: http://www.linuxfoundation.org/collaborate/workgroups/lsb
Source0: https://fedorahosted.org/releases/r/e/redhat-lsb/%{name}-%{version}-%{srcrelease}.tar.bz2 Source0: https://fedorahosted.org/releases/r/e/redhat-lsb/%{name}-%{version}-%{srcrelease}.tar.bz2
Patch0: lsb-release-3.1-update-init-functions.patch Patch0: lsb-release-3.1-update-init-functions.patch
Patch1: redhat-lsb-lsb_start_daemon-fix.patch Patch1: redhat-lsb-lsb_start_daemon-fix.patch
Patch2: redhat-lsb-trigger.patch Patch2: redhat-lsb-trigger.patch
Patch3: redhat-lsb-arm.patch Patch3: redhat-lsb-arm.patch
Patch4: redhat-lsb-aarch64.patch
License: GPLv2 License: GPLv2
Group: System Environment/Base Group: System Environment/Base
BuildRequires: glibc-static BuildRequires: glibc-static
@ -75,8 +86,14 @@ BuildRequires: glibc-static
%ifarch x86_64 %ifarch x86_64
%define archname amd64 %define archname amd64
%endif %endif
%ifarch %{arm}
%define archname arm
%endif
%ifarch aarch64
%define archname aarch64
%endif
ExclusiveArch: %{ix86} ia64 x86_64 ppc ppc64 s390 s390x %{arm} ExclusiveArch: %{ix86} ia64 x86_64 ppc ppc64 s390 s390x %{arm} aarch64
Requires: redhat-lsb-core%{?_isa} = %{version} Requires: redhat-lsb-core%{?_isa} = %{version}
Requires: redhat-lsb-cxx%{?_isa} = %{version} Requires: redhat-lsb-cxx%{?_isa} = %{version}
@ -320,10 +337,10 @@ Requires: cairo%{?_isa}
Requires: freetype%{?_isa} Requires: freetype%{?_isa}
Requires: libjpeg-turbo%{?_isa} Requires: libjpeg-turbo%{?_isa}
%ifarch %{ix86} ppc s390 %ifarch %{ix86} ppc s390 arm
Requires: libpng12.so.0 Requires: libpng12.so.0
%endif %endif
%ifarch x86_64 ppc64 s390x %ifarch x86_64 ppc64 s390x aarch64
Requires: libpng12.so.0()(64bit) Requires: libpng12.so.0()(64bit)
%endif %endif
Requires: libpng%{?_isa} Requires: libpng%{?_isa}
@ -454,6 +471,7 @@ to be on LSB conforming system.
%patch1 -p1 %patch1 -p1
%patch2 -p0 -b .triggerfix %patch2 -p0 -b .triggerfix
%patch3 -p1 -b .arm %patch3 -p1 -b .arm
%patch4 -p1 -b .aarch64
%build %build
cd lsb-release-%{upstreamlsbrelver} cd lsb-release-%{upstreamlsbrelver}
@ -760,6 +778,10 @@ os.remove("%{_datadir}/lsb")
%changelog %changelog
* Tue Jun 11 2013 Ondrej Vasik <ovasik@redhat.com> - 4.1-15
- fix build on aarch64 (#973343)
- fix the defines for arm and aarch64 (may need adjustment)
* Thu May 23 2013 Ondrej Vasik <ovasik@redhat.com> - 4.1-14 * Thu May 23 2013 Ondrej Vasik <ovasik@redhat.com> - 4.1-14
- require spax instead of pax (more POSIX compatible) (#965658) - require spax instead of pax (more POSIX compatible) (#965658)
- require another set of perl modules in -languages (#959129) - require another set of perl modules in -languages (#959129)