diff mbox

[for-4.7] mkelf32: fix compilation on 32 bit build host

Message ID 1461950731-14212-1-git-send-email-wei.liu2@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Liu April 29, 2016, 5:25 p.m. UTC
When cross-compiling xen on a 32 bit build host:

boot/mkelf32.c: In function 'main':
boot/mkelf32.c:360:21: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'Elf64_Off' [-Werror=format]
cc1: all warnings being treated as errors

Fix that by using PRId64 in format string.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 xen/arch/x86/boot/mkelf32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andrew Cooper April 29, 2016, 5:26 p.m. UTC | #1
On 29/04/16 18:25, Wei Liu wrote:
> When cross-compiling xen on a 32 bit build host:
>
> boot/mkelf32.c: In function 'main':
> boot/mkelf32.c:360:21: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'Elf64_Off' [-Werror=format]
> cc1: all warnings being treated as errors
>
> Fix that by using PRId64 in format string.
>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Konrad Rzeszutek Wilk April 29, 2016, 5:26 p.m. UTC | #2
On Fri, Apr 29, 2016 at 06:25:31PM +0100, Wei Liu wrote:
> When cross-compiling xen on a 32 bit build host:
> 
> boot/mkelf32.c: In function 'main':
> boot/mkelf32.c:360:21: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'Elf64_Off' [-Werror=format]
> cc1: all warnings being treated as errors
> 
> Fix that by using PRId64 in format string.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

and Reviewed-by too if you want that.
> ---
>  xen/arch/x86/boot/mkelf32.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/xen/arch/x86/boot/mkelf32.c b/xen/arch/x86/boot/mkelf32.c
> index 8c51990..6cfa312 100644
> --- a/xen/arch/x86/boot/mkelf32.c
> +++ b/xen/arch/x86/boot/mkelf32.c
> @@ -356,7 +356,7 @@ int main(int argc, char **argv)
>          if ( in64_phdr.p_offset > dat_siz || offset > in64_phdr.p_offset )
>          {
>              fprintf(stderr, "Expected .note section within .text section!\n" \
> -                    "Offset %ld not within %d!\n",
> +                    "Offset %"PRId64" not within %d!\n",
>                      in64_phdr.p_offset, dat_siz);
>              return 1;
>          }
> -- 
> 2.1.4
>
Wei Liu April 29, 2016, 5:28 p.m. UTC | #3
On Fri, Apr 29, 2016 at 01:26:39PM -0400, Konrad Rzeszutek Wilk wrote:
> On Fri, Apr 29, 2016 at 06:25:31PM +0100, Wei Liu wrote:
> > When cross-compiling xen on a 32 bit build host:
> > 
> > boot/mkelf32.c: In function 'main':
> > boot/mkelf32.c:360:21: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'Elf64_Off' [-Werror=format]
> > cc1: all warnings being treated as errors
> > 
> > Fix that by using PRId64 in format string.
> > 
> > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> 
> Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> 
> and Reviewed-by too if you want that.

Release-acked-by: Wei Liu <wei.liu2@citrix.com>

(Feel a bit silly to do this to my own patch)

Please push it when convenient.

> > ---
> >  xen/arch/x86/boot/mkelf32.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/xen/arch/x86/boot/mkelf32.c b/xen/arch/x86/boot/mkelf32.c
> > index 8c51990..6cfa312 100644
> > --- a/xen/arch/x86/boot/mkelf32.c
> > +++ b/xen/arch/x86/boot/mkelf32.c
> > @@ -356,7 +356,7 @@ int main(int argc, char **argv)
> >          if ( in64_phdr.p_offset > dat_siz || offset > in64_phdr.p_offset )
> >          {
> >              fprintf(stderr, "Expected .note section within .text section!\n" \
> > -                    "Offset %ld not within %d!\n",
> > +                    "Offset %"PRId64" not within %d!\n",
> >                      in64_phdr.p_offset, dat_siz);
> >              return 1;
> >          }
> > -- 
> > 2.1.4
> >
diff mbox

Patch

diff --git a/xen/arch/x86/boot/mkelf32.c b/xen/arch/x86/boot/mkelf32.c
index 8c51990..6cfa312 100644
--- a/xen/arch/x86/boot/mkelf32.c
+++ b/xen/arch/x86/boot/mkelf32.c
@@ -356,7 +356,7 @@  int main(int argc, char **argv)
         if ( in64_phdr.p_offset > dat_siz || offset > in64_phdr.p_offset )
         {
             fprintf(stderr, "Expected .note section within .text section!\n" \
-                    "Offset %ld not within %d!\n",
+                    "Offset %"PRId64" not within %d!\n",
                     in64_phdr.p_offset, dat_siz);
             return 1;
         }