summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/kexec/kexec-tools/kexec-x32.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/kexec/kexec-tools/kexec-x32.patch')
-rw-r--r--meta/recipes-kernel/kexec/kexec-tools/kexec-x32.patch113
1 files changed, 113 insertions, 0 deletions
diff --git a/meta/recipes-kernel/kexec/kexec-tools/kexec-x32.patch b/meta/recipes-kernel/kexec/kexec-tools/kexec-x32.patch
new file mode 100644
index 0000000000..0bd3264af7
--- /dev/null
+++ b/meta/recipes-kernel/kexec/kexec-tools/kexec-x32.patch
@@ -0,0 +1,113 @@
1x86_64: Add support to build kexec-tools with x32 ABI
2
3Summary of changes,
4
5configure.ac: Add test for detect x32 ABI.
6purgatory/arch/x86_64/Makefile: Not use mcmodel large when
7 x32 ABI is set.
8kexec/arch/x86_64/kexec-elf-rel-x86_64.c: When x32 ABI is set
9 use ELFCLASS32 instead of ELFCLASS64.
10kexec/kexec-syscall.h: Add correct syscall number for x32 ABI.
11
12Upstream-Status: Submitted
13
14Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
15Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
16
17---
18 configure.ac | 9 +++++++++
19 kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 4 ++++
20 kexec/kexec-syscall.h | 4 ++++
21 purgatory/arch/x86_64/Makefile | 4 +++-
22 4 files changed, 20 insertions(+), 1 deletion(-)
23
24diff --git a/configure.ac b/configure.ac
25index c410e90..1ecadd5 100644
26--- a/configure.ac
27+++ b/configure.ac
28@@ -52,6 +52,15 @@ case $target_cpu in
29 ;;
30 ia64|x86_64|alpha|m68k )
31 ARCH="$target_cpu"
32+
33+ dnl ---Test for x32 ABI in x86_64
34+ if test "x$ARCH" = "xx86_64" ; then
35+ AC_EGREP_CPP(x32_test,
36+ [#if defined(__x86_64__) && defined (__ILP32__)
37+ x32_test
38+ #endif
39+ ], SUBARCH='x32', SUBARCH='64')
40+ fi
41 ;;
42 * )
43 AC_MSG_ERROR([unsupported architecture $target_cpu])
44diff --git a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
45index c795037..06db7f0 100644
46--- a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
47+++ b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
48@@ -8,7 +8,11 @@ int machine_verify_elf_rel(struct mem_ehdr *ehdr)
49 if (ehdr->ei_data != ELFDATA2LSB) {
50 return 0;
51 }
52+#ifdef __ILP32__
53+ if (ehdr->ei_class != ELFCLASS32) {
54+#else
55 if (ehdr->ei_class != ELFCLASS64) {
56+#endif
57 return 0;
58 }
59 if (ehdr->e_machine != EM_X86_64) {
60diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
61index ce2e20b..cab5535 100644
62--- a/kexec/kexec-syscall.h
63+++ b/kexec/kexec-syscall.h
64@@ -31,8 +31,12 @@
65 #define __NR_kexec_load 268
66 #endif
67 #ifdef __x86_64__
68+#ifdef __ILP32__
69+#define __NR_kexec_load 528
70+#else
71 #define __NR_kexec_load 246
72 #endif
73+#endif
74 #ifdef __s390x__
75 #define __NR_kexec_load 277
76 #endif
77diff --git a/purgatory/arch/x86_64/Makefile b/purgatory/arch/x86_64/Makefile
78index 7300937..4af11e4 100644
79--- a/purgatory/arch/x86_64/Makefile
80+++ b/purgatory/arch/x86_64/Makefile
81@@ -23,4 +23,6 @@ x86_64_PURGATORY_SRCS += purgatory/arch/i386/console-x86.c
82 x86_64_PURGATORY_SRCS += purgatory/arch/i386/vga.c
83 x86_64_PURGATORY_SRCS += purgatory/arch/i386/pic.c
84
85-x86_64_PURGATORY_EXTRA_CFLAGS = -mcmodel=large
86+ifeq ($(SUBARCH),64)
87+ x86_64_PURGATORY_EXTRA_CFLAGS = -mcmodel=large
88+endif
89--
901.8.4.5
91
92diff --git a/configure.ac b/configure.ac
93index 1ecadd5..e0b5f78 100644
94--- a/configure.ac
95+++ b/configure.ac
96@@ -8,6 +8,7 @@ AC_INIT(kexec-tools, 2.0.10.git)
97 AC_CONFIG_AUX_DIR(./config)
98 AC_CONFIG_HEADERS([include/config.h])
99 AC_LANG(C)
100+AC_PROG_CC
101
102 AC_DEFINE_UNQUOTED(PACKAGE_DATE, "`date '+%d %B %Y'`",
103 [Define to the release date of this package])
104@@ -106,9 +107,6 @@ AC_ARG_WITH([booke],
105
106 dnl ---Programs
107 dnl To specify a different compiler, just 'export CC=/path/to/compiler'
108-
109-AC_PROG_CC
110-
111 if test "${build}" != "${host}" ; then
112 AC_CHECK_PROGS(BUILD_CC, [${build_alias}-gcc ${build}-gcc gcc])
113 else