diff mbox

[v3,2/5] arm/config: Declare ELFSIZE_[32|64] respectively.

Message ID 20160212155642.GC28574@char.us.oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Konrad Rzeszutek Wilk Feb. 12, 2016, 3:56 p.m. UTC
On Fri, Feb 12, 2016 at 03:26:14PM +0000, Stefano Stabellini wrote:
> On Fri, 12 Feb 2016, Jan Beulich wrote:
> > >>> On 12.02.16 at 15:17, <konrad.wilk@oracle.com> wrote:
> > > --- a/xen/include/asm-arm/config.h
> > > +++ b/xen/include/asm-arm/config.h
> > > @@ -15,8 +15,10 @@
> > >  
> > >  #if defined(CONFIG_ARM_64)
> > >  # define LONG_BYTEORDER 3
> > > +# define ELFSIZE 64
> > >  #else
> > >  # define LONG_BYTEORDER 2
> > > +# define ELFSIZE 64
> > >  #endif
> > 
> > Leaving the question - why twice instead of outside the #ifdef?
> 
> Right, please move it out of the #ifdef.

Done!

From 32a062c119091f2f3f6a4c540a8098e97c273dd2 Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Date: Fri, 5 Feb 2016 10:44:45 -0500
Subject: [PATCH] arm/config: Declare ELFSIZE_64.

Otherwise any code that tries to use Elf_* macros would
require us to use Elf64_* types instead of the more
friendly Elf_ one.

This is OK to do since 32-bit ARM uses LPAE mode.

CC: ian.campbell@citrix.com
CC: wei.liu2@citrix.com
CC: stefano.stabellini@citrix.com
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 xen/include/asm-arm/config.h | 3 +++
 1 file changed, 3 insertions(+)

Comments

Stefano Stabellini Feb. 12, 2016, 3:57 p.m. UTC | #1
On Fri, 12 Feb 2016, Konrad Rzeszutek Wilk wrote:
> On Fri, Feb 12, 2016 at 03:26:14PM +0000, Stefano Stabellini wrote:
> > On Fri, 12 Feb 2016, Jan Beulich wrote:
> > > >>> On 12.02.16 at 15:17, <konrad.wilk@oracle.com> wrote:
> > > > --- a/xen/include/asm-arm/config.h
> > > > +++ b/xen/include/asm-arm/config.h
> > > > @@ -15,8 +15,10 @@
> > > >  
> > > >  #if defined(CONFIG_ARM_64)
> > > >  # define LONG_BYTEORDER 3
> > > > +# define ELFSIZE 64
> > > >  #else
> > > >  # define LONG_BYTEORDER 2
> > > > +# define ELFSIZE 64
> > > >  #endif
> > > 
> > > Leaving the question - why twice instead of outside the #ifdef?
> > 
> > Right, please move it out of the #ifdef.
> 
> Done!
> 
> >From 32a062c119091f2f3f6a4c540a8098e97c273dd2 Mon Sep 17 00:00:00 2001
> From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Date: Fri, 5 Feb 2016 10:44:45 -0500
> Subject: [PATCH] arm/config: Declare ELFSIZE_64.
> 
> Otherwise any code that tries to use Elf_* macros would
> require us to use Elf64_* types instead of the more
> friendly Elf_ one.
> 
> This is OK to do since 32-bit ARM uses LPAE mode.
> 
> CC: ian.campbell@citrix.com
> CC: wei.liu2@citrix.com
> CC: stefano.stabellini@citrix.com
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>


>  xen/include/asm-arm/config.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h
> index bd832df..a1b968d 100644
> --- a/xen/include/asm-arm/config.h
> +++ b/xen/include/asm-arm/config.h
> @@ -25,6 +25,9 @@
>  /* xen_ulong_t is always 64 bits */
>  #define BITS_PER_XEN_ULONG 64
>  
> +/* And ELF files are also 64-bit. */
> +#define ELFSIZE 64
> +
>  #define CONFIG_PAGING_ASSISTANCE 1
>  
>  #define CONFIG_PAGING_LEVELS 3
> -- 
> 2.1.0
>
Konrad Rzeszutek Wilk Feb. 12, 2016, 5:50 p.m. UTC | #2
On Fri, Feb 12, 2016 at 03:57:25PM +0000, Stefano Stabellini wrote:
> On Fri, 12 Feb 2016, Konrad Rzeszutek Wilk wrote:
> > On Fri, Feb 12, 2016 at 03:26:14PM +0000, Stefano Stabellini wrote:
> > > On Fri, 12 Feb 2016, Jan Beulich wrote:
> > > > >>> On 12.02.16 at 15:17, <konrad.wilk@oracle.com> wrote:
> > > > > --- a/xen/include/asm-arm/config.h
> > > > > +++ b/xen/include/asm-arm/config.h
> > > > > @@ -15,8 +15,10 @@
> > > > >  
> > > > >  #if defined(CONFIG_ARM_64)
> > > > >  # define LONG_BYTEORDER 3
> > > > > +# define ELFSIZE 64
> > > > >  #else
> > > > >  # define LONG_BYTEORDER 2
> > > > > +# define ELFSIZE 64
> > > > >  #endif
> > > > 
> > > > Leaving the question - why twice instead of outside the #ifdef?
> > > 
> > > Right, please move it out of the #ifdef.
> > 
> > Done!
> > 
> > >From 32a062c119091f2f3f6a4c540a8098e97c273dd2 Mon Sep 17 00:00:00 2001
> > From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > Date: Fri, 5 Feb 2016 10:44:45 -0500
> > Subject: [PATCH] arm/config: Declare ELFSIZE_64.
> > 
> > Otherwise any code that tries to use Elf_* macros would
> > require us to use Elf64_* types instead of the more
> > friendly Elf_ one.
> > 
> > This is OK to do since 32-bit ARM uses LPAE mode.
> > 
> > CC: ian.campbell@citrix.com
> > CC: wei.liu2@citrix.com
> > CC: stefano.stabellini@citrix.com
> > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> 
> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

applied. Thanks!
> 
> 
> >  xen/include/asm-arm/config.h | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h
> > index bd832df..a1b968d 100644
> > --- a/xen/include/asm-arm/config.h
> > +++ b/xen/include/asm-arm/config.h
> > @@ -25,6 +25,9 @@
> >  /* xen_ulong_t is always 64 bits */
> >  #define BITS_PER_XEN_ULONG 64
> >  
> > +/* And ELF files are also 64-bit. */
> > +#define ELFSIZE 64
> > +
> >  #define CONFIG_PAGING_ASSISTANCE 1
> >  
> >  #define CONFIG_PAGING_LEVELS 3
> > -- 
> > 2.1.0
> >
Julien Grall March 16, 2016, 5:32 p.m. UTC | #3
Hi Konrad,

Sorry for the late answer on this patch. I noticed the problem while I 
was reviewing your xSplice patch series.

On 12/02/2016 15:56, Konrad Rzeszutek Wilk wrote:
>  From 32a062c119091f2f3f6a4c540a8098e97c273dd2 Mon Sep 17 00:00:00 2001
> From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Date: Fri, 5 Feb 2016 10:44:45 -0500
> Subject: [PATCH] arm/config: Declare ELFSIZE_64.
>
> Otherwise any code that tries to use Elf_* macros would
> require us to use Elf64_* types instead of the more
> friendly Elf_ one.
>
> This is OK to do since 32-bit ARM uses LPAE mode.

That's not true. Some of structures have a different layout based on the 
file class (i.e ELFSIZE in Xen).

For 32-bit ARM, ELFCLASS32 (i.e 32-bit data types) will always be used. 
So we need to set ELFSIZE to 32.

Otherwise Xen won't be able to interpret correctly the ELF note holding 
the build-id (see [1]).

Regards,

[1] http://lists.xen.org/archives/html/xen-devel/2015-11/msg00632.html
Konrad Rzeszutek Wilk March 16, 2016, 5:52 p.m. UTC | #4
On Wed, Mar 16, 2016 at 05:32:09PM +0000, Julien Grall wrote:
> Hi Konrad,
> 
> Sorry for the late answer on this patch. I noticed the problem while I was
> reviewing your xSplice patch series.
> 
> On 12/02/2016 15:56, Konrad Rzeszutek Wilk wrote:
> > From 32a062c119091f2f3f6a4c540a8098e97c273dd2 Mon Sep 17 00:00:00 2001
> >From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> >Date: Fri, 5 Feb 2016 10:44:45 -0500
> >Subject: [PATCH] arm/config: Declare ELFSIZE_64.
> >
> >Otherwise any code that tries to use Elf_* macros would
> >require us to use Elf64_* types instead of the more
> >friendly Elf_ one.
> >
> >This is OK to do since 32-bit ARM uses LPAE mode.
> 
> That's not true. Some of structures have a different layout based on the
> file class (i.e ELFSIZE in Xen).
> 
> For 32-bit ARM, ELFCLASS32 (i.e 32-bit data types) will always be used. So
> we need to set ELFSIZE to 32.

OK. Let me send out a patch to fix that. Thanks for the heads up!
> 
> Otherwise Xen won't be able to interpret correctly the ELF note holding the
> build-id (see [1]).
> 
> Regards,
> 
> [1] http://lists.xen.org/archives/html/xen-devel/2015-11/msg00632.html
> 
> -- 
> Julien Grall
Julien Grall March 16, 2016, 6:08 p.m. UTC | #5
Hi Konrad

On 16/03/2016 17:52, Konrad Rzeszutek Wilk wrote:
> On Wed, Mar 16, 2016 at 05:32:09PM +0000, Julien Grall wrote:
>> Sorry for the late answer on this patch. I noticed the problem while I was
>> reviewing your xSplice patch series.
>>
>> On 12/02/2016 15:56, Konrad Rzeszutek Wilk wrote:
>>>  From 32a062c119091f2f3f6a4c540a8098e97c273dd2 Mon Sep 17 00:00:00 2001
>>> From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>>> Date: Fri, 5 Feb 2016 10:44:45 -0500
>>> Subject: [PATCH] arm/config: Declare ELFSIZE_64.
>>>
>>> Otherwise any code that tries to use Elf_* macros would
>>> require us to use Elf64_* types instead of the more
>>> friendly Elf_ one.
>>>
>>> This is OK to do since 32-bit ARM uses LPAE mode.
>>
>> That's not true. Some of structures have a different layout based on the
>> file class (i.e ELFSIZE in Xen).
>>
>> For 32-bit ARM, ELFCLASS32 (i.e 32-bit data types) will always be used. So
>> we need to set ELFSIZE to 32.
>
> OK. Let me send out a patch to fix that. Thanks for the heads up!

With this change, do you need to revise the answer to the question Jan 
raised in the design document about ARM32 and the ELF payload declaring 
the ELF only 64-bit syntax?

Regards,
Konrad Rzeszutek Wilk March 16, 2016, 7:21 p.m. UTC | #6
On Wed, Mar 16, 2016 at 06:08:06PM +0000, Julien Grall wrote:
> Hi Konrad
> 
> On 16/03/2016 17:52, Konrad Rzeszutek Wilk wrote:
> >On Wed, Mar 16, 2016 at 05:32:09PM +0000, Julien Grall wrote:
> >>Sorry for the late answer on this patch. I noticed the problem while I was
> >>reviewing your xSplice patch series.
> >>
> >>On 12/02/2016 15:56, Konrad Rzeszutek Wilk wrote:
> >>> From 32a062c119091f2f3f6a4c540a8098e97c273dd2 Mon Sep 17 00:00:00 2001
> >>>From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> >>>Date: Fri, 5 Feb 2016 10:44:45 -0500
> >>>Subject: [PATCH] arm/config: Declare ELFSIZE_64.
> >>>
> >>>Otherwise any code that tries to use Elf_* macros would
> >>>require us to use Elf64_* types instead of the more
> >>>friendly Elf_ one.
> >>>
> >>>This is OK to do since 32-bit ARM uses LPAE mode.
> >>
> >>That's not true. Some of structures have a different layout based on the
> >>file class (i.e ELFSIZE in Xen).
> >>
> >>For 32-bit ARM, ELFCLASS32 (i.e 32-bit data types) will always be used. So
> >>we need to set ELFSIZE to 32.
> >
> >OK. Let me send out a patch to fix that. Thanks for the heads up!
> 
> With this change, do you need to revise the answer to the question Jan
> raised in the design document about ARM32 and the ELF payload declaring the
> ELF only 64-bit syntax?

Yes I will. Thank you for raising that as I completly forgot it!

I think we can still keep the same structure and size. But instead of
using ELF types in the design (and in the code) I will swap them to
proper uintXX_t types.

> 
> Regards,
> 
> -- 
> Julien Grall
diff mbox

Patch

diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h
index bd832df..a1b968d 100644
--- a/xen/include/asm-arm/config.h
+++ b/xen/include/asm-arm/config.h
@@ -25,6 +25,9 @@ 
 /* xen_ulong_t is always 64 bits */
 #define BITS_PER_XEN_ULONG 64
 
+/* And ELF files are also 64-bit. */
+#define ELFSIZE 64
+
 #define CONFIG_PAGING_ASSISTANCE 1
 
 #define CONFIG_PAGING_LEVELS 3