Re: X86 GIT GCC 5 compilation warning
From: Michael Matz
Date: Mon Jun 15 2015 - 07:30:25 EST
Hi,
On Sun, 14 Jun 2015, Borislav Petkov wrote:
> > arch/x86/kernel/head_32.S:66: Warning: shift count out of range (32 is not between 0 and 31)
>
> That's
>
> LOWMEM_PAGES = (((1<<32) - __PAGE_OFFSET) >> PAGE_SHIFT)
>
> and a 32-bit build. So gas hasn't been complaning so far about this.
This warning is in gas since 2009 (commit d85733c8). In this case it only
happens when the internal type to represent values is 32 bit, which
happens only when binutils is compiled for only non-64bit architectures,
_on_ a non-64bit architecture (e.g. when it's compiled on i386 for i386).
This has nothing to do with GCC, but must be a change in his binutils.
> Judging by the warning, it seems gas considers the "1" a 4-byte type now
> and complains about the shift overflow.
gas internally converts all values to a common type valueT (or offsetT),
which is either a 64bit type if necessary for the target, or simply
(unsigned) long. So if compiled on a 32bit arch, for only 32bit targets
it will be a 32bit type, and the warning will trigger.
E.g. on a gas compiled with gcc -m32 and for i386-unknown-linux-gnu:
% gas/as-new bla.s
bla.s: Assembler messages:
bla.s:3: Warning: shift count out of range (32 is not between 0 and 31)
(This doesn't happen when the gas is compiled on e.g. x86-64-linux or for
a 64bit target, or with --enable-64-bit-bfd)
Ciao,
Michael.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/