Skip to content

Commit 5f5ec16

Browse files
mrutland-armgregkh
authored andcommitted
arm64: fix selection of HAVE_DYNAMIC_FTRACE_WITH_ARGS
commit b3d6121 upstream. The Kconfig logic to select HAVE_DYNAMIC_FTRACE_WITH_ARGS is incorrect, and HAVE_DYNAMIC_FTRACE_WITH_ARGS may be selected when it is not supported by the combination of clang and GNU LD, resulting in link-time errors: aarch64-linux-gnu-ld: .init.data has both ordered [`__patchable_function_entries' in init/main.o] and unordered [`.meminit.data' in mm/sparse.o] sections aarch64-linux-gnu-ld: final link failed: bad value ... which can be seen when building with CC=clang using a binutils version older than 2.36. We originally fixed that in commit: 45bd895 ("arm64: Improve HAVE_DYNAMIC_FTRACE_WITH_REGS selection for clang") ... by splitting the "select HAVE_DYNAMIC_FTRACE_WITH_ARGS" statement into separete CLANG_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS and GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS options which individually select HAVE_DYNAMIC_FTRACE_WITH_ARGS. Subsequently we accidentally re-introduced the common "select HAVE_DYNAMIC_FTRACE_WITH_ARGS" statement in commit: 26299b3 ("ftrace: arm64: move from REGS to ARGS") ... then we removed it again in commit: 68a63a4 ("arm64: Fix build with CC=clang, CONFIG_FTRACE=y and CONFIG_STACK_TRACER=y") ... then we accidentally re-introduced it again in commit: 2aa6ac0 ("arm64: ftrace: Add direct call support") Fix this for the third time by keeping the unified select statement and making this depend onf either GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS or CLANG_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS. This is more consistent with usual style and less likely to go wrong in future. Fixes: 2aa6ac0 ("arm64: ftrace: Add direct call support") Cc: <[email protected]> # 6.4.x Signed-off-by: Mark Rutland <[email protected]> Cc: Will Deacon <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d52c565 commit 5f5ec16

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

arch/arm64/Kconfig

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ config ARM64
191191
select HAVE_DMA_CONTIGUOUS
192192
select HAVE_DYNAMIC_FTRACE
193193
select HAVE_DYNAMIC_FTRACE_WITH_ARGS \
194-
if $(cc-option,-fpatchable-function-entry=2)
194+
if (GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS || \
195+
CLANG_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS)
195196
select HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS \
196197
if DYNAMIC_FTRACE_WITH_ARGS && DYNAMIC_FTRACE_WITH_CALL_OPS
197198
select HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS \
@@ -262,12 +263,10 @@ config CLANG_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS
262263
def_bool CC_IS_CLANG
263264
# https://github.com/ClangBuiltLinux/linux/issues/1507
264265
depends on AS_IS_GNU || (AS_IS_LLVM && (LD_IS_LLD || LD_VERSION >= 23600))
265-
select HAVE_DYNAMIC_FTRACE_WITH_ARGS
266266

267267
config GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS
268268
def_bool CC_IS_GCC
269269
depends on $(cc-option,-fpatchable-function-entry=2)
270-
select HAVE_DYNAMIC_FTRACE_WITH_ARGS
271270

272271
config 64BIT
273272
def_bool y

0 commit comments

Comments
 (0)