casaroli commented on code in PR #20813:
URL: https://github.com/apache/nuttx/pull/20813#discussion_r4319971864


##########
tools/Config.mk:
##########
@@ -70,6 +70,15 @@ MODULECC ?= $(CC)
 MODULELD ?= $(LD)
 MODULESTRIP ?= $(STRIP)
 
+# A loadable module of a flat or protected build cannot use the coverage
+# functions of the image (__gcov_init(), ...): its crt0 is built without

Review Comment:
   Done for `CONFIG_COVERAGE_MINI` with GCC: modules now keep their coverage. 
libc.csv exports the gcov functions, and `libelf_uninit()` calls a new 
`__gcov_unload()`, which removes the gcov_info of the module from the list 
before the module memory is freed (`dlclose()`, `rmmod()`, the exit of an 
`exec()` program). The data of a module must be dumped while it is loaded 
(`gcov -d`, or `__gcov_dump()` in the module). Without the unload hook, the 
first dump after an unload hangs on the freed gcov_info; with it, 25 
load/unload cycles and 40 `dlopen()`/`dlclose()` cycles, then a dump, pass.
   
   With libgcov and the clang runtimes, modules stay without coverage for now; 
the question above about libgcov stays open.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to