arch: um: Fix build for statically linked UML w/ constructors
authorDavid Gow <davidgow@google.com>
Thu, 26 May 2022 18:54:02 +0000 (11:54 -0700)
committerRichard Weinberger <richard@nod.at>
Sun, 17 Jul 2022 21:14:34 +0000 (23:14 +0200)
commit99ac1e2371a562c953af1c276ef7dc373ee263a6
treecce73af0dca77fb7526523cd47ab97e93cd5d1d5
parent40d3408d2c71c023caab8f37538fb58366431ead
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 <davidgow@google.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
arch/um/kernel/uml.lds.S