Revert "riscv: disable generation of unwind tables"
PATCH 1/1 Revert "riscv: disable generation of unwind tables"
This reverts commit 2f394c0e7d1129a35156e492bc8f445fb20f43ac.
RISC-V has supported the complete relocation types in module loader by '8fd6c5142395 ("riscv: Add remaining module relocations")'. Now RISC-V port can enable unwind tables in case eh_frame parsing is needed.
--- arch/riscv/Makefile | 3 --- 1 file changed, 3 deletions(-)
arch/riscv/Makefile +0 -3
@@ -94,9 +94,6 @@ ifeq ($(CONFIG_CMODEL_MEDANY),y) KBUILD_CFLAGS += -mcmodel=medany endif -# Avoid generating .eh_frame sections. -KBUILD_CFLAGS += -fno-asynchronous-unwind-tables -fno-unwind-tables - # The RISC-V attributes frequently cause compatibility issues and provide no # information, so just turn them off. KBUILD_CFLAGS += $(call cc-option,-mno-riscv-attribute)
Signature · 1 line
2.17.1
Quoted 17 lines · Zong Li
This reverts commit
2f394c0e7d1129a35156e492bc8f445fb20f43ac.RISC-V has supported the complete relocation types in module loader by '
8fd6c5142395("riscv: Add remaining module relocations")'. Now RISC-V port can enable unwind tables in caseeh_frameparsing is needed.Signed-off-by Zong Li <[email protected]>--- arch/riscv/Makefile | 3 --- 1 file changed, 3 deletions(-)arch/riscv/Makefile +0
-0
arch/riscv/Makefile ifeq ($(CONFIG_CMODEL_MEDANY),y) · line 99
Quoted 6 lines
arch/riscv/Makefile +0
-3@@ -94,9 +94,6 @@ ifeq ($(CONFIG_CMODEL_MEDANY),y) KBUILD_CFLAGS += -mcmodel=medany endif -# Avoid generating .eh_frame sections. -KBUILD_CFLAGS += -fno-asynchronous-unwind-tables -fno-unwind-tables -
There are a lot of orphaned sections created by this, which throws a lot of warnings. These warnings will only be present on GCC-13+ since -fno-asynchronous-unwind-tables was a default before GCC-13.
The .eh_frame orphaned sections can be resolved by including
.eh_frame : {*(.eh_frame)}
in arch/riscv/kernel/vmlinux.lds.S. arm64 places it in the init section, but outside init_data and init_text, so right after the .alternative definition seems like a good place.
.init.eh_frame sections in drivers/firmware/efi/libstub also complain about being orphaned, and other architectures have disabled unwind tables for that compilation unit, so -fno-unwind-tables and -fno-asynchronous-unwind-tables should be added to drivers/firmware/efi/libstub/Makefile for riscv.
This also causes the resulting image (with defconfig) to increase from 22M to 24M. There are currently no users of unwind tables in riscv so this should be hidden behind a config. arm64 uses this config as:
# Avoid generating .eh_frame* sections.
ifneq ($(CONFIG_UNWIND_TABLES),y)KBUILD_CFLAGS += -fno-asynchronous-unwind-tables -fno-unwind-tablesKBUILD_AFLAGS += -fno-asynchronous-unwind-tables -fno-unwind-tables
elseKBUILD_CFLAGS += -fasynchronous-unwind-tablesKBUILD_AFLAGS += -fasynchronous-unwind-tables
endif
Using this same config name for riscv would allow riscv to use the standard .eh_frame code introduced in
https://lore.kernel.org/linux-arm-kernel/[email protected]/.
This config is only enabled if some other config selects it in arm64, but riscv does not contain any users so maybe this config can be left unselected until there is a user of unwind tables in riscv.
- Charlie
Quoted 11 lines
arch/riscv/Makefile +0
-0# The RISC-V attributes frequently cause compatibility issues and provide no # information, so just turn them off. KBUILD_CFLAGS += $(call cc-option,-mno-riscv-attribute)Signature · 7 lines
2.17.1 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Quoted 57 lines · Charlie Jenkins
Quoted 17 lines · Zong Li
This reverts commit
2f394c0e7d1129a35156e492bc8f445fb20f43ac.RISC-V has supported the complete relocation types in module loader by '
8fd6c5142395("riscv: Add remaining module relocations")'. Now RISC-V port can enable unwind tables in caseeh_frameparsing is needed.Signed-off-by Zong Li <[email protected]>--- arch/riscv/Makefile | 3 --- 1 file changed, 3 deletions(-)arch/riscv/Makefile +0
-0arch/riscv/Makefile ifeq ($(CONFIG_CMODEL_MEDANY),y) · line 99
Quoted 6 lines
arch/riscv/Makefile +0
-3@@ -94,9 +94,6 @@ ifeq ($(CONFIG_CMODEL_MEDANY),y) KBUILD_CFLAGS += -mcmodel=medany endif -# Avoid generating .eh_frame sections. -KBUILD_CFLAGS += -fno-asynchronous-unwind-tables -fno-unwind-tables -There are a lot of orphaned sections created by this, which throws a lot of warnings. These warnings will only be present on GCC-13+ since -fno-asynchronous-unwind-tables was a default before GCC-13.
The .eh_frame orphaned sections can be resolved by including
.eh_frame : {*(.eh_frame)}
in
arch/riscv/kernel/vmlinux.lds.S. arm64 places it in the init section, but outsideinit_dataandinit_text, so right after the .alternative definition seems like a good place..init.eh_frame sections in
drivers/firmware/efi/libstubalso complain about being orphaned, and other architectures have disabled unwind tables for that compilation unit, so -fno-unwind-tables and -fno-asynchronous-unwind-tables should be added todrivers/firmware/efi/libstub/Makefilefor riscv.This also causes the resulting image (with defconfig) to increase from 22M to 24M. There are currently no users of unwind tables in riscv so this should be hidden behind a config. arm64 uses this config as:
# Avoid generating .eh_frame* sections.
ifneq ($(CONFIG_UNWIND_TABLES),y)KBUILD_CFLAGS+= -fno-asynchronous-unwind-tables -fno-unwind-tablesKBUILD_AFLAGS+= -fno-asynchronous-unwind-tables -fno-unwind-tables
elseKBUILD_CFLAGS+= -fasynchronous-unwind-tablesKBUILD_AFLAGS+= -fasynchronous-unwind-tables
endif
Quoted 8 lines
Using this same config name for riscv would allow riscv to use the standard .eh_frame code introduced in
https://lore.kernel.org/linux-arm-kernel/[email protected]/.This config is only enabled if some other config selects it in arm64, but riscv does not contain any users so maybe this config can be left unselected until there is a user of unwind tables in riscv.
Hi Charlie,
Thanks a lot for the tips and information, I will use gcc-13+ to verify the next patch.
Quoted 13 lines
- Charlie
Quoted 11 lines
arch/riscv/Makefile +0
-1# The RISC-V attributes frequently cause compatibility issues and provide no # information, so just turn them off. KBUILD_CFLAGS += $(call cc-option,-mno-riscv-attribute) --2.17.1
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv