Re: [PATCH v2] gcov: use atomic counter updates to fix concurrent access crashes
From: Arnd Bergmann
Date: Tue Apr 28 2026 - 16:57:13 EST
On Wed, Apr 22, 2026, at 14:51, Konstantin Khorenko wrote:
> @@ -824,7 +824,7 @@ all: vmlinux
>
> CFLAGS_GCOV := -fprofile-arcs -ftest-coverage
> ifdef CONFIG_CC_IS_GCC
> -CFLAGS_GCOV += -fno-tree-loop-im
> +CFLAGS_GCOV += -fno-tree-loop-im -fprofile-update=prefer-atomic
> endif
> export CFLAGS_GCOV
Unfortunately, this causes link failures in a few files that
end up trying to use the libgcc atomic function calls. From
my randconfig builds with gcc-16, I have so far seen:
x86_64-linux-ld: io_uring/io_uring.o: in function `io_uring_fill_params':
io_uring.c:(.text+0x40): undefined reference to `__atomic_fetch_add_8'
aarch64-linux-ld: io_uring/io_uring.o: in function `io_req_sqe_copy':
io_uring.c:(.text+0x2c): undefined reference to `__aarch64_ldadd8_relax'
aarch64-linux-ld: kernel/trace/trace_selftest_dynamic.o: in function `trace_selftest_dynamic_test_func':
trace_selftest_dynamic.c:(.text.trace_selftest_dynamic_test_func+0x24): undefined reference to `__aarch64_ldadd8_relax'
aarch64-linux-ld: trace_clock.c:(.text.trace_clock_global+0x3c): undefined reference to `__aarch64_ldadd8_relax'
ERROR: modpost: "__atomic_fetch_add_8" [kernel/trace/ring_buffer_benchmark.ko] undefined!
ERROR: modpost: "__aarch64_ldadd8_relax" [kernel/trace/preemptirq_delay_test.ko] undefined!
ERROR: modpost: "__aarch64_ldadd8_relax" [kernel/trace/synth_event_gen_test.ko] undefined!
ERROR: modpost: "__aarch64_ldadd8_relax" [kernel/trace/remote_test.ko] undefined!
ERROR: modpost: "__aarch64_ldadd8_relax" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined!
Since I build only with CONFIG_COMPILE_TEST=y, it looks like these
are the files that explictly enable GCOV, and likely all others
would run into the same issue.
Arnd