Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1697113

Re: Sparse warnings on GENMASK + arm32

From Christopher Li <sparse@chrisli.org>
Newsgroups linux.kernel
Subject Re: Sparse warnings on GENMASK + arm32
Date 2017-07-26 15:50 +0200
Message-ID <u7uRk-Xi-19@gated-at.bofh.it> (permalink)
References <u7jsR-29R-7@gated-at.bofh.it> <u7uHE-SQ-33@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Jul 26, 2017 at 9:33 AM, Lance Richardson <lrichard@redhat.com> wrote:
> Hmm, it seems sparse is incorrectly taking ~0UL to be a 64-bit value
> while BITS_PER_LONG is (correctly) evaluated to be 32.
>
> #define GENMASK(h, l) \
>         (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
>
What is the sizeof(unsigned long) in ARM 32 bit world?

~0UL has the type of "unsigned long", I assume BITS_PER_LONG
is just plain "int"? Using sparse -E should be able to get the expression
after the macro expression.

The kernel compile invoke sparse directly. That is the assumption
that the host gcc has the same type size as the target gcc.
That is no longer true if you have cross compiler.

If you want to have sparse understand the proper architecture difference,
the current practices is using cgcc to handle the architecture specific
macros.

you can try to invoke the kernel building with: CHECK="cgcc -no-compile".
Warning: I haven't try that myself, it might not work as expected.

In the long run, I do wish sparse can implement the proper handling of
the architecture specific stuff by itself without go through of cgcc.

Chris

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Sparse warnings on GENMASK + arm32 Stephen Boyd <sboyd@codeaurora.org> - 2017-07-26 03:40 +0200
  Re: Sparse warnings on GENMASK + arm32 Lance Richardson <lrichard@redhat.com> - 2017-07-26 15:40 +0200
    Re: Sparse warnings on GENMASK + arm32 Christopher Li <sparse@chrisli.org> - 2017-07-26 15:50 +0200
    Re: Sparse warnings on GENMASK + arm32 Luc Van Oostenryck <luc.vanoostenryck@gmail.com> - 2017-07-26 15:50 +0200

csiph-web