Re: [PATCH] ARM: select HAVE_FUTEX_CMPXCHG

From: Arnd Bergmann
Date: Fri Sep 17 2021 - 03:11:43 EST


On Mon, Aug 30, 2021 at 11:38 PM 'Nick Desaulniers' via Clang Built
Linux <clang-built-linux@xxxxxxxxxxxxxxxx> wrote:
>
> tglx notes:
> This function [futex_detect_cmpxchg] is only needed when an
> architecture has to runtime discover whether the CPU supports it or
> not. ARM has unconditional support for this, so the obvious thing to
> do is the below.
>
> Fixes linkage failure from Clang randconfigs:
> kernel/futex.o:(.text.fixup+0x5c): relocation truncated to fit: R_ARM_JUMP24 against `.init.text'
> and boot failures for CONFIG_THUMB2_KERNEL.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/325
> Reported-by: Arnd Bergmann <arnd@xxxxxxxx>
> Reported-by: Nathan Chancellor <nathan@xxxxxxxxxx>
> Suggested-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Signed-off-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
> ---

Nice! I did remember that we had come up with a number of solutions
for the build error and that at least one of them was an obvious and
nice fix, but I could never figure out what it was. This is clearly better
than any of the other ones I had found when I last looked.

I would add a reference to the commit that introduced the conditional,
and a request for backports as well:

See-also: 03b8c7b623c8 ("futex: Allow architectures to skip
futex_atomic_cmpxchg_inatomic() test")
Cc: stable@xxxxxxxxxxxxxxx # v3.14+
Reviewed-by: Arnd Bergmann <arnd@xxxxxxxx>