Re: [PATCH v3 1/1] x86, relocs: add printf attribute to die()

From: Ingo Molnar
Date: Thu Feb 02 2017 - 14:30:41 EST



* hpa@xxxxxxxxx <hpa@xxxxxxxxx> wrote:

> On February 1, 2017 11:16:00 PM PST, Ingo Molnar <mingo@xxxxxxxxxx> wrote:
> >
> >* Nicolas Iooss <nicolas.iooss_linux@xxxxxxx> wrote:
> >
> >> With %Ld, my compiler (gcc 6.3.1 on x86_64) complains:
> >>
> >> arch/x86/tools/relocs.c:400:7: error: format â%Ldâ expects argument
> >of
> >> type âlong long intâ, but argument 2 has type âElf64_Off {aka long
> >> unsigned int}â [-Werror=format=]
> >
> >How did it pick up that type as an 'unsigned long'? We have:
> >
> > include/uapi/linux/elf.h:typedef __u64 Elf64_Off;
> >
> >Even user-space has it as a pure 64-bit type:
> >
> > /usr/include/elf.h:typedef uint64_t Elf64_Off;
> >
> >Thanks,
> >
> > Ingo
>
> uint64_t is unsigned long on x86-64.

Sight, which is a big, lame mistake, because it forces such crap like "PRIu64"
uglies...

Thanks,

Ingo