[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOdm4148KZ=eiGU-K0M-1RX_Fwnrh0n0Cj_ON+N63D5AfAQ@mail.gmail.com>
Date: Mon, 28 Aug 2023 13:09:13 -0700
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Bill Wendling <morbo@...gle.com>, Helge Deller <deller@....de>,
Nathan Chancellor <nathan@...nel.org>,
linux-kernel@...r.kernel.org, linux-parisc@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Chanho Min <chanho.min@....com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Kees Cook <keescook@...omium.org>,
clang-built-linux <llvm@...ts.linux.dev>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>
Subject: Re: [PATCH] lib/clz_ctz.c: Fix __clzdi2() and __ctzdi2() for 32-bit kernels
On Mon, Aug 28, 2023 at 12:33 AM Geert Uytterhoeven
<geert@...ux-m68k.org> wrote:
>
> Hi Linus,
>
> On Sat, Aug 26, 2023 at 3:08 AM Linus Torvalds
> <torvalds@...ux-foundation.org> wrote:
> > On Fri, 25 Aug 2023 at 17:52, Nick Desaulniers <ndesaulniers@...gle.com> wrote:
> > And quite often we simply use other names - but then we also do *not*
> > build with -freestanding, because -freestanding has at least
> > traditionally meant that the compiler won't optimize the simple and
> > obvious cases (typically things like "memcpy with a constant size").
>
> Several architectures (incl. x86, but excl. amd64) do build the kernel with
> -freestanding.
>
> IIRC, the issue was that without that, gcc was "optimizing" calls
> to standard functions (implemented as inline optimized assembler
> functions) by replacing them with calls to other standard functions
> (also implemented as inline optimized assembler functions). As the
> latter became external calls, this defeated the optimized assembler
> implementation, and could even cause build failures if no external
> implementation was available.
That's what the -fno-builtin-* flags are for, IMO, though those also
have toolchain portability issues IME.
--
Thanks,
~Nick Desaulniers
Powered by blists - more mailing lists