All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: axboe@kernel.dk, josef@toxicpanda.com, libaokun1@huawei.com,
	 linux-kernel@vger.kernel.org, linux-next@vger.kernel.org,
	 llvm@lists.linux.dev, Arnd Bergmann <arnd@kernel.org>,
	 Nathan Chancellor <nathan@kernel.org>,
	sfr@canb.auug.org.au
Subject: Re: linux-next: build failure while building Linus' tree
Date: Fri, 10 Sep 2021 15:34:58 -0700	[thread overview]
Message-ID: <CAKwvOdkc9oQWh8tFobxS9NTGsyyeWHLz9+RQ2bgxFawob0hEwQ@mail.gmail.com> (raw)
In-Reply-To: <CAKwvOdnDOQPRe3v7ZD6SRR=TgbLqo1wfn_zmgfJpbqGEZyJ1-Q@mail.gmail.com>

On Fri, Sep 10, 2021 at 3:26 PM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Fri, Sep 10, 2021 at 3:17 PM Nick Desaulniers
> <ndesaulniers@google.com> wrote:
> >
> > On Fri, Sep 10, 2021 at 3:02 PM Nick Desaulniers
> > <ndesaulniers@google.com> wrote:
> > >
> > > On Thu, Sep 9, 2021 at 3:50 PM Nick Desaulniers <ndesaulniers@google.com> wrote:
> > > >
> > > > + Rasmus
> > > >
> > > > This was introduced in
> > > > commit f0907827a8a91 ("compiler.h: enable builtin overflow checkers and add
> > > > fallback code")
> > > > which added division using the `/` operator, which is problematic when checking
> > > > for overflows of 64b operands on 32b targets.
> > > >
> > > > We'll probably need helpers from linux/math64.h and some combination of
> > > > __builtin_choose_expr/__builtin_types_compatible_p.
> > > >
> > > > That will help us fix another compiler bug for older clang releases, too.
> > > > https://github.com/ClangBuiltLinux/linux/issues/1438.
> > >
> > > Ok, I have something hacked up that I think will work:
> > > https://gist.github.com/nickdesaulniers/2479818f4983bbf2d688cebbab435863
> >
> > hmm...playing around with adding some static asserts to the above, I
>
> ah! static_assert can't be used for the type agnostic macros,
> BUILD_BUG_ON needs to be used in its place. Ok, let me add a few and
> see if that can help instill some confidence here.

Ah, I just saw your comment now about raising the minimum required
version of gcc to 5.1.
https://github.com/ClangBuiltLinux/linux/issues/1438#issuecomment-916745801

> > > This incomplete diff is a little hacked up to reproduce the issue with
> > > a known-bad revision of clang that demonstrates a similar issue to GCC
> > > 4.9.  You can ignore the movement of check_mul_overflow and friends in
> > > include/linux/overflow.h.
> > >
> > > I think I'm going to break that up into 2 or 3 patches:
> > > 1. move is_signed_type from include/linux/overflow.h to perhaps
> > > include/linux/typecheck.h.
> > > 2. add div64_x64, div_x64, and div_64 to include/linux/math64.h, use
> > > them in include/linux/overflow.h to fix GCC 4.9
> > > 3. move multiply fallbacks out of
> > > COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW for clang < 14.

In that case, I do have __mulodi4() rewritten from compiler-rt to be
usable in the kernel.
-- 
Thanks,
~Nick Desaulniers

  reply	other threads:[~2021-09-10 22:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-09  8:25 linux-next: build failure while building Linus' tree Stephen Rothwell
2021-09-09 22:50 ` Nick Desaulniers
2021-09-09 22:50   ` Nick Desaulniers
2021-09-10 22:02   ` Nick Desaulniers
2021-09-10 22:02     ` Nick Desaulniers
2021-09-10 22:17     ` Nick Desaulniers
2021-09-10 22:17       ` Nick Desaulniers
2021-09-10 22:26       ` Nick Desaulniers
2021-09-10 22:26         ` Nick Desaulniers
2021-09-10 22:34         ` Nick Desaulniers [this message]
2021-09-10 22:34           ` Nick Desaulniers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKwvOdkc9oQWh8tFobxS9NTGsyyeWHLz9+RQ2bgxFawob0hEwQ@mail.gmail.com \
    --to=ndesaulniers@google.com \
    --cc=arnd@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=josef@toxicpanda.com \
    --cc=libaokun1@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=sfr@canb.auug.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.