Don't create sframes during build
Subsystems (2)
RFC 1/1 Don't create sframes during build
Hi,
gcc in Debian, starting with 15.2.0-2, 14.3.0-6 enables sframe
generation. Unless options like -ffreestanding are passed. Since this
isn't done, there are a few warnings during compile
| crypto/chacha.o: warning: objtool: .sframe+0x30: data relocation to !ENDBR: chacha_stream_xor+0x0 | crypto/chacha.o: warning: objtool: .sframe+0x94: data relocation to !ENDBR: crypto_xchacha_crypt+0x0
followed by warnings at the end
| AR vmlinux.a | LD vmlinux.o | vmlinux.o: warning: objtool: .sframe+0x15c: data relocation to !ENDBR: repair_env_string+0x0 | vmlinux.o: warning: objtool: .sframe+0x1c0: data relocation to !ENDBR: run_init_process+0x0 | vmlinux.o: warning: objtool: .sframe+0x1d4: data relocation to !ENDBR: try_to_run_init_process+0x0 | vmlinux.o: warning: objtool: .sframe+0x1e8: data relocation to !ENDBR: rcu_read_unlock+0x0 … | vmlinux.o: warning: objtool: .sframe+0x12765c: data relocation to !ENDBR: get_eff_addr_reg+0x0 | vmlinux.o: warning: objtool: .sframe+0x1276ac: data relocation to !ENDBR: get_seg_base_limit+0x0 | OBJCOPY modules.builtin.modinfo
followed by a boom
| LD .tmp_vmlinux1
| ld: error: unplaced orphan section .sframe' from vmlinux.o'
We could drop the sframe during the final link but this does not get rid of the objtool warnings so we would have to ignore them. But we don't need it. So what about the following:
Makefile +2 -0
@@ -886,6 +886,8 @@ ifdef CONFIG_CC_IS_GCC KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races) endif +# No sframe generation for kernel if enabled by default +KBUILD_CFLAGS += $(call cc-option,-Xassembler --gsframe=no) ifdef CONFIG_READABLE_ASM # Disable optimizations that make assembler listings hard to read.
Signature · 1 line
2.51.0
[ CCing [email protected] ]
Quoted 5 lines · Sebastian Andrzej Siewior
Hi,
gcc in Debian, starting with 15.2.0-2, 14.3.0-6 enables sframe generation. Unless options like -ffreestanding are passed. Since this isn't done, there are a few warnings during compile
If there are other options when sframe shouldn't be enabled, please tell.
Gentoo chose another approach, enabling sframe unconditionally in gas, unless disabled by --gsframe=no.
Quoted 28 lines
|
crypto/chacha.o: warning: objtool: .sframe+0x30: data relocation to !ENDBR:chacha_stream_xor+0x0|crypto/chacha.o: warning: objtool: .sframe+0x94: data relocation to !ENDBR:crypto_xchacha_crypt+0x0followed by warnings at the end
| AR vmlinux.a | LD vmlinux.o | vmlinux.o: warning: objtool: .sframe+0x15c: data relocation to !ENDBR: repair_env_string+0x0 | vmlinux.o: warning: objtool: .sframe+0x1c0: data relocation to !ENDBR: run_init_process+0x0 | vmlinux.o: warning: objtool: .sframe+0x1d4: data relocation to !ENDBR: try_to_run_init_process+0x0 | vmlinux.o: warning: objtool: .sframe+0x1e8: data relocation to !ENDBR: rcu_read_unlock+0x0 … | vmlinux.o: warning: objtool: .sframe+0x12765c: data relocation to !ENDBR: get_eff_addr_reg+0x0 | vmlinux.o: warning: objtool: .sframe+0x1276ac: data relocation to !ENDBR: get_seg_base_limit+0x0 | OBJCOPY modules.builtin.modinfofollowed by a boom
| LD .tmp_vmlinux1
| ld: error: unplaced orphan section.sframe' fromvmlinux.o'We could drop the sframe during the final link but this does not get rid of the objtool warnings so we would have to ignore them. But we don't need it. So what about the following:
Makefile ifdef CONFIG_CC_IS_GCC · line 893
Quoted 8 lines
Makefile +2
-0@@ -886,6 +886,8 @@ ifdef CONFIG_CC_IS_GCC KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races) endif +# No sframe generation for kernel if enabled by default +KBUILD_CFLAGS += $(call cc-option,-Xassembler --gsframe=no) ifdef CONFIG_READABLE_ASM # Disable optimizations that make assembler listings hard to read.
This is what I chose for package builds that need disablement of sframe.
Quoted 37 lines · Matthias Klose
[ CCing [email protected] ]
Quoted 5 lines · Sebastian Andrzej Siewior
Hi,
gcc in Debian, starting with 15.2.0-2, 14.3.0-6 enables sframe generation. Unless options like -ffreestanding are passed. Since this isn't done, there are a few warnings during compile
If there are other options when sframe shouldn't be enabled, please tell.
Gentoo chose another approach, enabling sframe unconditionally in gas, unless disabled by --gsframe=no.
Quoted 24 lines
|
crypto/chacha.o: warning: objtool: .sframe+0x30: data relocation to !ENDBR:chacha_stream_xor+0x0|crypto/chacha.o: warning: objtool: .sframe+0x94: data relocation to !ENDBR:crypto_xchacha_crypt+0x0followed by warnings at the end
| AR vmlinux.a | LD vmlinux.o | vmlinux.o: warning: objtool: .sframe+0x15c: data relocation to ! ENDBR: repair_env_string+0x0 | vmlinux.o: warning: objtool: .sframe+0x1c0: data relocation to ! ENDBR: run_init_process+0x0 | vmlinux.o: warning: objtool: .sframe+0x1d4: data relocation to ! ENDBR: try_to_run_init_process+0x0 | vmlinux.o: warning: objtool: .sframe+0x1e8: data relocation to ! ENDBR: rcu_read_unlock+0x0 … | vmlinux.o: warning: objtool: .sframe+0x12765c: data relocation to ! ENDBR: get_eff_addr_reg+0x0 | vmlinux.o: warning: objtool: .sframe+0x1276ac: data relocation to ! ENDBR: get_seg_base_limit+0x0 | OBJCOPY modules.builtin.modinfofollowed by a boom
| LD .tmp_vmlinux1
| ld: error: unplaced orphan section.sframe' fromvmlinux.o'We could drop the sframe during the final link but this does not get rid of the objtool warnings so we would have to ignore them. But we don't need it. So what about the following:
Quoted 12 lines
Quoted 11 lines
Makefile +0
-0@@ -886,6 +886,8 @@ ifdef CONFIG_CC_IS_GCC KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races)endif
Makefile +2
-0+# No sframe generation for kernel if enabled by default +KBUILD_CFLAGS += $(call cc-option,-Xassembler --gsframe=no)ifdef
CONFIG_READABLE_ASM
# Disable optimizations that make assembler listings hard to read.This is what I chose for package builds that need disablement of sframe.
Fyi, I will disable that again next week, until sframe v3 is ready.
Quoted 10 lines · Matthias Klose
[ CCing [email protected] ]
Quoted 5 lines · Sebastian Andrzej Siewior
Hi,
gcc in Debian, starting with 15.2.0-2, 14.3.0-6 enables sframe generation. Unless options like -ffreestanding are passed. Since this isn't done, there are a few warnings during compile
If there are other options when sframe shouldn't be enabled, please tell.
No, I think this is okay.
…
Quoted 4 lines
Quoted 4 lines
We could drop the sframe during the final link but this does not get rid of the objtool warnings so we would have to ignore them. But we don't need it. So what about the following:
Quoted 12 lines
Makefile ifdef CONFIG_CC_IS_GCC · line 892
Quoted 11 lines
Makefile +2
-0@@ -886,6 +886,8 @@ ifdef CONFIG_CC_IS_GCC KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races) endif +# No sframe generation for kernel if enabled by default +KBUILD_CFLAGS += $(call cc-option,-Xassembler --gsframe=no) ifdef CONFIG_READABLE_ASM # Disable optimizations that make assembler listings hard to read.This is what I chose for package builds that need disablement of sframe.
I think this would work for now. Longterm we would have to allow sframe creation and keep section if an architecture decides to use it for its backtracing. While orc seems fine on x86, there are arm64 patches to use for as a stack unwinder.
Sebastian
Quoted 32 lines · Sebastian Andrzej Siewior
Quoted 10 lines · Matthias Klose
[ CCing [email protected] ]
Quoted 5 lines · Sebastian Andrzej Siewior
Hi,
gcc in Debian, starting with 15.2.0-2, 14.3.0-6 enables sframe generation. Unless options like -ffreestanding are passed. Since this isn't done, there are a few warnings during compile
If there are other options when sframe shouldn't be enabled, please tell.
No, I think this is okay.
…
Quoted 4 lines
Quoted 4 lines
We could drop the sframe during the final link but this does not get rid of the objtool warnings so we would have to ignore them. But we don't need it. So what about the following:
Quoted 12 lines
Makefile ifdef CONFIG_CC_IS_GCC · line 892
Quoted 11 lines
Makefile +2
-0@@ -886,6 +886,8 @@ ifdef CONFIG_CC_IS_GCC KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races) endif +# No sframe generation for kernel if enabled by default +KBUILD_CFLAGS += $(call cc-option,-Xassembler --gsframe=no) ifdef CONFIG_READABLE_ASM # Disable optimizations that make assembler listings hard to read.This is what I chose for package builds that need disablement of sframe.
Quoted 4 lines
I think this would work for now. Longterm we would have to allow sframe creation and keep section if an architecture decides to use it for its backtracing. While orc seems fine on x86, there are arm64 patches to use for as a stack unwinder.
This is probably fine, but... how does this interact with other kernel makefiles enabling sframe? For example, x86 will soon have a patch to enable sframe generation for vdso. And as you mentioned, arm64 will enable it kernel-wide.
Removing the objtool !ENDBR warnings would be trivial (and is a good thing to do regardless).
Signature · 1 line
Josh
Quoted 38 lines · Josh Poimboeuf
Quoted 32 lines · Sebastian Andrzej Siewior
Quoted 10 lines · Matthias Klose
[ CCing [email protected] ]
Quoted 5 lines · Sebastian Andrzej Siewior
Hi,
gcc in Debian, starting with 15.2.0-2, 14.3.0-6 enables sframe generation. Unless options like -ffreestanding are passed. Since this isn't done, there are a few warnings during compile
If there are other options when sframe shouldn't be enabled, please tell.
No, I think this is okay.
…
Quoted 4 lines
Quoted 4 lines
We could drop the sframe during the final link but this does not get rid of the objtool warnings so we would have to ignore them. But we don't need it. So what about the following:
Quoted 12 lines
Makefile ifdef CONFIG_CC_IS_GCC · line 892
Quoted 11 lines
Makefile +2
-0@@ -886,6 +886,8 @@ ifdef CONFIG_CC_IS_GCC KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races) endif +# No sframe generation for kernel if enabled by default +KBUILD_CFLAGS += $(call cc-option,-Xassembler --gsframe=no) ifdef CONFIG_READABLE_ASM # Disable optimizations that make assembler listings hard to read.This is what I chose for package builds that need disablement of sframe.
Quoted 4 lines
I think this would work for now. Longterm we would have to allow sframe creation and keep section if an architecture decides to use it for its backtracing. While orc seems fine on x86, there are arm64 patches to use for as a stack unwinder.
Quoted 7 lines
This is probably fine, but... how does this interact with other kernel makefiles enabling sframe? For example, x86 will soon have a patch to enable sframe generation for vdso. And as you mentioned, arm64 will enable it kernel-wide.
Removing the objtool !ENDBR warnings would be trivial (and is a good thing to do regardless).
What is the status of sframe support in the kernel? With current binutils (version 2.45.50.20260119-1) from Debian I could not build Linux 6.18.7:
,----
| # LD arch/x86/boot/compressed/vmlinux | ld -m elf_x86_64 --no-ld-generated-unwind-info -pie --no-dynamic-linker --orphan-handling=error -z noexecstack --no-warn-rwx-segments -T arch/x86/boot/compressed/vmlinux.lds arch/x86/boot/compressed/kernel_info.o arch/x86/boot/compressed/head_64.o arch/x86/boot/compressed/misc.o arch/x86/boot/compressed/string.o arch/x86/boot/compressed/cmdline.o arch/x86/boot/compressed/error.o arch/x86/boot/compressed/piggy.o arch/x86/boot/compressed/cpuflags.o arch/x86/boot/compressed/early_serial_console.o arch/x86/boot/compressed/kaslr.o arch/x86/boot/compressed/ident_map_64.o arch/x86/boot/compressed/idt_64.o arch/x86/boot/compressed/idt_handlers_64.o arch/x86/boot/compressed/pgtable_64.o arch/x86/boot/compressed/acpi.o arch/x86/boot/startup/lib.a -o arch/x86/boot/compressed/vmlinux | /usr/bin/x86_64-linux-gnu-ld.bfd: error: unplaced orphan section `.sframe' from `arch/x86/boot/compressed/kernel_info.o' | /usr/bin/x86_64-linux-gnu-ld.bfd: error: unplaced orphan section `.sframe' from `arch/x86/boot/compressed/kernel_info.o' | make[6]: *** [arch/x86/boot/compressed/Makefile:116: arch/x86/boot/compressed/vmlinux] Error 1 | make[5]: *** [arch/x86/boot/Makefile:96: arch/x86/boot/compressed/vmlinux] Error 2
`----
Did not test mainline yet, but "git log --grep=sframe master" does not show anything interesting.
Cheers,
Sven
Quoted 52 lines · Sven Joachim
Quoted 38 lines · Josh Poimboeuf
Quoted 32 lines · Sebastian Andrzej Siewior
Quoted 10 lines · Matthias Klose
[ CCing [email protected] ]
Quoted 5 lines · Sebastian Andrzej Siewior
Hi,
gcc in Debian, starting with 15.2.0-2, 14.3.0-6 enables sframe generation. Unless options like -ffreestanding are passed. Since this isn't done, there are a few warnings during compile
If there are other options when sframe shouldn't be enabled, please tell.
No, I think this is okay.
…
Quoted 4 lines
Quoted 4 lines
We could drop the sframe during the final link but this does not get rid of the objtool warnings so we would have to ignore them. But we don't need it. So what about the following:
Quoted 12 lines
Makefile ifdef CONFIG_CC_IS_GCC · line 892
Quoted 11 lines
Makefile +2
-0@@ -886,6 +886,8 @@ ifdef CONFIG_CC_IS_GCC KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races) endif +# No sframe generation for kernel if enabled by default +KBUILD_CFLAGS += $(call cc-option,-Xassembler --gsframe=no) ifdef CONFIG_READABLE_ASM # Disable optimizations that make assembler listings hard to read.This is what I chose for package builds that need disablement of sframe.
Quoted 4 lines
I think this would work for now. Longterm we would have to allow sframe creation and keep section if an architecture decides to use it for its backtracing. While orc seems fine on x86, there are arm64 patches to use for as a stack unwinder.
Quoted 7 lines
This is probably fine, but... how does this interact with other kernel makefiles enabling sframe? For example, x86 will soon have a patch to enable sframe generation for vdso. And as you mentioned, arm64 will enable it kernel-wide.
Removing the objtool !ENDBR warnings would be trivial (and is a good thing to do regardless).
What is the status of sframe support in the kernel? With current binutils (version 2.45.50.20260119-1) from Debian I could not build Linux 6.18.7:
Quoted 9 lines
,----
| # LD arch/x86/boot/compressed/vmlinux | ld -m elf_x86_64 --no-ld-generated-unwind-info -pie --no-dynamic-linker --orphan-handling=error -z noexecstack --no-warn-rwx-segments -T arch/x86/boot/compressed/vmlinux.lds arch/x86/boot/compressed/kernel_info.o arch/x86/boot/compressed/head_64.o arch/x86/boot/compressed/misc.o arch/x86/boot/compressed/string.o arch/x86/boot/compressed/cmdline.o arch/x86/boot/compressed/error.o arch/x86/boot/compressed/piggy.o arch/x86/boot/compressed/cpuflags.o arch/x86/boot/compressed/early_serial_console.o arch/x86/boot/compressed/kaslr.o arch/x86/boot/compressed/ident_map_64.o arch/x86/boot/compressed/idt_64.o arch/x86/boot/compressed/idt_handlers_64.o arch/x86/boot/compressed/pgtable_64.o arch/x86/boot/compressed/acpi.o arch/x86/boot/startup/lib.a -o arch/x86/boot/compressed/vmlinux | /usr/bin/x86_64-linux-gnu-ld.bfd: error: unplaced orphan section `.sframe' from `arch/x86/boot/compressed/kernel_info.o' | /usr/bin/x86_64-linux-gnu-ld.bfd: error: unplaced orphan section `.sframe' from `arch/x86/boot/compressed/kernel_info.o' | make[6]: *** [arch/x86/boot/compressed/Makefile:116: arch/x86/boot/compressed/vmlinux] Error 1 | make[5]: *** [arch/x86/boot/Makefile:96: arch/x86/boot/compressed/vmlinux] Error 2`----
Sorry for the breakage.
There is a patch that needs to make it upstream
https://sourceware.org/pipermail/binutils/2026-January/147664.html
(Its a part of a series under review..)
I will work on getting this patch committed.
For immediate relief, please use the new ld option --discard-sframe meanwhile.
Quoted 5 lines
Did not test mainline yet, but "git log --grep=sframe master" does not show anything interesting.
Cheers,
Sven
Quoted 65 lines · Indu
Quoted 52 lines · Sven Joachim
Quoted 38 lines · Josh Poimboeuf
Quoted 32 lines · Sebastian Andrzej Siewior
Quoted 10 lines · Matthias Klose
[ CCing [email protected] ]
Quoted 5 lines · Sebastian Andrzej Siewior
Hi,
gcc in Debian, starting with 15.2.0-2, 14.3.0-6 enables sframe generation. Unless options like -ffreestanding are passed. Since this isn't done, there are a few warnings during compile
If there are other options when sframe shouldn't be enabled, please tell.
No, I think this is okay.
…
Quoted 4 lines
Quoted 4 lines
We could drop the sframe during the final link but this does not get rid of the objtool warnings so we would have to ignore them. But we don't need it. So what about the following:
Quoted 12 lines
Quoted 11 lines
Makefile +0
-0@@ -886,6 +886,8 @@ ifdef CONFIG_CC_IS_GCC KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data- races=0) KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races)endif
Makefile +2
-0+# No sframe generation for kernel if enabled by default +KBUILD_CFLAGS += $(call cc-option,-Xassembler --gsframe=no)ifdef
CONFIG_READABLE_ASM
# Disable optimizations that make assembler listings hard to read.This is what I chose for package builds that need disablement of sframe.
Quoted 4 lines
I think this would work for now. Longterm we would have to allow sframe creation and keep section if an architecture decides to use it for its backtracing. While orc seems fine on x86, there are arm64 patches to use for as a stack unwinder.
Quoted 7 lines
This is probably fine, but... how does this interact with other kernel makefiles enabling sframe? For example, x86 will soon have a patch to enable sframe generation for vdso. And as you mentioned, arm64 will enable it kernel-wide.
Removing the objtool !ENDBR warnings would be trivial (and is a good thing to do regardless).
What is the status of sframe support in the kernel? With current binutils (version 2.45.50.20260119-1) from Debian I could not build Linux 6.18.7:
Quoted 9 lines
,----
| # LD arch/x86/boot/compressed/vmlinux | ld -m elf_x86_64 --no-ld-generated-unwind-info -pie --no- dynamic-linker --orphan-handling=error -z noexecstack --no-warn-rwx- segments -T arch/x86/boot/compressed/vmlinux.lds arch/x86/boot/ compressed/kernel_info.o arch/x86/boot/compressed/head_64.o arch/x86/ boot/compressed/misc.o arch/x86/boot/compressed/string.o arch/x86/ boot/compressed/cmdline.o arch/x86/boot/compressed/error.o arch/x86/ boot/compressed/piggy.o arch/x86/boot/compressed/cpuflags.o arch/x86/ boot/compressed/early_serial_console.o arch/x86/boot/compressed/ kaslr.o arch/x86/boot/compressed/ident_map_64.o arch/x86/boot/ compressed/idt_64.o arch/x86/boot/compressed/idt_handlers_64.o arch/ x86/boot/compressed/pgtable_64.o arch/x86/boot/compressed/acpi.o arch/ x86/boot/startup/lib.a -o arch/x86/boot/compressed/vmlinux | /usr/bin/x86_64-linux-gnu-ld.bfd: error: unplaced orphan section `.sframe' from `arch/x86/boot/compressed/kernel_info.o' | /usr/bin/x86_64-linux-gnu-ld.bfd: error: unplaced orphan section `.sframe' from `arch/x86/boot/compressed/kernel_info.o' | make[6]: *** [arch/x86/boot/compressed/Makefile:116: arch/x86/boot/ compressed/vmlinux] Error 1 | make[5]: *** [arch/x86/boot/Makefile:96: arch/x86/boot/compressed/ vmlinux] Error 2`----
Sorry for the breakage.
Quoted 8 lines
There is a patch that needs to make it upstream
https://sourceware.org/pipermail/binutils/2026-January/147664.html
(Its a part of a series under review..)I will work on getting this patch committed.
For immediate relief, please use the new ld option --discard-sframe meanwhile.
This was being tracked via https://www.sourceware.org/bugzilla/show_bug.cgi?id=33830.
Should be fixed now on Binutils master and 2.46 branch.
Thanks
Quoted 7 lines
Quoted 5 lines
Did not test mainline yet, but "git log --grep=sframe master" does not show anything interesting.
Cheers,
Sven
Quoted 13 lines · Matthias Klose
[ CCing [email protected] ]
Quoted 5 lines · Sebastian Andrzej Siewior
Hi,
gcc in Debian, starting with 15.2.0-2, 14.3.0-6 enables sframe generation. Unless options like -ffreestanding are passed. Since this isn't done, there are a few warnings during compile
If there are other options when sframe shouldn't be enabled, please tell.
Gentoo chose another approach, enabling sframe unconditionally in gas, unless disabled by --gsframe=no.
...
Quoted 7 lines
Quoted 7 lines
followed by a boom
| LD .tmp_vmlinux1
| ld: error: unplaced orphan section.sframe' fromvmlinux.o'We could drop the sframe during the final link but this does not get rid of the objtool warnings so we would have to ignore them. But we don't need it. So what about the following:
Instead of dropping .sframe for kernel during final link it would be better not to generate it to save some CPU cycles and disk space.
Quoted 13 lines
Quoted 10 lines
Makefile +0
-0@@ -886,6 +886,8 @@ ifdef CONFIG_CC_IS_GCC KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races)endif
Makefile +2
-0+# No sframe generation for kernel if enabled by default +KBUILD_CFLAGS += $(call cc-option,-Xassembler --gsframe=no)Quoted 2 lines
ifdef
CONFIG_READABLE_ASM
# Disable optimizations that make assembler listings hard to read.This is what I chose for package builds that need disablement of sframe.
What about:
Makefile +5 -0
@@ -906,6 +906,11 @@ KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races) endif +# No .sframe generation for kernel if enabled in assembler by default +CC_FLAGS_SFRAME := $(call as-option,-Wa$(comma)--gsframe=no) +KBUILD_CFLAGS += $(CC_FLAGS_SFRAME) +KBUILD_AFLAGS += $(CC_FLAGS_SFRAME) + ifdef CONFIG_READABLE_ASM # Disable optimizations that make assembler listings hard to read. # reorder blocks reorders the control in the function
Generation of .sframe in vDSO can override that default. If archs like arm64 want to enable .sframe for kernel they can introduce a kernel option (e.g. SFRAME) that changes the default.
Regards,
Jens
Signature · 6 lines
Jens Remus Linux on Z Development (D3303) [email protected] / [email protected] 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/
Nathan Chancellor
maintainerQuoted 2 lines · Jens Remus
Instead of dropping .sframe for kernel during final link it would be better not to generate it to save some CPU cycles and disk space.
...
Quoted 7 lines
What about:
Makefile +0
-0@@ -906,6 +906,11 @@ KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races)
Makefile KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) · line 916
Quoted 10 lines
Makefile +5
-0endif +# No .sframe generation for kernel if enabled in assembler by default +CC_FLAGS_SFRAME := $(call as-option,-Wa$(comma)--gsframe=no) +KBUILD_CFLAGS += $(CC_FLAGS_SFRAME) +KBUILD_AFLAGS += $(CC_FLAGS_SFRAME) + ifdef CONFIG_READABLE_ASM # Disable optimizations that make assembler listings hard to read. # reorder blocks reorders the control in the function
This seems like a good start for the main kernel build. I still have an issue with bleeding edge binutils with mismatched .sframe input sections, which does not appear to disappear with -Wa,--gsframe=no.
$ cat test.c
void atexit();
void main() { atexit(); }$ gcc --version | head -1 gcc (GCC) 15.2.1 20260103
$ ld --version | head -1 GNU ld (GNU Binutils) 2.45.50.20260128
$ gcc -o /dev/null test.c .../binutils/2.45.50-2026-01-27_18-02-52-e8108cc5e6fe1748dc6033a297dd2c1c6234de78/bin/ld: input SFrame sections with different format versions prevent .sframe generation .../binutils/2.45.50-2026-01-27_18-02-52-e8108cc5e6fe1748dc6033a297dd2c1c6234de78/bin/ld: final link failed collect2: error: ld returned 1 exit status
$ gcc -o /dev/null -Wa,--gsframe=no test.c .../binutils/2.45.50-2026-01-27_18-02-52-e8108cc5e6fe1748dc6033a297dd2c1c6234de78/bin/ld: input SFrame sections with different format versions prevent .sframe generation .../binutils/2.45.50-2026-01-27_18-02-52-e8108cc5e6fe1748dc6033a297dd2c1c6234de78/bin/ld: final link failed collect2: error: ld returned 1 exit status
$ gcc -o /dev/null -Wl,--discard-sframe test.c
This was extracted from an error I see while building libiberty in binutils due to the atexit() configure test failing then the fallback to on_exit() resulting in an error but I also notice it when building tools/objtool, which is a host tool:
$ make -skj"$(nproc)" ARCH=x86_64 mrproper defconfig prepare .../binutils/2.45.50-2026-01-27_18-02-52-e8108cc5e6fe1748dc6033a297dd2c1c6234de78/bin/ld: input SFrame sections with different format versions prevent .sframe generation .../binutils/2.45.50-2026-01-27_18-02-52-e8108cc5e6fe1748dc6033a297dd2c1c6234de78/bin/ld: final link failed collect2: error: ld returned 1 exit status make[5]: *** [Makefile:127: tools/objtool/objtool] Error 1 ...
It looks like several distribution ELF objects and libraries on my system (Arch Linux) have .sframe sections in them, so maybe we still need -Wl,--discard-sframe? They all appear to be SFrame v2 objects so if no objects in the build have SFrame v3 sections from -Wa,--gsframe=no, it seems odd that there is an error but maybe there is something else going on?
Cheers,
Nathan
Quoted 60 lines · Nathan Chancellor
Quoted 2 lines · Jens Remus
Instead of dropping .sframe for kernel during final link it would be better not to generate it to save some CPU cycles and disk space.
...
Quoted 7 lines
What about:
Makefile +0
-0@@ -906,6 +906,11 @@ KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races)Makefile KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) · line 916
Quoted 10 lines
Makefile +5
-0endif +# No .sframe generation for kernel if enabled in assembler by default +CC_FLAGS_SFRAME := $(call as-option,-Wa$(comma)--gsframe=no) +KBUILD_CFLAGS += $(CC_FLAGS_SFRAME) +KBUILD_AFLAGS += $(CC_FLAGS_SFRAME) + ifdef CONFIG_READABLE_ASM # Disable optimizations that make assembler listings hard to read. # reorder blocks reorders the control in the functionThis seems like a good start for the main kernel build. I still have an issue with bleeding edge binutils with mismatched .sframe input sections, which does not appear to disappear with -Wa,--gsframe=no.
$ cat test.c void atexit(); void main() { atexit(); }$ gcc --version | head -1 gcc (GCC) 15.2.1 20260103$ ld --version | head -1 GNU ld (GNU Binutils) 2.45.50.20260128$ gcc -o /dev/null test.c .../binutils/2.45.50-2026-01-27_18-02-52-e8108cc5e6fe1748dc6033a297dd2c1c6234de78/bin/ld: input SFrame sections with different format versions prevent .sframe generation .../binutils/2.45.50-2026-01-27_18-02-52-e8108cc5e6fe1748dc6033a297dd2c1c6234de78/bin/ld: final link failed collect2: error: ld returned 1 exit status$ gcc -o /dev/null -Wa,--gsframe=no test.c .../binutils/2.45.50-2026-01-27_18-02-52-e8108cc5e6fe1748dc6033a297dd2c1c6234de78/bin/ld: input SFrame sections with different format versions prevent .sframe generation .../binutils/2.45.50-2026-01-27_18-02-52-e8108cc5e6fe1748dc6033a297dd2c1c6234de78/bin/ld: final link failed collect2: error: ld returned 1 exit status$ gcc -o /dev/null -Wl,--discard-sframe test.cThis was extracted from an error I see while building libiberty in binutils due to the
atexit()configure test failing then the fallback toon_exit()resulting in an error but I also notice it when buildingtools/objtool, which is a host tool:$ make -skj"$(nproc)" ARCH=x86_64 mrproper defconfig prepare .../binutils/2.45.50-2026-01-27_18-02-52-e8108cc5e6fe1748dc6033a297dd2c1c6234de78/bin/ld: input SFrame sections with different format versions prevent .sframe generation .../binutils/2.45.50-2026-01-27_18-02-52-e8108cc5e6fe1748dc6033a297dd2c1c6234de78/bin/ld: final link failed collect2: error: ld returned 1 exit status make[5]: *** [Makefile:127: tools/objtool/objtool] Error 1 ...
Quoted 7 lines
It looks like several distribution ELF objects and libraries on my system (Arch Linux) have .sframe sections in them, so maybe we still need -Wl,--discard-sframe? They all appear to be SFrame v2 objects so if no objects in the build have SFrame v3 sections from -Wa,--gsframe=no, it seems odd that there is an error but maybe there is something else going on?
As to whats going on:
Some Arch Linux releases seem to have glibc configured with --enable-sframe, which is likely the cause of the SFrame V2 objects on your system. Frederick (from ArchLinux is in CC) is planning to roll out a release with a glibc built without --enable-sframe.
Next, GNU ld creates linker-generated .sframe for the (linker-generated) .plt sections (on x86_64 and s390x), if GNU ld sees any input objects have .sframe in them[*], unless --discard-sframe is specified. These are now SFrame V3 (after Jan 15 when SFrame V3 was merged). The choice to drop the support for V2/V3 object mixing in the GNU ld was made to save implementation complexity in linkers and (WIP) stacktracers supporting SFrame, by adopting SFrame V3 and above.
So, --discard-sframe is the remedy if you have V2 sections lying around.
[*] The bug in the GNU Binutils snapshots between Jan 15 and Jan 24 was that these linker-generated .sframe for .plt were enthusiastically created even when _none_ of the inputs had .sframe in them (for x86_64 and s390x), unless --discard-sframe was specified.