lkml.org 
[lkml]   [2015]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: X86 GIT GCC 5 compilation warning
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.


\
 
 \ /
  Last update: 2015-06-15 14:21    [W:0.101 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site