From 99ac1e2371a562c953af1c276ef7dc373ee263a6 Mon Sep 17 00:00:00 2001 From: David Gow Date: Thu, 26 May 2022 11:54:02 -0700 Subject: [PATCH] arch: um: Fix build for statically linked UML w/ constructors If CONFIG_CONSTUCTORS is enabled on a statically linked (CONFIG_STATIC_LINK=y) build of UML, the build fails due to the .eh_frame section being both used and discarded: ERROR:root:`.eh_frame' referenced in section `.text' of /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginT.o: defined in discarded section `.eh_frame' of /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginT.o `.eh_frame' referenced in section `.text' of /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginT.o: defined in discarded section `.eh_frame' of /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginT.o Instead, keep the .eh_frame section, as we do in dyn.lds.S for dynamically linked UML. This can be reproduced with: ./tools/testing/kunit/kunit.py run --kconfig_add CONFIG_STATIC_LINK=y --kconfig_add CONFIG_GCOV_KERNEL=y --kconfig_add CONFIG_DEBUG_FS=y Signed-off-by: David Gow Signed-off-by: Richard Weinberger --- arch/um/kernel/uml.lds.S | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S index 7a8e2b1..71a59b8 100644 --- a/arch/um/kernel/uml.lds.S +++ b/arch/um/kernel/uml.lds.S @@ -95,6 +95,7 @@ SECTIONS } .got : { *(.got.plt) *(.got) } + .eh_frame : { KEEP (*(.eh_frame)) } .dynamic : { *(.dynamic) } .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } -- 2.7.4