Re: [PATCH 1/1] x86, relocs: add function attributes to die()

From: Nilay Vaish
Date: Sat Sep 03 2016 - 11:18:00 EST


On 3 September 2016 at 09:50, Nicolas Iooss <nicolas.iooss_linux@xxxxxxx> wrote:
>
> arch/x86/tools/relocs.c:460:5: error: format specifies type 'int'
> but the argument has type 'Elf64_Xword' (aka 'unsigned long')
> [-Werror,-Wformat]
> sec->shdr.sh_size);
> ^~~~~~~~~~~~~~~~~
> arch/x86/tools/relocs.c:464:5: error: format specifies type 'int'
> but the argument has type 'Elf64_Off' (aka 'unsigned long')
> [-Werror,-Wformat]
> sec->shdr.sh_offset, strerror(errno));
> ^~~~~~~~~~~~~~~~~~~
>
> To support both 32-bit and 64-bit modes, add casts to long types and use
> %lu and %ld to format the numbers.
>

Nicolas, should not just changing the format specifiers fix the
problem? How do those type casts help?

--
Nilay