Message ID | 20230404-riscv-dynamic-ftrace-checks-clang-v1-1-0ce296b7d423@kernel.org (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | riscv: Adjust dependencies of HAVE_DYNAMIC_FTRACE selection | expand |
Context | Check | Description |
---|---|---|
conchuod/cover_letter | success | Single patches do not need cover letters |
conchuod/tree_selection | success | Guessed tree name to be for-next at HEAD d34a6b715a23 |
conchuod/fixes_present | success | Fixes tag not required for -next series |
conchuod/maintainers_pattern | success | MAINTAINERS pattern errors before the patch: 1 and now 1 |
conchuod/verify_signedoff | success | Signed-off-by tag matches author and committer |
conchuod/kdoc | success | Errors and warnings before: 0 this patch: 0 |
conchuod/build_rv64_clang_allmodconfig | success | Errors and warnings before: 18 this patch: 18 |
conchuod/module_param | success | Was 0 now: 0 |
conchuod/build_rv64_gcc_allmodconfig | success | Errors and warnings before: 18 this patch: 18 |
conchuod/build_rv32_defconfig | success | Build OK |
conchuod/dtb_warn_rv64 | success | Errors and warnings before: 3 this patch: 3 |
conchuod/header_inline | success | No static functions without inline keyword in header files |
conchuod/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 24 lines checked |
conchuod/source_inline | success | Was 0 now: 0 |
conchuod/build_rv64_nommu_k210_defconfig | success | Build OK |
conchuod/verify_fixes | success | No Fixes tag |
conchuod/build_rv64_nommu_virt_defconfig | success | Build OK |
On Tue, Apr 04, 2023 at 01:34:21PM -0700, Nathan Chancellor wrote: > When building allmodconfig with clang and its integrated assembler and > linking with a version of GNU ld prior to 2.36, the following link error > occurs: > > riscv64-linux-gnu-ld: .init.data has both ordered [`__patchable_function_entries' in init/main.o] and unordered [`.init_array.0' in kernel/trace/trace_benchmark.o] sections > riscv64-linux-gnu-ld: final link failed: bad value > > This is the same error addressed by commit 45bd8951806e ("arm64: Improve > HAVE_DYNAMIC_FTRACE_WITH_REGS selection for clang") for arm64. See that > changelog for a full description of why this error occurs with this > combination of tools. > > In a similar manner as that change, restrict the > CONFIG_HAVE_DYNAMIC_FTRACE selection to combinations of tools known to > work so that there are no errors. > > Link: https://github.com/ClangBuiltLinux/linux/issues/1817 > Signed-off-by: Nathan Chancellor <nathan@kernel.org> > --- > arch/riscv/Kconfig | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig > index eb7f29a412f8..4b82838ac870 100644 > --- a/arch/riscv/Kconfig > +++ b/arch/riscv/Kconfig > @@ -136,12 +136,23 @@ config RISCV > select TRACE_IRQFLAGS_SUPPORT > select UACCESS_MEMCPY if !MMU > select ZONE_DMA32 if 64BIT > - select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && $(cc-option,-fpatchable-function-entry=8) > + select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && (CLANG_SUPPORTS_DYNAMIC_FTRACE || GCC_SUPPORTS_DYNAMIC_FTRACE) > select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE > select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL > select HAVE_FUNCTION_GRAPH_TRACER > select HAVE_FUNCTION_TRACER if !XIP_KERNEL && !PREEMPTION > > +config CLANG_SUPPORTS_DYNAMIC_FTRACE > + def_bool CC_IS_CLANG > + # https://github.com/llvm/llvm-project/commit/6ab8927931851bb42b2c93a00801dc499d7d9b1e > + depends on CLANG_VERSION >= 130000 > + # https://github.com/ClangBuiltLinux/linux/issues/1817 > + depends on AS_IS_GNU || (AS_IS_LLVM && (LD_IS_LLD || LD_VERSION >= 23600)) > + > +config GCC_SUPPORTS_DYNAMIC_FTRACE > + def_bool CC_IS_GCC > + depends on $(cc-option,-fpatchable-function-entry=8) I thought about merging these, but I think you just end up with something that is difficult to grok. Explanation in the arm64 is pretty good & the change follows. Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index eb7f29a412f8..4b82838ac870 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -136,12 +136,23 @@ config RISCV select TRACE_IRQFLAGS_SUPPORT select UACCESS_MEMCPY if !MMU select ZONE_DMA32 if 64BIT - select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && $(cc-option,-fpatchable-function-entry=8) + select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && (CLANG_SUPPORTS_DYNAMIC_FTRACE || GCC_SUPPORTS_DYNAMIC_FTRACE) select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL select HAVE_FUNCTION_GRAPH_TRACER select HAVE_FUNCTION_TRACER if !XIP_KERNEL && !PREEMPTION +config CLANG_SUPPORTS_DYNAMIC_FTRACE + def_bool CC_IS_CLANG + # https://github.com/llvm/llvm-project/commit/6ab8927931851bb42b2c93a00801dc499d7d9b1e + depends on CLANG_VERSION >= 130000 + # https://github.com/ClangBuiltLinux/linux/issues/1817 + depends on AS_IS_GNU || (AS_IS_LLVM && (LD_IS_LLD || LD_VERSION >= 23600)) + +config GCC_SUPPORTS_DYNAMIC_FTRACE + def_bool CC_IS_GCC + depends on $(cc-option,-fpatchable-function-entry=8) + config ARCH_MMAP_RND_BITS_MIN default 18 if 64BIT default 8
When building allmodconfig with clang and its integrated assembler and linking with a version of GNU ld prior to 2.36, the following link error occurs: riscv64-linux-gnu-ld: .init.data has both ordered [`__patchable_function_entries' in init/main.o] and unordered [`.init_array.0' in kernel/trace/trace_benchmark.o] sections riscv64-linux-gnu-ld: final link failed: bad value This is the same error addressed by commit 45bd8951806e ("arm64: Improve HAVE_DYNAMIC_FTRACE_WITH_REGS selection for clang") for arm64. See that changelog for a full description of why this error occurs with this combination of tools. In a similar manner as that change, restrict the CONFIG_HAVE_DYNAMIC_FTRACE selection to combinations of tools known to work so that there are no errors. Link: https://github.com/ClangBuiltLinux/linux/issues/1817 Signed-off-by: Nathan Chancellor <nathan@kernel.org> --- arch/riscv/Kconfig | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) --- base-commit: 4622f159098e098611f393cccf73d52b007e70bc change-id: 20230404-riscv-dynamic-ftrace-checks-clang-6781b41c41ff Best regards,