Skip to contentSkip to conversation

arch: um: Fix build for statically linked UML w/ constructors

PATCH New David Gow 1 participant 1 message May 26, 2022 User-mode Linux (UML)

lore
Share & tools
lore

David Gow

author
#0 lore raw

PATCH 1/1 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

---
 arch/um/kernel/uml.lds.S | 1 +
 1 file changed, 1 insertion(+)
arch/um/kernel/uml.lds.S +1 -0
index 7a8e2b123e29..71a59b8adbdc 100644
@@ -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) }
Signature · 7 lines
2.36.1.124.g0e6072fb45-goog


_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um