linux-next: Tree for Aug 21 (riscv-64 asm)
Björn Töpel
bjorn at kernel.org
Wed Aug 23 00:52:04 PDT 2023
Björn Töpel <bjorn at kernel.org> writes:
> Björn Töpel <bjorn at kernel.org> writes:
>
>> Randy Dunlap <rdunlap at infradead.org> writes:
>>
>>> Hi,
>>>
>>> On 8/22/23 01:11, Björn Töpel wrote:
>>>> Randy Dunlap <rdunlap at infradead.org> writes:
>>>>
>>>>> On 8/20/23 23:46, Stephen Rothwell wrote:
>>>>>> Hi all,
>>>>>>
>>>>>> Changes since 20230818:
>>>>>>
>>>>>
>>>>> ../arch/riscv/kernel/traps.c: In function 'do_irq':
>>>>> ../arch/riscv/kernel/traps.c:384:1: error: s0 cannot be used in 'asm' here
>>>>> 384 | }
>>>>> | ^
>>>>> ../arch/riscv/kernel/irq.c: In function 'do_softirq_own_stack':
>>>>> ../arch/riscv/kernel/irq.c:94:1: error: s0 cannot be used in 'asm' here
>>>>> 94 | }
>>>>> | ^
>>>>>
>>>>>
>>>>> 2 out of 10 risc-v 64-bit builds failed with these errors.
>>>>>
>>>>> Is this a toolchain problem or something else?
>>>>
>>>> Hmm, do you have a link to config/toolchain/log, or similar?
>>>
>>> The full randconfig file is attached.
>>>
>>> The toolchain is Arnd's build of gcc 13.1.0 from:
>>> https://mirrors.edge.kernel.org/pub/tools/crosstool/
>>> (x86_64 host)
>>>
>>> Hm, I see that the latest/current there is gcc 13.2.0.
>>> I'll upgrade later today.
>>
>> Thanks Randy! I can reproduce with GCC 12 on my machine.
>>
>> The config has
>> | # CONFIG_FRAME_POINTER is not set
>> but for some reason "-fno-omit-frame-pointer" is passed to GCC anyway,
>> which is why GCC complains about s0 (FP on RISC-V) in asm.
>>
>>
>> I'll dig a bit more.
>
> There are multiple issues:
> * riscv enables -fno-omit-frame-pointer unconditionally for PERF_EVENTS
> * CONFIG_FUNCTION_TRACER w/o dynamic ftrace enables -pg, which pulls in
> -fno-omit-frame-pointer on riscv.
Maybe something like (too crude?):
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 10e7a7ad175a..cd8075c092c3 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -62,6 +62,7 @@ config RISCV
select COMMON_CLK
select CPU_PM if CPU_IDLE || HIBERNATION
select EDAC_SUPPORT
+ select FRAME_POINTER if PERF_EVENTS || (FUNCTION_TRACER && !DYNAMIC_FTRACE)
select GENERIC_ARCH_TOPOLOGY
select GENERIC_ATOMIC64 if !64BIT
select GENERIC_CLOCKEVENTS_BROADCAST if SMP
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 6ec6d52a4180..1329e060c548 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -87,9 +87,6 @@ endif
ifeq ($(CONFIG_CMODEL_MEDANY),y)
KBUILD_CFLAGS += -mcmodel=medany
endif
-ifeq ($(CONFIG_PERF_EVENTS),y)
- KBUILD_CFLAGS += -fno-omit-frame-pointer
-endif
# Avoid generating .eh_frame sections.
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables -fno-unwind-tables
More information about the linux-riscv
mailing list