* [PATCH] x86_64: Add support to build kexec-tools with x32 ABI
@ 2015-03-26 16:19 Aníbal Limón
2015-04-03 16:05 ` Aníbal Limón
0 siblings, 1 reply; 7+ messages in thread
From: Aníbal Limón @ 2015-03-26 16:19 UTC (permalink / raw)
To: kexec; +Cc: Mariano Lopez, horms, 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 <anibal.limon@linux.intel.com>
Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
---
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(-)
diff --git a/configure.ac b/configure.ac
index c410e90..1ecadd5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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])
diff --git a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
index c795037..06db7f0 100644
--- a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
+++ b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
@@ -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) {
diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
index ce2e20b..cab5535 100644
--- a/kexec/kexec-syscall.h
+++ b/kexec/kexec-syscall.h
@@ -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
diff --git a/purgatory/arch/x86_64/Makefile b/purgatory/arch/x86_64/Makefile
index 7300937..4af11e4 100644
--- a/purgatory/arch/x86_64/Makefile
+++ b/purgatory/arch/x86_64/Makefile
@@ -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
--
1.8.4.5
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] x86_64: Add support to build kexec-tools with x32 ABI
2015-03-26 16:19 [PATCH] x86_64: Add support to build kexec-tools with x32 ABI Aníbal Limón
@ 2015-04-03 16:05 ` Aníbal Limón
2015-04-06 1:04 ` Simon Horman
0 siblings, 1 reply; 7+ messages in thread
From: Aníbal Limón @ 2015-04-03 16:05 UTC (permalink / raw)
To: kexec; +Cc: Mariano Lopez, horms
Any comment or feedback?
alimon
On 26/03/15 10:19, Aníbal Limón wrote:
> 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>
> ---
> 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(-)
>
> diff --git a/configure.ac b/configure.ac
> index c410e90..1ecadd5 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -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])
> diff --git a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
> index c795037..06db7f0 100644
> --- a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
> +++ b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
> @@ -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) {
> diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
> index ce2e20b..cab5535 100644
> --- a/kexec/kexec-syscall.h
> +++ b/kexec/kexec-syscall.h
> @@ -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
> diff --git a/purgatory/arch/x86_64/Makefile b/purgatory/arch/x86_64/Makefile
> index 7300937..4af11e4 100644
> --- a/purgatory/arch/x86_64/Makefile
> +++ b/purgatory/arch/x86_64/Makefile
> @@ -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
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] x86_64: Add support to build kexec-tools with x32 ABI
2015-04-03 16:05 ` Aníbal Limón
@ 2015-04-06 1:04 ` Simon Horman
2015-04-06 15:55 ` Aníbal Limón
0 siblings, 1 reply; 7+ messages in thread
From: Simon Horman @ 2015-04-06 1:04 UTC (permalink / raw)
To: Aníbal Limón; +Cc: Mariano Lopez, kexec
On Fri, Apr 03, 2015 at 10:05:06AM -0600, Aníbal Limón wrote:
> Any comment or feedback?
I feel like I am missing something obvious, but
could you explain the use case a little more clearly?
>
> alimon
>
> On 26/03/15 10:19, Aníbal Limón wrote:
> >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>
> >---
> > 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(-)
> >
> >diff --git a/configure.ac b/configure.ac
> >index c410e90..1ecadd5 100644
> >--- a/configure.ac
> >+++ b/configure.ac
> >@@ -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])
> >diff --git a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
> >index c795037..06db7f0 100644
> >--- a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
> >+++ b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
> >@@ -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) {
> >diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
> >index ce2e20b..cab5535 100644
> >--- a/kexec/kexec-syscall.h
> >+++ b/kexec/kexec-syscall.h
> >@@ -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
> >diff --git a/purgatory/arch/x86_64/Makefile b/purgatory/arch/x86_64/Makefile
> >index 7300937..4af11e4 100644
> >--- a/purgatory/arch/x86_64/Makefile
> >+++ b/purgatory/arch/x86_64/Makefile
> >@@ -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
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] x86_64: Add support to build kexec-tools with x32 ABI
2015-04-06 1:04 ` Simon Horman
@ 2015-04-06 15:55 ` Aníbal Limón
2015-04-07 1:23 ` Simon Horman
0 siblings, 1 reply; 7+ messages in thread
From: Aníbal Limón @ 2015-04-06 15:55 UTC (permalink / raw)
To: Simon Horman; +Cc: Mariano Lopez, kexec
On 05/04/15 20:04, Simon Horman wrote:
> On Fri, Apr 03, 2015 at 10:05:06AM -0600, Aníbal Limón wrote:
>> 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
>
>> alimon
>>
>> On 26/03/15 10:19, Aníbal Limón wrote:
>>> 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>
>>> ---
>>> 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(-)
>>>
>>> diff --git a/configure.ac b/configure.ac
>>> index c410e90..1ecadd5 100644
>>> --- a/configure.ac
>>> +++ b/configure.ac
>>> @@ -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])
>>> diff --git a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
>>> index c795037..06db7f0 100644
>>> --- a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
>>> +++ b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
>>> @@ -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) {
>>> diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
>>> index ce2e20b..cab5535 100644
>>> --- a/kexec/kexec-syscall.h
>>> +++ b/kexec/kexec-syscall.h
>>> @@ -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
>>> diff --git a/purgatory/arch/x86_64/Makefile b/purgatory/arch/x86_64/Makefile
>>> index 7300937..4af11e4 100644
>>> --- a/purgatory/arch/x86_64/Makefile
>>> +++ b/purgatory/arch/x86_64/Makefile
>>> @@ -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
>> kexec@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] x86_64: Add support to build kexec-tools with x32 ABI
2015-04-06 15:55 ` Aníbal Limón
@ 2015-04-07 1:23 ` Simon Horman
2015-04-08 17:53 ` Aníbal Limón
0 siblings, 1 reply; 7+ messages in thread
From: Simon Horman @ 2015-04-07 1:23 UTC (permalink / raw)
To: Aníbal Limón; +Cc: Mariano Lopez, kexec
On Mon, Apr 06, 2015 at 10:55:47AM -0500, Aníbal Limón wrote:
>
> On 05/04/15 20:04, Simon Horman wrote:
> >On Fri, Apr 03, 2015 at 10:05:06AM -0600, Aníbal Limón wrote:
> >>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?
Thanks, that answers my question very well.
I have applied your patch.
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] x86_64: Add support to build kexec-tools with x32 ABI
2015-04-07 1:23 ` Simon Horman
@ 2015-04-08 17:53 ` Aníbal Limón
2015-04-09 2:10 ` Simon Horman
0 siblings, 1 reply; 7+ messages in thread
From: Aníbal Limón @ 2015-04-08 17:53 UTC (permalink / raw)
To: Simon Horman; +Cc: 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
On 06/04/15 20:23, Simon Horman wrote:
> On Mon, Apr 06, 2015 at 10:55:47AM -0500, Aníbal Limón wrote:
>> On 05/04/15 20:04, Simon Horman wrote:
>>> On Fri, Apr 03, 2015 at 10:05:06AM -0600, Aníbal Limón wrote:
>>>> 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?
> Thanks, that answers my question very well.
> I have applied your patch.
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-04-09 2:11 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-26 16:19 [PATCH] x86_64: Add support to build kexec-tools with x32 ABI Aníbal Limón
2015-04-03 16:05 ` Aníbal Limón
2015-04-06 1:04 ` Simon Horman
2015-04-06 15:55 ` Aníbal Limón
2015-04-07 1:23 ` Simon Horman
2015-04-08 17:53 ` Aníbal Limón
2015-04-09 2:10 ` Simon Horman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.