Re: [PATCH 1/2] futex: mark futex_detect_cmpxchg() as 'noinline'

From: Joe Perches
Date: Thu Mar 07 2019 - 12:21:02 EST


On Thu, 2019-03-07 at 10:14 +0100, Arnd Bergmann wrote:
> On 32-bit ARM, I got a link failure in futex_init() when building
> with clang in some random configurations:
>
> kernel/futex.o:(.text.fixup+0x5c): relocation truncated to fit: R_ARM_JUMP24 against `.init.text'
>
> As far as I can tell, the problem is that a branch is over 16MB
> apart in those configurations, but only if it branches back to
> the init text.
>
> Marking the futex_detect_cmpxchg() function as noinline and
> not __init avoids the problem for me.

Perhaps the __init and __exit #defines should be noinline
to allow discarding of the code.

These defines are already marked with __section so I'd've
expected these to be noinline anyway.

---
include/linux/init.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/init.h b/include/linux/init.h
index 5255069f5a9f..806215a74064 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -47,7 +47,7 @@

/* These are for everybody (although not all archs will actually
discard it in modules) */
-#define __init __section(.init.text) __cold __latent_entropy __noinitretpoline
+#define __init __section(.init.text) __cold __latent_entropy __noinitretpoline noinline
#define __initdata __section(.init.data)
#define __initconst __section(.init.rodata)
#define __exitdata __section(.exit.data)
@@ -80,7 +80,7 @@
#define __exitused __used
#endif

-#define __exit __section(.exit.text) __exitused __cold notrace
+#define __exit __section(.exit.text) __exitused __cold notrace noinline

/* Used for MEMORY_HOTPLUG */
#define __meminit __section(.meminit.text) __cold notrace \