Skip to content

Commit

Permalink
x86_64: Add support to build kexec-tools with x32 ABI
Browse files Browse the repository at this point in the history
Summary of changes,

configure.ac: Add test for detect x32 ABI.
purgatory/arch/x86_64/Makefile: Not use mcmodel large when
	x32 ABI is set.
kexec/arch/x86_64/kexec-elf-rel-x86_64.c: When x32 ABI is set
	use ELFCLASS32 instead of ELFCLASS64.
kexec/kexec-syscall.h: Add correct syscall number for x32 ABI.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
  • Loading branch information
Aníbal Limón authored and horms committed Apr 7, 2015
1 parent 720d110 commit 5edcbfd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
9 changes: 9 additions & 0 deletions configure.ac
Expand Up @@ -52,6 +52,15 @@ case $target_cpu in
;;
ia64|x86_64|alpha|m68k )
ARCH="$target_cpu"

dnl ---Test for x32 ABI in x86_64
if test "x$ARCH" = "xx86_64" ; then
AC_EGREP_CPP(x32_test,
[#if defined(__x86_64__) && defined (__ILP32__)
x32_test
#endif
], SUBARCH='x32', SUBARCH='64')
fi
;;
* )
AC_MSG_ERROR([unsupported architecture $target_cpu])
Expand Down
4 changes: 4 additions & 0 deletions kexec/arch/x86_64/kexec-elf-rel-x86_64.c
Expand Up @@ -8,7 +8,11 @@ int machine_verify_elf_rel(struct mem_ehdr *ehdr)
if (ehdr->ei_data != ELFDATA2LSB) {
return 0;
}
#ifdef __ILP32__
if (ehdr->ei_class != ELFCLASS32) {
#else
if (ehdr->ei_class != ELFCLASS64) {
#endif
return 0;
}
if (ehdr->e_machine != EM_X86_64) {
Expand Down
4 changes: 4 additions & 0 deletions kexec/kexec-syscall.h
Expand Up @@ -31,8 +31,12 @@
#define __NR_kexec_load 268
#endif
#ifdef __x86_64__
#ifdef __ILP32__
#define __NR_kexec_load 528
#else
#define __NR_kexec_load 246
#endif
#endif
#ifdef __s390x__
#define __NR_kexec_load 277
#endif
Expand Down
4 changes: 3 additions & 1 deletion purgatory/arch/x86_64/Makefile
Expand Up @@ -23,4 +23,6 @@ x86_64_PURGATORY_SRCS += purgatory/arch/i386/console-x86.c
x86_64_PURGATORY_SRCS += purgatory/arch/i386/vga.c
x86_64_PURGATORY_SRCS += purgatory/arch/i386/pic.c

x86_64_PURGATORY_EXTRA_CFLAGS = -mcmodel=large
ifeq ($(SUBARCH),64)
x86_64_PURGATORY_EXTRA_CFLAGS = -mcmodel=large
endif

0 comments on commit 5edcbfd

Please sign in to comment.