linux-um archives
 help / color / mirror / Atom feed
* [PATCH 0/1][RFC] Fix no gcda files with kunit.py
@ 2026-05-12 23:26 Alex Hung
  2026-05-12 23:26 ` [PATCH 1/1[RFC] um: include .fini_array.* in linker scripts Alex Hung
  0 siblings, 1 reply; 4+ messages in thread
From: Alex Hung @ 2026-05-12 23:26 UTC (permalink / raw)
  To: richard, anton.ivanov, johannes, nathan, linux-um; +Cc: alex.hung

This patch is generated by Claude Sonnet and it is outside my knowledge
domain. Any comments or solutions are appreciated.

Command: CC="ccache gcc" ./tools/testing/kunit/kunit.py run --kunitconfig drivers/gpu/drm/amd/display/amdgpu_dm/tests/.kunitconfig

Without this patch, the error messages is shown with some WIP kunit
patches by lcov command:

Found gcov version: 13.3.0
Using intermediate gcov format
Writing temporary data to /tmp/geninfo_dat9yJO
Scanning .kunit/drivers/gpu/drm/amd/display/amdgpu_dm for .gcda files ...
geninfo: ERROR: no .gcda files found in .kunit/drivers/gpu/drm/amd/display/amdgpu_dm\
...

With this fix, it shows

Found gcov version: 13.3.0
Using intermediate gcov format
Writing temporary data to /tmp/geninfo_datLqI9
Scanning .kunit/drivers/gpu/drm/amd/display/amdgpu_dm for .gcda files ...
Found 25 data files in .kunit/drivers/gpu/drm/amd/display/amdgpu_dm
Processing .kunit/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.gcda
...

Alex Hung (1):
  um: include .fini_array.* in linker scripts

 arch/um/include/asm/common.lds.S | 1 +
 arch/um/kernel/dyn.lds.S         | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

--
2.43.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/1[RFC] um: include .fini_array.* in linker scripts
  2026-05-12 23:26 [PATCH 0/1][RFC] Fix no gcda files with kunit.py Alex Hung
@ 2026-05-12 23:26 ` Alex Hung
  2026-06-03  0:19   ` Alex Hung
  0 siblings, 1 reply; 4+ messages in thread
From: Alex Hung @ 2026-05-12 23:26 UTC (permalink / raw)
  To: richard, anton.ivanov, johannes, nathan, linux-um; +Cc: alex.hung

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 <alex.hung@amd.com>
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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1[RFC] um: include .fini_array.* in linker scripts
  2026-05-12 23:26 ` [PATCH 1/1[RFC] um: include .fini_array.* in linker scripts Alex Hung
@ 2026-06-03  0:19   ` Alex Hung
  2026-07-08 21:42     ` Alex Hung
  0 siblings, 1 reply; 4+ messages in thread
From: Alex Hung @ 2026-06-03  0:19 UTC (permalink / raw)
  To: richard, anton.ivanov, johannes, nathan, linux-um

Hi,

Are there any concerns or comments on this patch?

On 5/12/26 17:26, Alex Hung wrote:
> 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 <alex.hung@amd.com>
> 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
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1[RFC] um: include .fini_array.* in linker scripts
  2026-06-03  0:19   ` Alex Hung
@ 2026-07-08 21:42     ` Alex Hung
  0 siblings, 0 replies; 4+ messages in thread
From: Alex Hung @ 2026-07-08 21:42 UTC (permalink / raw)
  To: richard, anton.ivanov, johannes, nathan, linux-um

Ping for comments again.

I found a similar patch from 2021 by Johannes Berg: 
https://lkml.iu.edu/hypermail/linux/kernel/2103.1/06608.html

Is there a reason that this or previous patch has concerns and cannot be 
included in kernel?

Cheers,
Alex

On 6/2/26 18:19, Alex Hung wrote:
> Hi,
> 
> Are there any concerns or comments on this patch?
> 
> On 5/12/26 17:26, Alex Hung wrote:
>> 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 <alex.hung@amd.com>
>> 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
>>
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-07-08 21:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-12 23:26 [PATCH 0/1][RFC] Fix no gcda files with kunit.py Alex Hung
2026-05-12 23:26 ` [PATCH 1/1[RFC] um: include .fini_array.* in linker scripts Alex Hung
2026-06-03  0:19   ` Alex Hung
2026-07-08 21:42     ` Alex Hung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox