x86_64: Add support to build kexec-tools with x32 ABI
Subsystems (2)
PATCH 1/1 x86_64: Add support to build kexec-tools with x32 ABI
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.
--- configure.ac | 9 +++++++++ kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 4 ++++ kexec/kexec-syscall.h | 4 ++++ purgatory/arch/x86_64/Makefile | 4 +++- 4 files changed, 20 insertions(+), 1 deletion(-)
configure.ac +9 -0
@@ -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])
kexec/arch/x86_64/kexec-elf-rel-x86_64.c +4 -0
@@ -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 ) {
kexec/kexec-syscall.h +4 -0
@@ -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
purgatory/arch/x86_64/Makefile +3 -1
@@ -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
Signature · 7 lines
1.8.4.5 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Any comment or feedback?
alimon
Quoted 76 lines · Aníbal Limón
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 <[email protected]>Signed-off-by Mariano Lopez <[email protected]>--- configure.ac | 9 +++++++++ kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 4 ++++ kexec/kexec-syscall.h | 4 ++++ purgatory/arch/x86_64/Makefile | 4 +++- 4 files changed, 20 insertions(+), 1 deletion(-)configure.ac +9
-0@@ -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])kexec/arch/x86_64/kexec-elf-rel-x86_64.c +4
-0@@ -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 ) {kexec/kexec-syscall.h +4
-0@@ -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 purgatory/arch/x86_64/Makefile +0
-0
purgatory/arch/x86_64/Makefile x86_64_PURGATORY_SRCS += purgatory/arch/i386/console-x86.c · line 28
Quoted 7 lines
purgatory/arch/x86_64/Makefile +3
-1@@ -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
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 1 line · Aníbal Limón
Any comment or feedback?
I feel like I am missing something obvious, but could you explain the use case a little more clearly?
Quoted 84 lines
alimon
Quoted 80 lines · Aníbal Limón
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 <[email protected]>Signed-off-by Mariano Lopez <[email protected]>--- configure.ac | 9 +++++++++ kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 4 ++++ kexec/kexec-syscall.h | 4 ++++ purgatory/arch/x86_64/Makefile | 4 +++- 4 files changed, 20 insertions(+), 1 deletion(-)configure.ac +9
-0@@ -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])kexec/arch/x86_64/kexec-elf-rel-x86_64.c +4
-0@@ -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 ) {kexec/kexec-syscall.h +4
-0@@ -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 purgatory/arch/x86_64/Makefile +1
-1@@ -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)
Quoted 8 lines
purgatory/arch/x86_64/Makefile x86_64_PURGATORY_SRCS += purgatory/arch/i386/console-x86.c · line 28
Quoted 2 lines
purgatory/arch/x86_64/Makefile +2
-0+ x86_64_PURGATORY_EXTRA_CFLAGS = -mcmodel=large +endif_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 4 lines · Simon Horman
Quoted 1 line · Aníbal Limón
Any comment or feedback?
I feel like I am missing something obvious, but could you explain the use case a little more clearly?
I'm working in the Yocto Project enabling x32 ABI support, the x32 ABI enables programs to work with 32-bit address space and support of benefits of 64-bit mode like register calling convention, this improves performance in some applications, details [1][2].
I don't know if this answer your question?
Cheers,
alimon
[1] https://sites.google.com/site/x32abi/
[2] http://en.wikipedia.org/wiki/X32_ABI
Quoted 83 lines
Quoted 83 lines
alimon
Quoted 79 lines · Aníbal Limón
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 <[email protected]>Signed-off-by Mariano Lopez <[email protected]>--- configure.ac | 9 +++++++++ kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 4 ++++ kexec/kexec-syscall.h | 4 ++++ purgatory/arch/x86_64/Makefile | 4 +++- 4 files changed, 20 insertions(+), 1 deletion(-)configure.ac +9
-0@@ -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])kexec/arch/x86_64/kexec-elf-rel-x86_64.c +4
-0@@ -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 ) {kexec/kexec-syscall.h +4
-0@@ -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 purgatory/arch/x86_64/Makefile +0
-1@@ -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
Quoted 8 lines
Quoted 8 lines
purgatory/arch/x86_64/Makefile x86_64_PURGATORY_SRCS += purgatory/arch/i386/console-x86.c · line 28
Quoted 3 lines
purgatory/arch/x86_64/Makefile +3
-0+ifeq ($(SUBARCH),64) + x86_64_PURGATORY_EXTRA_CFLAGS = -mcmodel=large +endif_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 15 lines · Aníbal Limón
Quoted 4 lines · Simon Horman
Quoted 1 line · Aníbal Limón
Any comment or feedback?
I feel like I am missing something obvious, but could you explain the use case a little more clearly?
I'm working in the Yocto Project enabling x32 ABI support, the x32 ABI enables
programs to work with 32-bit address space and support of benefits of 64-bit mode
like register calling convention, this improves performance in some applications,
details [1][2].
Quoted 1 line
I don't know if this answer your question?
Thanks, that answers my question very well.
I have applied your patch.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Hi Simon,
I did more testing and found that the patch causes a fail when try to compile with zlib and other arch not x86_64, it's related to AC_EGREP_CPP needs previous AC_PROG_CC.
I sent a patch for that,
http://lists.infradead.org/pipermail/kexec/2015-April/013554.html
Sorry for the problems that i may have caused.
Kind regards,
alimon
Quoted 14 lines · Simon Horman
Quoted 13 lines · Aníbal Limón
Quoted 4 lines · Simon Horman
Quoted 1 line · Aníbal Limón
Any comment or feedback?
I feel like I am missing something obvious, but could you explain the use case a little more clearly?
I'm working in the Yocto Project enabling x32 ABI support, the x32 ABI enables
programs to work with 32-bit address space and support of benefits of 64-bit mode
like register calling convention, this improves performance in some applications,
details [1][2].
Quoted 3 lines
Quoted 1 line
I don't know if this answer your question?
Thanks, that answers my question very well.
I have applied your patch.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 11 lines · Aníbal Limón
Hi Simon,
I did more testing and found that the patch causes a fail when try to compile with zlib and other arch not
x86_64, it's related toAC_EGREP_CPPneeds previousAC_PROG_CC.I sent a patch for that,
http://lists.infradead.org/pipermail/kexec/2015-April/013554.html
Sorry for the problems that i may have caused.
Thanks, got it.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec