All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-4.15] elfstructs: add relocation defines for i386
@ 2021-02-24 14:58 Roger Pau Monne
  2021-02-24 15:01 ` Jan Beulich
  2021-02-24 15:25 ` Ian Jackson
  0 siblings, 2 replies; 4+ messages in thread
From: Roger Pau Monne @ 2021-02-24 14:58 UTC (permalink / raw)
  To: xen-devel
  Cc: Roger Pau Monne, Andrew Cooper, George Dunlap, Ian Jackson,
	Jan Beulich, Julien Grall, Stefano Stabellini, Wei Liu

Those are need by the rombios relocation code in hvmloader. Fixes the
following build error:

32bitbios_support.c: In function 'relocate_32bitbios':
32bitbios_support.c:130:18: error: 'R_386_PC32' undeclared (first use in this function); did you mean 'R_X86_64_PC32'?
             case R_386_PC32:
                  ^~~~~~~~~~
                  R_X86_64_PC32
32bitbios_support.c:130:18: note: each undeclared identifier is reported only once for each function it appears in
32bitbios_support.c:134:18: error: 'R_386_32' undeclared (first use in this function)
             case R_386_32:
                  ^~~~~~~~

Only add the two defines that are actually used, which seems to match
what we do for amd64.

Fixes: 81b2b328a26c1b ('hvmloader: use Xen private header for elf structs')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/include/xen/elfstructs.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/include/xen/elfstructs.h b/xen/include/xen/elfstructs.h
index 726ca8f60d..d1054ae380 100644
--- a/xen/include/xen/elfstructs.h
+++ b/xen/include/xen/elfstructs.h
@@ -348,6 +348,9 @@ typedef struct {
 #define ELF32_R_TYPE(i)		((unsigned char) (i))
 #define ELF32_R_INFO(s,t) 	(((s) << 8) + (unsigned char)(t))
 
+#define R_386_32           1            /* Direct 32 bit  */
+#define R_386_PC32         2            /* PC relative 32 bit */
+
 typedef struct {
 	Elf64_Addr	r_offset;	/* where to do it */
 	Elf64_Xword	r_info;		/* index & type of relocation */
-- 
2.30.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH for-4.15] elfstructs: add relocation defines for i386
  2021-02-24 14:58 [PATCH for-4.15] elfstructs: add relocation defines for i386 Roger Pau Monne
@ 2021-02-24 15:01 ` Jan Beulich
  2021-02-24 15:25   ` Roger Pau Monné
  2021-02-24 15:25 ` Ian Jackson
  1 sibling, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2021-02-24 15:01 UTC (permalink / raw)
  To: Roger Pau Monne
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, xen-devel

On 24.02.2021 15:58, Roger Pau Monne wrote:
> Those are need by the rombios relocation code in hvmloader. Fixes the
> following build error:
> 
> 32bitbios_support.c: In function 'relocate_32bitbios':
> 32bitbios_support.c:130:18: error: 'R_386_PC32' undeclared (first use in this function); did you mean 'R_X86_64_PC32'?
>              case R_386_PC32:
>                   ^~~~~~~~~~
>                   R_X86_64_PC32
> 32bitbios_support.c:130:18: note: each undeclared identifier is reported only once for each function it appears in
> 32bitbios_support.c:134:18: error: 'R_386_32' undeclared (first use in this function)
>              case R_386_32:
>                   ^~~~~~~~
> 
> Only add the two defines that are actually used, which seems to match
> what we do for amd64.
> 
> Fixes: 81b2b328a26c1b ('hvmloader: use Xen private header for elf structs')
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

In principle
Reviewed-by: Jan Beulich <jbeulich@suse.com>

But ...

> --- a/xen/include/xen/elfstructs.h
> +++ b/xen/include/xen/elfstructs.h
> @@ -348,6 +348,9 @@ typedef struct {
>  #define ELF32_R_TYPE(i)		((unsigned char) (i))
>  #define ELF32_R_INFO(s,t) 	(((s) << 8) + (unsigned char)(t))
>  
> +#define R_386_32           1            /* Direct 32 bit  */
> +#define R_386_PC32         2            /* PC relative 32 bit */
> +
>  typedef struct {
>  	Elf64_Addr	r_offset;	/* where to do it */
>  	Elf64_Xword	r_info;		/* index & type of relocation */

... I'm heavily inclined to move this a few lines down to where
the other relocation types get defined, and add a respective
comment.

Jan


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH for-4.15] elfstructs: add relocation defines for i386
  2021-02-24 14:58 [PATCH for-4.15] elfstructs: add relocation defines for i386 Roger Pau Monne
  2021-02-24 15:01 ` Jan Beulich
@ 2021-02-24 15:25 ` Ian Jackson
  1 sibling, 0 replies; 4+ messages in thread
From: Ian Jackson @ 2021-02-24 15:25 UTC (permalink / raw)
  To: Roger Pau Monne
  Cc: xen-devel, Andrew Cooper, George Dunlap, Jan Beulich,
	Julien Grall, Stefano Stabellini, Wei Liu

Roger Pau Monne writes ("[PATCH for-4.15] elfstructs: add relocation defines for i386"):
> Those are need by the rombios relocation code in hvmloader. Fixes the
> following build error:
> 
> 32bitbios_support.c: In function 'relocate_32bitbios':
> 32bitbios_support.c:130:18: error: 'R_386_PC32' undeclared (first use in this function); did you mean 'R_X86_64_PC32'?
>              case R_386_PC32:
>                   ^~~~~~~~~~
>                   R_X86_64_PC32
> 32bitbios_support.c:130:18: note: each undeclared identifier is reported only once for each function it appears in
> 32bitbios_support.c:134:18: error: 'R_386_32' undeclared (first use in this function)
>              case R_386_32:
>                   ^~~~~~~~
> 
> Only add the two defines that are actually used, which seems to match
> what we do for amd64.
> 
> Fixes: 81b2b328a26c1b ('hvmloader: use Xen private header for elf structs')
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Release-Acked-by: Ian Jackson <iwj@xenproject.org>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH for-4.15] elfstructs: add relocation defines for i386
  2021-02-24 15:01 ` Jan Beulich
@ 2021-02-24 15:25   ` Roger Pau Monné
  0 siblings, 0 replies; 4+ messages in thread
From: Roger Pau Monné @ 2021-02-24 15:25 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, xen-devel

On Wed, Feb 24, 2021 at 04:01:13PM +0100, Jan Beulich wrote:
> On 24.02.2021 15:58, Roger Pau Monne wrote:
> > Those are need by the rombios relocation code in hvmloader. Fixes the
> > following build error:
> > 
> > 32bitbios_support.c: In function 'relocate_32bitbios':
> > 32bitbios_support.c:130:18: error: 'R_386_PC32' undeclared (first use in this function); did you mean 'R_X86_64_PC32'?
> >              case R_386_PC32:
> >                   ^~~~~~~~~~
> >                   R_X86_64_PC32
> > 32bitbios_support.c:130:18: note: each undeclared identifier is reported only once for each function it appears in
> > 32bitbios_support.c:134:18: error: 'R_386_32' undeclared (first use in this function)
> >              case R_386_32:
> >                   ^~~~~~~~
> > 
> > Only add the two defines that are actually used, which seems to match
> > what we do for amd64.
> > 
> > Fixes: 81b2b328a26c1b ('hvmloader: use Xen private header for elf structs')
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> 
> In principle
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> 
> But ...
> 
> > --- a/xen/include/xen/elfstructs.h
> > +++ b/xen/include/xen/elfstructs.h
> > @@ -348,6 +348,9 @@ typedef struct {
> >  #define ELF32_R_TYPE(i)		((unsigned char) (i))
> >  #define ELF32_R_INFO(s,t) 	(((s) << 8) + (unsigned char)(t))
> >  
> > +#define R_386_32           1            /* Direct 32 bit  */
> > +#define R_386_PC32         2            /* PC relative 32 bit */
> > +
> >  typedef struct {
> >  	Elf64_Addr	r_offset;	/* where to do it */
> >  	Elf64_Xword	r_info;		/* index & type of relocation */
> 
> ... I'm heavily inclined to move this a few lines down to where
> the other relocation types get defined, and add a respective
> comment.

I've placed it together with the other 32bit ELF relocation structures
and macros, but I see the rest of the relocation defines are a bit
below, feel free to move it. For a comment:

/*
 * Relocation definitions required by the rombios hvmloader relocation
 * code.
 */

Does seem fine?

Thanks, Roger.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-24 15:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-24 14:58 [PATCH for-4.15] elfstructs: add relocation defines for i386 Roger Pau Monne
2021-02-24 15:01 ` Jan Beulich
2021-02-24 15:25   ` Roger Pau Monné
2021-02-24 15:25 ` Ian Jackson

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.