[PATCH 1/1[RFC] um: include .fini_array.* in linker scripts

Alex Hung <[email protected]>
Newsgroups gmane.linux.uml.devel
Message-ID <[email protected]>
GCC emits per-translation-unit gcov destructors into
.fini_array.NNNNN sections (prioritized). The UML linker
scripts only captured *(.fini_array), silently discarding
all prioritized destructor entries.

As a result, gcov's __gcov_exit never ran at process halt
and no .gcda files were written after KUnit tests completed.

Add *(.fini_array.*) to common.lds.S and dyn.lds.S, mirroring
the existing *(.init_array.*) pattern already present for
constructors.

Signed-off-by: Alex Hung <[email protected]>
Assisted-by: Copilot:Claude-Sonnet-4.6
---
 arch/um/include/asm/common.lds.S | 1 +
 arch/um/kernel/dyn.lds.S         | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/um/include/asm/common.lds.S b/arch/um/include/asm/common.lds.S
index fd481ac371de..336361412b47 100644
--- a/arch/um/include/asm/common.lds.S
+++ b/arch/um/include/asm/common.lds.S
@@ -90,6 +90,7 @@
   }
   .fini_array : {
 	__fini_array_start = .;
+	*(.fini_array.*)
 	*(.fini_array)
 	__fini_array_end = .;
   }
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
index ad3cefeff2ac..fbd8d559f21f 100644
--- a/arch/um/kernel/dyn.lds.S
+++ b/arch/um/kernel/dyn.lds.S
@@ -113,7 +113,7 @@ SECTIONS
     *(.init_array.*)
     *(.init_array)
   }
-  .fini_array     : { *(.fini_array) }
+  .fini_array     : { *(.fini_array.*) *(.fini_array) }
   .data           : {
     INIT_TASK_DATA(KERNEL_STACK_SIZE)
     DATA_DATA
--
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.