Re: [PATCH] lib/clz_ctz.c: Fix __clzdi2() and __ctzdi2() for 32-bit kernels

From: Geert Uytterhoeven
Date: Mon Aug 28 2023 - 03:34:23 EST


Hi Linus,

On Sat, Aug 26, 2023 at 3:08 AM Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Fri, 25 Aug 2023 at 17:52, Nick Desaulniers <ndesaulniers@xxxxxxxxxx> 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.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds