1 From 8c9a5076543eb3d497e016b3d7707e93d6311883 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= <anibal.limon@linux.intel.com>
3 Date: Mon, 15 Jul 2013 23:32:36 -0700
4 Subject: [PATCH] x86_64: Add support to build kexec-tools with x32 ABI
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 configure.ac: Add test for detect x32 ABI.
12 purgatory/arch/x86_64/Makefile: Not use mcmodel large when
14 kexec/arch/x86_64/kexec-elf-rel-x86_64.c: When x32 ABI is set
15 use ELFCLASS32 instead of ELFCLASS64.
16 kexec/kexec-syscall.h: Add correct syscall number for x32 ABI.
18 Upstream-Status: Submitted
20 Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
21 Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
23 configure.ac | 9 +++++++++
24 kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 4 ++++
25 kexec/kexec-syscall.h | 4 ++++
26 purgatory/arch/x86_64/Makefile | 4 +++-
27 4 files changed, 20 insertions(+), 1 deletion(-)
29 diff --git a/configure.ac b/configure.ac
30 index c2b0c68..60882b8 100644
33 @@ -54,6 +54,15 @@ case $target_cpu in
35 ia64|x86_64|alpha|m68k )
38 + dnl ---Test for x32 ABI in x86_64
39 + if test "x$ARCH" = "xx86_64" ; then
40 + AC_EGREP_CPP(x32_test,
41 + [#if defined(__x86_64__) && defined (__ILP32__)
44 + ], SUBARCH='x32', SUBARCH='64')
48 AC_MSG_ERROR([unsupported architecture $target_cpu])
49 diff --git a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
50 index db85b44..0ce1172 100644
51 --- a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
52 +++ b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
53 @@ -8,7 +8,11 @@ int machine_verify_elf_rel(struct mem_ehdr *ehdr)
54 if (ehdr->ei_data != ELFDATA2LSB) {
58 + if (ehdr->ei_class != ELFCLASS32) {
60 if (ehdr->ei_class != ELFCLASS64) {
64 if (ehdr->e_machine != EM_X86_64) {
65 diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
66 index dac1c1f..e9479b7 100644
67 --- a/kexec/kexec-syscall.h
68 +++ b/kexec/kexec-syscall.h
70 #define __NR_kexec_load 268
74 +#define __NR_kexec_load 528
76 #define __NR_kexec_load 246
80 #define __NR_kexec_load 277
82 diff --git a/purgatory/arch/x86_64/Makefile b/purgatory/arch/x86_64/Makefile
83 index 7300937..4af11e4 100644
84 --- a/purgatory/arch/x86_64/Makefile
85 +++ b/purgatory/arch/x86_64/Makefile
86 @@ -23,4 +23,6 @@ x86_64_PURGATORY_SRCS += purgatory/arch/i386/console-x86.c
87 x86_64_PURGATORY_SRCS += purgatory/arch/i386/vga.c
88 x86_64_PURGATORY_SRCS += purgatory/arch/i386/pic.c
90 -x86_64_PURGATORY_EXTRA_CFLAGS = -mcmodel=large
92 + x86_64_PURGATORY_EXTRA_CFLAGS = -mcmodel=large