Re: [PATCH v3 2/8] arm64, unwind: build kernel with sframe V3 info
From: Jens Remus
Date: Mon Apr 20 2026 - 08:18:45 EST
On 4/18/2026 2:20 AM, Dylan Hatch wrote:
> On Tue, Apr 14, 2026 at 5:43 AM Jens Remus <jremus@xxxxxxxxxxxxx> wrote:
>> You are introducing two new Kconfig options (SFRAME_UNWINDER and
>> ARCH_SUPPORTS_SFRAME_UNWINDER). I wonder whether they could somehow be
>> combined into a single new option. Although I am not sure how an option
>> can be both selectable and depending at the same time, so that the ARM64
>> config could select it, but it would also depend on the above.
>
> I don't think this is recommended, since the behavior of 'select'
> appears to override a 'depends' requirement.
>
> From Documentation/kbuild/kconfig-language.rst: "select should be used
> with care. select will force a symbol to a value without visiting the
> dependencies. By abusing select you are able to select a symbol FOO
> even if FOO depends on BAR that is not set. In general use select only
> for non-visible symbols (no prompts anywhere) and for symbols with no
> dependencies. That will limit the usefulness but on the other hand
> avoid the illegal configurations all over."
Thanks for the explanation! So both options cannot be merged into one.
Maybe the option names can still be aligned, so that they have
UNWIND_KERNEL_SFRAME in common and the kernel and user space sframe
unwinder options have HAVE_UNWIND in common?
SFRAME_UNWINDER -> HAVE_UNWIND_KERNEL_SFRAME
ARCH_SUPPORTS_SFRAME_UNWINDER -> ARCH_SUPPORTS_UNWIND_KERNEL_SFRAME
That would then align nicely with the existing:
HAVE_UNWIND_USER_SFRAME
The only downside is that the user variant would get selected via
HAVE_UNWIND_USER_SFRAME and the kernel variant via
ARCH_SUPPORTS_UNWIND_KERNEL_SFRAME.
>>> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
>>
>>> @@ -491,6 +491,8 @@
>>> *(.rodata1) \
>>> } \
>>> \
>>> + SFRAME \
>>> + \
>>> /* PCI quirks */ \
>>> .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \
>>> BOUNDED_SECTION_PRE_LABEL(.pci_fixup_early, _pci_fixups_early, __start, __end) \
>>> @@ -911,6 +913,19 @@
>>> #define TRACEDATA
>>> #endif
>>>
>>> +#ifdef CONFIG_SFRAME_UNWINDER
>>> +#define SFRAME \
>>> + /* sframe */ \
>>> + .sframe : AT(ADDR(.sframe) - LOAD_OFFSET) { \
>>> + __start_sframe_header = .; \
>>
>> __start_sframe[_section] = .;
>>
>>> + KEEP(*(.sframe)) \
>>> + KEEP(*(.init.sframe)) \
>>> + __stop_sframe_header = .; \
>>
>> __stop_sframe[_section] = .;
>>
>> Unless I am missing something both are not the start/stop of the .sframe
>> header (in the .sframe section) but the .sframe section itself (see also
>> your subsequent "[PATCH v3 4/8] sframe: Provide PC lookup for vmlinux
>> .sframe section." where you assign both to kernel_sfsec.sframe_start
>> and kernel_sfsec.sframe_end.
>>
>>> + }
>>> +#else
>>> +#define SFRAME
>>> +#endif
>>> +
>>> #ifdef CONFIG_PRINTK_INDEX
>>> #define PRINTK_INDEX \
>>> .printk_index : AT(ADDR(.printk_index) - LOAD_OFFSET) { \
What about the following? Note that I also aligned the indentation in
vmlinux.lds.h to the one in the blocks above/below.
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
@@ -31,6 +31,7 @@
* __irqentry_text_start, __irqentry_text_end
* __softirqentry_text_start, __softirqentry_text_end
* __start_opd, __end_opd
+ * __start_sframe, __end_sframe
*/
extern char _text[], _stext[], _etext[];
extern char _data[], _sdata[], _edata[];
@@ -53,6 +54,9 @@ extern char __ctors_start[], __ctors_end[];
/* Start and end of .opd section - used for function descriptors. */
extern char __start_opd[], __end_opd[];
+/* Stand end end of .sframe section - used for stack unwinding. */
+extern char __start_sframe[], __end_sframe[];
+
/* Start and end of instrumentation protected text section */
extern char __noinstr_text_start[], __noinstr_text_end[];
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
@@ -914,13 +914,13 @@
#endif
#ifdef CONFIG_SFRAME_UNWINDER
-#define SFRAME \
- /* sframe */ \
- .sframe : AT(ADDR(.sframe) - LOAD_OFFSET) { \
- __start_sframe_header = .; \
- KEEP(*(.sframe)) \
- KEEP(*(.init.sframe)) \
- __stop_sframe_header = .; \
+#define SFRAME \
+ /* sframe */ \
+ .sframe : AT(ADDR(.sframe) - LOAD_OFFSET) { \
+ __start_sframe = .; \
+ KEEP(*(.sframe)) \
+ KEEP(*(.init.sframe)) \
+ __end_sframe = .; \
}
#else
#define SFRAME
Regards,
Jens
--
Jens Remus
Linux on Z Development (D3303)
jremus@xxxxxxxxxx / jremus@xxxxxxxxxxxxx
IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Ehningen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/