Issue 179660
Summary Incorrect coverage report for shared library with __llvm_profile_write_file(void);
Labels new issue
Assignees
Reporter ankurrj7
    I am observing that llvm-cov does not report any coverage data for functions located in a shared library when the application exits using _exit(), even though profiling data is explicitly written using __llvm_profile_write_file().

This results in missing coverage information for shared libraries, while coverage for the main executable is reported correctly.

llvm-cov show --instr-profile="" myapp 
/scratch/ankurraj/icx2025.3/shlib/foo.c:
    1|       |#include <stdio.h>
    2|       |
    3|      0|void foo(void){
    4|       |
 5|      0|   printf("Hellow world from foo\n");
    6| 0|}

/scratch/ankurraj/icx2025.3/shlib/main.c:
    1|       |#include <stdio.h>
    2|       |#include "foo.h"
    3|       |#include <unistd.h>
    4|       |int __llvm_profile_write_file(void); 
    5| |
    6|       |
    7|      1|int main() {
    8|      1| printf("[main] calling foo()\n");
    9|      1|    foo();
   10| 1|    printf("[main] returned from foo()\n");
   11|      1| __llvm_profile_write_file();
   12|      1|    _exit(0); << -- this is delebrate 
   13|      1|}

No Data was dumped for shared libraies 
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to